# State Machine

- **Canonical URL:** https://getaimath.com/dictionary/state-machine/
- **Topics:** [AI Agents & Agentic AI](https://getaimath.com/dictionary/category/ai-agents-and-agentic-ai/)
- **Last updated:** 2026-11-25

## What is State Machine?

**In one sentence:** A state machine is a system that is always in one of a set of states and moves between them based on rules.

For agents, a state machine can control the flow, like "gathering info" → "confirming" → "booking" → "done." This makes behavior predictable.

![Chatbot vs. AI Agent: Giving Advice vs. Doing the Chore — Simple cartoon comparing a Chatbot (gives you a recipe and stops) with an AI Agent (plans steps, uses tools like your calendar and browser, checks if it worked, and finishes the job).](https://getaimath.com/diagrams/ai-agents-and-agentic-ai.png)
*Napkin Diagram (AI Agents & Agentic AI): A regular chatbot just talks back; an AI agent has hands (tools) and loops until the chore is actually finished.*

## What is an example of State Machine?

A support bot moving from "identify problem" to "suggest fix" to "escalate to human" if the fix fails.

## Why does State Machine matter?

State machines add structure and reliability to AI workflows.

## Related Concepts

- [Long-Horizon Tasks](https://getaimath.com/dictionary/long-horizon-tasks/): Long-horizon tasks are jobs that take many steps or a long time to complete, such as hours of work.
- [Workflow Automation](https://getaimath.com/dictionary/workflow-automation/): Workflow automation is using software, often with AI, to complete repeated multi-step processes automatically.
- [Agent Reliability](https://getaimath.com/dictionary/agent-reliability/): Agent reliability is how consistently an agent completes tasks correctly without failing, getting stuck or causing problems.
- [Agent Evaluation](https://getaimath.com/dictionary/agent-evaluation/): Agent evaluation is testing how well AI agents complete tasks, how reliably and how safely.
- [Guardrails](https://getaimath.com/dictionary/guardrails/): Guardrails are rules and checks that keep an AI system's behavior safe, appropriate and on-task.
- [Human-in-the-Loop](https://getaimath.com/dictionary/human-in-the-loop/): Human-in-the-loop means a person checks, approves or corrects an AI's work at important steps.

---
Source: The AI Math Dictionary (https://getaimath.com/dictionary/state-machine/)
