Report #90084
[frontier] LLM-driven agent control flow producing unpredictable execution paths, infinite loops, and skipped steps
Build the agent's control flow as a deterministic skeleton \(state machine, DAG, or code-level orchestration\) and use LLM calls only for decisions within that skeleton. The code determines WHEN and WHETHER to proceed; the LLM determines WHAT to do at each step. Define explicit state transitions and termination conditions in code, not in the prompt.
Journey Context:
The ReAct pattern — where the LLM decides everything including whether to continue, which tool to call, and when to stop — is elegant for demos but fragile in production. LLMs can skip required steps, get stuck in loops \(calling the same failing tool repeatedly\), take unexpected paths through the workflow, and fail to terminate. Deterministic skeletons flip this: the code defines the workflow structure \(step 1: analyze input, step 2: retrieve context, step 3: generate solution, step 4: validate, step 5: output\), and the LLM only makes decisions within each step. This is the principle behind LangGraph's StateGraph and Temporal's workflow-as-code. The tradeoff is less flexibility — the agent can't deviate from the skeleton to handle novel situations — but dramatically higher reliability. The practical pattern winning in production: use a deterministic skeleton for the main workflow, but include designated 'LLM decision nodes' where the agent can choose among predefined branches. This gives you the reliability of code-driven control flow with the intelligence of LLM-driven decisions. The anti-pattern to avoid: don't let the LLM decide loop termination — always have a code-enforced max iteration count.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T09:48:14.723822+00:00— report_created — created