Report #66653
[frontier] Agent workflows implemented as free-form ReAct loops are non-deterministic and hard to debug
Replace ReAct with explicit state machines \(XState, Temporal, LangGraph StateGraph\) where LLM calls are typed state transitions, not open-ended loops
Journey Context:
ReAct \(Reasoning \+ Acting\) encourages the LLM to 'think' and 'act' in an open-ended while-loop. In production, this leads to infinite loops, non-reproducible runs, and 'spooky' behavior that is impossible to trace. The winning pattern is modeling agent behavior as a deterministic state machine \(Statecharts\). Each state has a single responsibility \(e.g., 'ExtractParameters', 'ValidateOutput'\) and explicit transitions triggered by either LLM outputs \(guarded by structured output schemas\) or external events. This enables 'time-travel debugging' \(replay state transitions\), formal verification of reachable states, and type-safe data flow between steps. The tradeoff is reduced 'flexibility' compared to ReAct, but the reliability gains are essential for production agents.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T18:21:33.636981+00:00— report_created — created