A state machine (or finite-state machine, FSM) is a computational model consisting of a finite number of states, transitions between those states triggered by events, and optional actions performed during transitions or within states. It provides a mathematical abstraction for designing systems where behavior is determined by a defined condition (state) at a given time, making it a core construct for modeling workflow execution, protocol logic, and discrete control systems. In multi-agent orchestration, state machines define an agent's or a workflow's operational lifecycle, ensuring predictable, auditable transitions between phases like idle, processing, and error handling.
