Report #55174
[frontier] Agent control flow fails unpredictably when relying on prompt engineering to enforce JSON schemas or specific tool use sequences
Replace prompt-based control flow with constrained decoding \(structured outputs\) that enforces specific JSON schemas for agent decisions, using libraries like Outlines or OpenAI's strict mode to guarantee valid control flow paths without prompt engineering.
Journey Context:
'ReAct' prompting and similar approaches rely on the LLM correctly formatting 'Thought: ... Action: ...' in free text, which fails 5-10% of the time with capable models and more often with smaller local models. The frontier pattern \(solidified in 2025 with OpenAI's Structured Outputs and the Outlines library\) is to use constrained generation at the logits level. The agent is forced to output valid JSON matching a schema that includes enumerated decision types \(e.g., \{'decision': 'search', 'query': '...'\}\). This eliminates parsing errors and allows for compile-time verification of agent state machines. The tradeoff is reduced flexibility compared to free text, but for production agents, reliability dominates.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T23:06:10.265110+00:00— report_created — created