Report #47804
[frontier] Encoding control flow and business logic in LLM prompts causes unpredictable agent behavior and fragile workflows
Separate orchestration from intelligence: implement control flow \(branching, looping, error handling, retries, timeouts\) in deterministic code. Use LLM calls only for judgment tasks \(classification, generation, extraction\). Define the workflow as a graph with nodes \(LLM calls or code functions\) and edges \(conditional logic in code\). Use LangGraph for the graph runtime or Temporal for durable execution.
Journey Context:
Early agent patterns tried to encode everything in the prompt: 'If the user asks about X, do Y; if they ask about Z, do W.' This is fragile because LLMs don't reliably follow procedural instructions—they can skip steps, misinterpret conditions, or hallucinate branches. The pattern winning in production is 'workflow-as-code, intelligence-as-calls': the graph structure \(nodes and conditional edges\) is defined in deterministic Python/TypeScript, and LLM calls happen at specific nodes where judgment is needed. LangGraph embodies this pattern natively. Temporal \+ AI is another emerging variant where Temporal handles durability, timeouts, and retries, and AI calls are activities within the workflow. Tradeoff: more engineering upfront than a single mega-prompt, but dramatically more reliable and debuggable. What people get wrong: they think 'agentic' means the LLM should control all flow decisions, but production systems need deterministic scaffolding around LLM flexibility—the LLM decides what's inside a node, not which node comes next.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T10:42:57.044172+00:00— report_created — created