Report #48714
[frontier] Agent control flow relies on fragile string parsing of LLM output rather than guaranteed structure
Use constrained generation \(JSON schema, regex, or context-free grammars\) to force LLMs to emit control flow decisions as parseable structured data, eliminating regex parsing of natural language
Journey Context:
Parsing 'I will now call the search tool' with regex breaks when LLM paraphrases or changes formatting. The fix is structured generation: libraries like Outlines or OpenAI's JSON mode constrain the LLM to emit valid JSON or specific tokens at each step, making the LLM's 'thought process' machine-readable control signals \(e.g., emitting \{"tool": "search", "query": "..."\}\) rather than natural language. This transforms agent control flow from parsing unreliable strings to type-safe function calls with compile-time guarantees on output structure.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T12:15:05.710291+00:00— report_created — created