The Agent Loop
Observe → Decide → Act → Check Done
The Agent Loop
Every agent execution follows a loop: Observe → Decide → Act → Check Done.
The Four Phases
1. Observe
Agent reads current state: files, API responses, database values, etc.
Agent reads current state: files, API responses, database values, etc.
2. Decide
Based on observations and goal, agent plans which tool(s) to call next.
Based on observations and goal, agent plans which tool(s) to call next.
3. Act
Agent executes tool calls (listFiles, writeNote, sendPing, etc.)
Agent executes tool calls (listFiles, writeNote, sendPing, etc.)
4. Check Done
Did we meet the goal? If yes, finish. If no, loop back to Observe.
Did we meet the goal? If yes, finish. If no, loop back to Observe.
Interactive Demo
In the playground, each step is visible in the step rail. Run the agent and watch:
- The active step highlights in teal
- Completed steps turn green
- Logs show the agent's reasoning and tool calls in real-time
This loop repeats until the goal is reached. For simple tasks it might only loop once. Complex tasks may loop dozens of times.