Agent State-Machine Router Evaluator
Define your agent's states and transitions as rows or pasted text, then detect unreachable states, duplicates, cycles, and dead-ends — with a DOT-style graph export.
State Table
| State | Type | Reachable | In-Degree | Out-Degree |
|---|
Analysis Warnings
| Level | Issue | Detail |
|---|
DOT-Style Graph
Professional Insights & Guide
How reachability, cycle detection, and dead-end analysis work under the hood, and how to read the warnings.
How the Analysis Works
The evaluator builds a directed graph where states are nodes
and transitions are edges. Reachability uses a breadth-first
traversal from the start state to find every state that can
actually be entered. Cycle detection runs a depth-first search
with a recursion stack: any back edge to a grey (in-progress)
node reveals an infinite loop, including self-loops like
idle → idle. Duplicate
and conflicting transitions are found by grouping transitions
on from + event;
duplicates repeat an identical route while conflicts fan out
to multiple targets. Dead-ends are simply nodes whose
out-degree is zero.
Troubleshooting & Edge-Case Failure Points
- A start state that isn't in the transition set is flagged immediately — reachability has nowhere to begin.
-
States with only incoming edges (like
done) are legitimately terminal; the tool labels them as dead-ends rather than errors. - Duplicate routes that look identical may hide a mismatch in event spelling — each warning shows the exact offending strings.
- Cycles that pass through several states are reported as full paths so you can trace the loop directly.
Detailed Step-by-Step Instructions
-
Paste a transition list (
from, event, to) or enter transitions directly in the row editor. - Set the start state, then click "Analyze State Machine".
- Read the state table for reachability and degree counts, and the warnings table for duplicates, conflicts, loops, and dead-ends.
- Copy the DOT-style graph into Graphviz, Mermaid, or your design docs to visualize the corrected model.
Informative Guides & Helper Articles
Ultimate Guide to Agent State-Machine Routers
States, events, reachability, and cycle detection for reliable multi-step agent workflows.
Read Article →Best Practices for Agent State-Machine Routers
Explicit error states, guard conditions, and naming that keeps state tables readable.
Read Article →Common Errors in Agent State-Machine Routers
Unreachable states, duplicate transitions, infinite loops, and silent dead-ends explained.
Read Article →Top Optimization Tips for Agent State Routers
Shrink state counts, cache routing decisions, and make transitions deterministic.
Read Article →Future Trends in Agent State-Machine Design
Formal verification, LLM-generated state charts, and hierarchical agent state machines.
Read Article →How to Use the Agent State-Machine Router Evaluator
Models agent states and transitions, then audits for unreachable states, infinite loops, and dead-ends before runtime.
- Define states (awaiting_input, researching, executing, done).
- Wire transitions with triggers and conditions.
- Run the audit; fix every unreachable or loop-flagged state.
The Three Bugs That Kill Agent Routers
State machines fail three ways: unreachable states (dead code that looks like a feature), infinite loops (A-B-A with no terminal escape), and dead-end states (non-terminal, no exits - the conversation that can never finish). The audit is classic graph reachability: walk from entry; unvisited = unreachable; cycles lacking exit edges = loops; non-terminals without outbound edges = dead-ends. Explicit routing makes these visible before users find them - free-form agent loops hide them by design.
Agent State-Machine Router Evaluator FAQ
Why use a state machine instead of letting the LLM choose steps?
The three silent killers become visible and testable. Free-form loops hide them until production.
What is a dead-end state?
A non-terminal state with no outbound transitions. Every state needs a path to done or failed.
How do I break retry loops?
Cap retries in the transition condition (attempts < 3) and provide a failure exit. Escalate on cap.