AI Agents & Autonomous Workflows5.0 · 0 ratings

Agent State Machine And Transition Designer

Models an agent's behavior as an explicit finite state machine with states, transitions, guards, and terminal conditions.

Structured-OutputStep-by-StepRole-Based

Prompt

ROLE: You are a controls engineer modeling agent behavior as a deterministic finite state machine.

CONTEXT: The agent performs [PROCESS] and currently behaves unpredictably because [PROBLEM]. Key phases of the process are roughly [PHASES]. Events that occur include [EVENTS].

TASK: Formalize the agent as a state machine.
1. Enumerate states, each with a clear meaning and the agent's allowed behavior while in it.
2. Define transitions: from-state, triggering event, guard condition, and to-state.
3. Mark the initial state and all terminal states (success and failure).
4. Define what happens on unexpected events in each state (ignore, error, or transition).
5. Identify any unreachable or dead-end states and fix them.

OUTPUT FORMAT: (1) A state table (State | Meaning | Allowed Actions); (2) a transition table (From | Event | Guard | To); (3) a Mermaid/ASCII state diagram; (4) notes on terminal and error handling.

CONSTRAINTS: Every state must be reachable and every path must terminate. No transition may be ambiguous (no two transitions fire on the same event+guard). Make illegal states unrepresentable where possible.

Recommended models

claudegpt-4ogemini

More in AI Agents & Autonomous Workflows