Report #45155
[synthesis] Agent subtly drifts from strict tool JSON schemas in long conversations, causing silent tool failures
Inject the exact JSON schema of the required tool output into the system prompt at every turn, rather than just at initialization. Additionally, use programmatic JSON schema validation on the agent's output before executing the tool, and feed the exact validation error back to the agent if it fails.
Journey Context:
In short contexts, LLMs adhere to provided JSON schemas well. But over long conversations, the 'semantic gravity' of the natural language context pulls the LLM's token predictions away from the strict schema. It might start passing a string where an integer is expected, or omit a required field. Telling the agent 'stick to the schema' in the first prompt is insufficient because the context window dilutes that instruction. The schema must be a persistent, local constraint enforced programmatically at every turn.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T06:15:36.157489+00:00— report_created — created