embabel: move to 1.5.4, add Spring Boot application, deterministic testing layers and measured failure modes
Spring Boot starter and OpenAI-compatible model module behind a REST endpoint, tested against a fake provider on localhost. FakeOperationContext and EmbabelMockitoIntegrationTest examples, retry multiplication, a STUCK process surfacing as NullPointerException, two-goal agents, and plain Spring AI with the branches written. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b6vDJ5fWY5uEZaJFNi
This commit is contained in:
@@ -1,13 +1,21 @@
|
||||
mvn dependency:tree for the embabel module, filtered to embabel, spring-ai, spring-boot and kotlin-stdlib:
|
||||
mvn dependency:tree for the embabel module, filtered to embabel, spring-ai, spring-boot, openai-java and kotlin-stdlib:
|
||||
com.ankurm.agents:embabel:jar:1.0.0
|
||||
com.embabel.agent:embabel-agent-api:jar:1.5.3:compile
|
||||
com.embabel.agent:embabel-agent-ai:jar:1.5.3:compile
|
||||
com.embabel.common:embabel-common-core:jar:2.0.4:compile
|
||||
com.embabel.common:embabel-common-util:jar:2.0.4:compile
|
||||
ch.qos.logback:logback-classic:jar:1.5.38:compile
|
||||
com.embabel.common:embabel-common-textio:jar:2.0.4:compile
|
||||
com.embabel.agent:embabel-agent-api:jar:1.5.4:compile
|
||||
com.embabel.agent:embabel-agent-ai:jar:1.5.4:compile
|
||||
com.embabel.common:embabel-common-core:jar:2.0.5:compile
|
||||
com.embabel.common:embabel-common-util:jar:2.0.5:compile
|
||||
com.embabel.common:embabel-common-textio:jar:2.0.5:compile
|
||||
org.jetbrains.kotlin:kotlin-stdlib:jar:2.2.21:compile
|
||||
org.springframework.boot:spring-boot:jar:4.1.1:compile
|
||||
org.springframework.ai:spring-ai-client-chat:jar:2.0.1:compile
|
||||
org.springframework.ai:spring-ai-model:jar:2.0.1:compile
|
||||
org.springframework.ai:spring-ai-commons:jar:2.0.1:compile
|
||||
com.embabel.agent:embabel-agent-starter:jar:1.5.4:compile
|
||||
com.embabel.agent:embabel-agent-platform-autoconfigure:jar:1.5.4:compile
|
||||
com.embabel.agent:embabel-agent-starter-openai-custom:jar:1.5.4:compile
|
||||
com.embabel.agent:embabel-agent-openai-custom-autoconfigure:jar:1.5.4:compile
|
||||
com.embabel.agent:embabel-agent-openai:jar:1.5.4:compile
|
||||
com.embabel.agent:embabel-agent-byok:jar:1.5.4:compile
|
||||
org.springframework.ai:spring-ai-openai:jar:2.0.1:compile
|
||||
com.openai:openai-java-core:jar:4.49.0:compile
|
||||
org.springframework.boot:spring-boot:jar:4.1.1:compile
|
||||
com.embabel.agent:embabel-agent-test:jar:1.5.4:test
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
GET /brief?topic=virtual%20threads
|
||||
HTTP 200 {"text":"Virtual threads: blocking is cheap again."}
|
||||
|
||||
Requests the fake provider received (base-url had no path):
|
||||
POST /chat/completions
|
||||
POST /chat/completions
|
||||
@@ -0,0 +1,7 @@
|
||||
First request body on the wire, same user question. The date is replaced with <today>.
|
||||
|
||||
Embabel createObject(prompt, Summary.class):
|
||||
{"messages":[{"content":"Current date: <today>\n\n\n\nYour response should be in JSON format.\nDo not include any explanations, only provide a RFC8259 compliant JSON response following this format without deviation.\nDo not include markdown code blocks in your response.\nRemove the ```json markdown from the output.\nHere is the JSON Schema instance your output must adhere to:\n```{\n \"$schema\" : \"https://json-schema.org/draft/2020-12/schema\",\n \"type\" : \"object\",\n \"properties\" : {\n \"text\" : {\n \"type\" : \"string\"\n }\n },\n \"additionalProperties\" : false\n}```\n","role":"system"},{"content":"Summarise these notes in one sentence: JEP 444 makes virtual threads final in Java 21. Virtual threads are cheap to block, so thread-per-request scales again.","role":"user"}],"model":"scripted-model"}
|
||||
|
||||
Plain Spring AI chat.prompt().user(prompt).call().content():
|
||||
{"messages":[{"content":"Summarise these notes in one sentence: JEP 444 makes virtual threads final in Java 21. Virtual threads are cheap to block, so thread-per-request scales again.","role":"user"}],"model":"scripted-model"}
|
||||
@@ -0,0 +1,11 @@
|
||||
Profile guarded.
|
||||
|
||||
GET /brief?topic=virtual%20threads
|
||||
HTTP 200, provider calls 2
|
||||
|
||||
GET /brief?topic=quantum%20gravity
|
||||
HTTP 500 {"status":500,"error":"Internal Server Error","path":"/brief"}
|
||||
provider calls 0
|
||||
|
||||
The exception AgentInvocation.invoke threw:
|
||||
java.lang.NullPointerException: get(...) must not be null
|
||||
@@ -0,0 +1,9 @@
|
||||
Profile two-agents: ResearchAgent and CostAwareResearchAgent are both deployed.
|
||||
Deployed agents: [CostAwareResearchAgent, ResearchAgent]
|
||||
|
||||
Three calls to GET /brief:
|
||||
HTTP 200, provider calls 1
|
||||
HTTP 200, provider calls 1
|
||||
HTTP 200, provider calls 1
|
||||
|
||||
(2 provider calls means ResearchAgent ran; 1 means CostAwareResearchAgent ran.)
|
||||
@@ -0,0 +1,7 @@
|
||||
Every reply is HTTP 200 with plain prose instead of JSON. Default retry settings.
|
||||
|
||||
One call to AgentInvocation.invoke
|
||||
requests the provider received: 50
|
||||
of those, by the OpenAI SDK's x-stainless-retry-count header: {0=50}
|
||||
wall time, seconds (indicative): 182
|
||||
exception: java.util.concurrent.ExecutionException: com.embabel.agent.core.support.InvalidLlmReturnFormatException: Invalid LLM return when expecting com.ankurm.agents.embabel.Domain$Summary: Root cause=tools.jackson.databind.exc.MismatchedInputException: No content to map due to end-of-input
|
||||
@@ -0,0 +1,7 @@
|
||||
Every reply is HTTP 500. embabel.agent.platform.models.openai.custom.max-attempts=1, everything else default.
|
||||
|
||||
One call to AgentInvocation.invoke
|
||||
requests the provider received: 150
|
||||
of those, by the OpenAI SDK's x-stainless-retry-count header: {0=50, 1=50, 2=50}
|
||||
wall time, seconds (indicative): 249
|
||||
exception: java.util.concurrent.ExecutionException: com.openai.errors.InternalServerException: 500: upstream exploded
|
||||
@@ -0,0 +1,4 @@
|
||||
embabel.models.default-llm=gpt-typo while the registered model is scripted-model.
|
||||
|
||||
Application start fails. Root cause:
|
||||
java.lang.IllegalArgumentException: Default LLM 'gpt-typo' is neither a registered model nor a configured role. Set the 'embabel.models.default-llm' property to one of the available models: [scripted-model], or to one of the roles: [].
|
||||
@@ -0,0 +1,5 @@
|
||||
FakeOperationContext, one action called as an ordinary method.
|
||||
|
||||
returned: Summary[text=Virtual threads make blocking cheap.]
|
||||
prompt: Summarise these notes in one sentence: note one. note two.
|
||||
LLM calls recorded: 1
|
||||
@@ -0,0 +1,6 @@
|
||||
50 fresh platforms, each asked for a Brief; every process ended COMPLETED.
|
||||
|
||||
TwoGoalsAgent (@AchievesGoal on summarise and writeBrief): Brief produced in 0 of 50 runs
|
||||
Same, with @AchievesGoal(value = 1.0) on writeBrief: Brief produced in 50 of 50 runs
|
||||
|
||||
The first figure is not stable from one JVM run to the next.
|
||||
@@ -0,0 +1,3 @@
|
||||
Same two summarisers, costs swapped (LLM 0.1, local 0.9).
|
||||
|
||||
ran: [findSources, summariseWithLlm, writeBrief]
|
||||
@@ -0,0 +1,5 @@
|
||||
PlainGuardedResearch, the three branches written by hand.
|
||||
|
||||
known sources -> first prompt: Summarise these notes in one sentence: A note we already had.
|
||||
unknown topic -> result Optional.empty, LLM calls 0
|
||||
cheap summary -> LLM calls 1
|
||||
@@ -0,0 +1,3 @@
|
||||
@SpringBootTest + EmbabelMockitoIntegrationTest, no HTTP provider.
|
||||
|
||||
result: Brief[text=Virtual threads: blocking is cheap again.]
|
||||
@@ -0,0 +1,7 @@
|
||||
Every reply is plain prose. data-binding.max-attempts=1, action-qos.default.max-attempts=1.
|
||||
|
||||
One call to AgentInvocation.invoke
|
||||
requests the provider received: 1
|
||||
of those, by the OpenAI SDK's x-stainless-retry-count header: {0=1}
|
||||
wall time, seconds (indicative): 0
|
||||
exception: java.util.concurrent.ExecutionException: com.embabel.agent.core.support.InvalidLlmReturnFormatException: Invalid LLM return when expecting com.ankurm.agents.embabel.Domain$Summary: Root cause=tools.jackson.databind.exc.MismatchedInputException: No content to map due to end-of-input
|
||||
@@ -0,0 +1,7 @@
|
||||
Every reply is HTTP 500. data-binding.max-attempts=1, action-qos.default.max-attempts=1.
|
||||
|
||||
One call to AgentInvocation.invoke
|
||||
requests the provider received: 3
|
||||
of those, by the OpenAI SDK's x-stainless-retry-count header: {0=1, 1=1, 2=1}
|
||||
wall time, seconds (indicative): 1
|
||||
exception: java.util.concurrent.ExecutionException: com.openai.errors.InternalServerException: 500: upstream exploded
|
||||
@@ -0,0 +1,5 @@
|
||||
Profile guarded.
|
||||
|
||||
GET /brief-checked?topic=quantum%20gravity
|
||||
HTTP 422 {"status":"STUCK","actionsRun":1}
|
||||
provider calls 0
|
||||
@@ -0,0 +1,5 @@
|
||||
base-url ends in /v1
|
||||
|
||||
Requests the fake provider received:
|
||||
POST /v1/chat/completions
|
||||
POST /v1/chat/completions
|
||||
@@ -0,0 +1,10 @@
|
||||
Asked for a Brief, 50 runs per JVM, eight JVMs in a row (scripts/two-goals-across-jvms.sh).
|
||||
|
||||
JVM 1 | equal goals: 0 of 50 runs | valued goal: 50 of 50 runs
|
||||
JVM 2 | equal goals: 50 of 50 runs | valued goal: 50 of 50 runs
|
||||
JVM 3 | equal goals: 0 of 50 runs | valued goal: 50 of 50 runs
|
||||
JVM 4 | equal goals: 50 of 50 runs | valued goal: 50 of 50 runs
|
||||
JVM 5 | equal goals: 50 of 50 runs | valued goal: 50 of 50 runs
|
||||
JVM 6 | equal goals: 50 of 50 runs | valued goal: 50 of 50 runs
|
||||
JVM 7 | equal goals: 50 of 50 runs | valued goal: 50 of 50 runs
|
||||
JVM 8 | equal goals: 50 of 50 runs | valued goal: 50 of 50 runs
|
||||
Reference in New Issue
Block a user