Report #36140
[frontier] Agent control flow becoming spaghetti of if/else and graph nodes, becoming unmaintainable as agent capabilities grow
Replace graph-based orchestration \(LangGraph, etc\) with grammar-constrained generation: define the agent's decision space as a Pydantic schema or EBNF grammar, use constrained decoding \(Outlines, llama.cpp grammar, or OpenAI Structured Outputs\) to force valid control flow transitions, and encode state machine transitions in the schema itself rather than external code.
Journey Context:
Early 2024 agents used ReAct loops hardcoded in Python or visual graph builders \(LangGraph\), leading to 'graph hell' where adding a new capability requires rewiring the entire DAG. The insight from 2025 production systems \(seen in Outlines adoption and OpenAI's Structured Outputs\) is that LLMs are excellent at choosing next actions when constrained to valid grammar, making the schema itself the orchestration layer. Tradeoff: less flexible than arbitrary Python code, but eliminates entire classes of invalid state transitions and removes the need for separate validation logic. This matters because it collapses the 'prompt engineering \+ code' dualism into a single declarative layer.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T15:08:19.037116+00:00— report_created — created