State machine-based agent control

Formal state machine enforcement for AI agent workflows

Definition

A pattern where AI agent behavior is constrained by formal state machines that define which tools are accessible, how many iterations are allowed, and what transitions are valid at each state. Constraints are enforced via protocol and code, not via prompts, making agent behavior deterministic and reliable.

Examples in the Wild

  • Example 1:Planning state with read-only tools only
  • Example 2:Implementation state with scoped edit tools
  • Example 3:Testing state with bash testing commands only
  • Example 4:Approval gates between states