Introduction
The core process behind an AI agent is a repeating loop with three stages: observe, think, and act.
Observe
In the observation stage, the agent reads the context available to it. This may include:
- The user's current request.
- Earlier messages in the same conversation.
- Persistent instruction files.
- Project files and active documents.
- Results from previous tool calls.
- Research gathered from the internet.
- Code output, command-line output, or error messages.
- Images, audio, camera information, or video-derived information.
- Memory files containing preferences or earlier lessons.
- Tool descriptions explaining what actions are available.
The observation step answers several questions: What is the user trying to achieve? What information is already available? What has already been attempted? What happened after the previous action? What constraints are currently active? What tools can be used?
Think
In the thinking stage, the agent reasons about the next step. It considers the goal, the current state, the available evidence, and the remaining work. It may create a short plan, select a tool, decide whether more research is needed, identify a missing requirement, or determine that the task is complete.
Agentic coding environments often expose a planning or reasoning view. This visibility is useful because it improves interpretability, accountability, and steerability. A user who can inspect the agent's direction can interrupt a poor plan, supply missing context, pause execution, or redirect the system before it spends more time and tokens on the wrong path.
Act
In the action stage, the agent executes the next step. Depending on its tools, it may:
- Search the web.
- Read or edit a file.
- Write or run code.
- Execute a command-line instruction.
- Call an API.
- Open a browser.
- Click a button or fill a form.
- Generate a report.
- Ask another model or subagent to perform work.
The result of the action is returned to the observation stage. The agent now has additional context: what it tried, what happened, and what new information became available. It reasons again and selects the next action.
The loop can be represented as:
Observe current state -> Think about the next best step -> Act using a tool -> Observe the result -> Think again -> Act again.
This cycle may repeat only a few times for a simple task or many times for a complex project. The important point is that the agent does not merely produce one response. It continues to build context and take actions.