Skip to content

Agent State Machine

Definition

Agent State Machine — a representation of the agent's logic as a finite state machine: a set of states, a set of transitions, and conditions for triggering. It replaces implicit reasoning cycles with an explicit structure.

Example States

stateDiagram-v2
  [*] --> Idle
  Idle --> Planning: received task
  Planning --> ToolCall: tool selected
  ToolCall --> Observation: result received
  Observation --> Planning: another step needed
  Observation --> Answer: task resolved
  Answer --> [*]

Benefits

  • Deterministic behavior at the management level.
  • Possibility of modular testing of transitions.
  • Explicit handling of errors and timeouts.
  • Simplification of traceability and observability.

See also