Beginner-Friendly Topic
Take your time - it's perfectly normal to re-read this topic 2-3 times. Try the interactive code editor below to run code yourself. Use the Q&A section to check your understanding before moving on.You've got this!
State Transitions
State transitions describe how the agent moves from one state to another as it completes steps. Tracking state transitions is essential for debugging and monitoring agents.
Agent State Transitions
An agent moves through several possible states during a task:
Initialised: the goal has been received. The agent is ready to start.
Running: the agent is executing steps. It is calling tools and processing observations.
Waiting: the agent has paused. It is waiting for a tool response, a human approval, or an external event.
Complete: the goal has been achieved. The agent has produced a result.
Failed: the agent encountered an error it cannot recover from.
Escalated: the agent has passed control to a human because it cannot continue without input.
Transitions:
Initialised -> Running (when first action is taken)
Running -> Running (after each successful step)
Running -> Waiting (when human approval is needed)
Waiting -> Running (when approval is received)
Running -> Complete (when goal is achieved)
Running -> Failed (on unrecoverable error)
Running -> Escalated (when human input is needed)