State Machine Agent
A state machine agent is one whose behavior is modeled as a fixed set of named states — like idle, working, waiting for input — with explicit rules for when it transitions from one to another.
The default mental model for an agent is a continuous loop: perceive, plan, act, observe, repeat (see agent-loop). A state machine agent is a more structured variant of that idea — instead of one undifferentiated loop, its behavior is broken into a fixed, named set of states, and the logic for what the agent does next depends explicitly on which state it's currently in.
An agent like this might sit in an Idle state until a task arrives, move to Working while it executes, and move to Waiting for input if it needs a human or another system to respond before it can continue — and, unlike a one-way sequence, it can transition back: from Waiting for input back to Working once the answer arrives, or back to Idle once a task finishes.
Modeling an agent this way makes its possible behaviors easier to reason about and test, since there's a finite, enumerable set of states rather than an open-ended loop — at the cost of needing to define states and transitions up front, which can be restrictive for genuinely open-ended tasks.
How it works
Each state defines what the agent is allowed to do while in it, and a set of transition rules define which events move it to which other state. The agent's current state is tracked explicitly (often as a simple label or enum), and every action the agent takes is interpreted in light of that state — the same event can lead to different behavior depending on what state the agent was already in.
How it differs
State machine agent vs. DAG workflow: a DAG models a single run's task graph — it starts, executes, and finishes once, with no cycles; a state machine models an agent's ongoing behavior over time, and can legitimately transition back to a state it's been in before, which a DAG by definition cannot.
Common misconceptions
FAQ
What is a state machine agent?
How is a state machine agent different from a DAG workflow?
Last checked: 2026-08-28