home/glossary/State Machines vs Pure ReAct
Agent Architecture Patterns

State Machines vs Pure ReAct

definition

State machine agents enforce explicit transitions between well-defined states (gather_requirements → plan → implement → test → review), while pure ReAct agents let the model freely choose what to do next at each step based on its reasoning — representing a fundamental trade-off between predictability and flexibility. State machines excel when the workflow has a known structure and compliance requirements demand auditability of the execution path, because every transition is explicit and observable.

State machine agents enforce explicit transitions between well-defined states (gather_requirements → plan → implement → test → review), while pure ReAct agents let the model freely choose what to do next at each step based on its reasoning — representing a fundamental trade-off between predictability and flexibility. State machines excel when the workflow has a known structure and compliance requirements demand auditability of the execution path, because every transition is explicit and observable. Pure ReAct excels when the task is open-ended and the optimal sequence of actions can't be predetermined, like debugging a novel issue or exploring an unfamiliar codebase. Most production systems land on a hybrid: a state machine provides the macro-structure (phases of work) while ReAct drives the micro-decisions within each phase (what specific actions to take within the "implement" state). This concept connects to the ReAct pattern for the pure reactive approach, planning patterns for the fully planned alternative, pipeline pattern for the strictly linear state machine variant, and LangGraph as a framework that natively supports graph-based state machines for agents.