Report #21360
[frontier] Non-deterministic agent loops causing infinite cycles or silent failures
Model agent workflows as explicit state machines \(nodes=states, edges=transitions\) with structured outputs enforcing valid transitions only; replace 'while not done' loops with compiled graphs where transition logic is externalized from the LLM.
Journey Context:
Letting the agent 'decide' when to stop or which tool to call next leads to infinite loops \(agent calls Tool A, regrets it, calls Tool B to undo A, loops\) or silent stalls where the agent 'thinks' it's done but hasn't achieved the goal. The wrong fix is adding more prompting \('be careful to not loop'\). The correct pattern is LangGraph-style state machines: the agent LLM is a node that returns a structured output \(e.g., \{'next': 'tool\_node', 'args': \{...\}\}\), and a separate, deterministic router \(compiled graph edge\) interprets this to decide the next node. This separates 'what to do' \(LLM\) from 'control flow' \(code\), making loops bounded and failures debuggable via graph inspection rather than prompt archaeology.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T14:15:45.017018+00:00— report_created — created