What an AI agent really is: the perceive, plan, act, observe loop
# What an AI agent really is: the perceive, plan, act, observe loop
Type this into a modern AI assistant: "Research the top 3 competitors to Notion and put them in a comparison table."
Watch what happens. It searches the web. It reads a few pages. It notices it only found two solid competitors, so it searches again. It pulls pricing, checks a review site, then builds the table. You gave it one instruction and it took maybe eight steps on its own.
That self-directed loop is the whole difference between an agent and a chatbot. A chatbot answers. An agent works.
Agent vs. single prompt
A single prompt is one question in, one answer out. You ask, the model responds using only what it already knows. If it needs fresh information or a calculation, it can't go get it. It just guesses.
An AI agent is a language model that can take actions, see the results, and decide what to do next, repeating until the goal is met. The key word is *loop*. The agent isn't limited to one turn. It keeps going until the job is done or it decides it's stuck.
Here's the plain-language definition we'll use:
> An agent is a language model plus tools plus a loop.
A tool is any action the model can trigger: a web search, a calculator, a database lookup, sending an email, running code. The loop is the engine that lets the model use those tools repeatedly, adjusting as it learns.
The loop: perceive, plan, act, observe
Every agent, no matter the vendor, runs some version of this four-step cycle. Let's trace it with the competitor-research task.
1. Perceive
The agent takes in the current situation: your instruction plus everything it knows so far.
At the start, "perceive" is just your prompt: *"Research the top 3 competitors to Notion and put them in a comparison table."* Later in the loop, perceiving also means reading the results of its own previous actions (the search results it just got back).
2. Plan
The agent decides the next step. Not the whole project, just the next move.
Its internal reasoning might be: *"I don't know Notion's top competitors off the top of my head with current data. I should search the web first."*
This is the part people underestimate. The agent isn't following a fixed script you wrote. It's choosing each step based on what it currently knows.
3. Act
The agent uses a tool. Here, it calls a web-search tool with a query like Notion competitors 2026.
This is the moment an agent leaves the chatbot behind. It's no longer just producing text. It's doing something in the world and getting real data back.
4. Observe
The agent reads what the action returned. The search comes back with Coda, Obsidian, and a vague mention of "others."
Now it evaluates: *"I have two strong competitors and one gap. I need one more."*
And then the loop restarts. It perceives the updated situation, plans a second search (best all-in-one workspace apps 2026), acts, and observes again. It might loop three or four times: one search per competitor, one for pricing, one to verify. Only when it has enough does it stop and write the table.
That repeated cycle, driven by the model's own judgment about what's still missing, is what makes it an agent.
What the loop looks like in code
You do not need to build this from scratch (the SDKs below handle it for you), but seeing the skeleton makes the concept click. This is vendor-neutral pseudocode for the loop:
goal = "Research top 3 competitors to Notion and build a comparison table."
messages = [{"role": "user", "content": goal}]
while True:
# PERCEIVE + PLAN: model looks at everything so far and decides next step
response = model.generate(messages, tools=[web_search])
if response.tool_call:
# ACT: run the tool the model asked for
result = run_tool(response.tool_call) # e.g. web_search("Notion competitors 2026")
# OBSERVE: feed the result back so the model can perceive it next turn
messages.append(response)
messages.append({"role": "tool", "content": result})
else:
# No tool needed: the model has its final answer (the table)
print(response.content)
breakRead the comments and you'll see all four steps. model.generate is perceive and plan. run_tool is act. Appending the result is observe. The while loop is what turns a one-shot answer into an agent. The model, not you, decides when to stop by returning a final answer instead of another tool call.
Why the loop matters more than the model
A common assumption: "A smarter model makes a better agent." Partly true. But the loop is what unlocks the model's ability to *recover*.
If the first search returns junk, an agent notices in the observe step and tries a different query. A single prompt can't do that. It commits to its one answer, mistakes and all.
This is also why agents can handle open-ended tasks. You don't have to know in advance how many searches it takes to find three competitors. The agent figures that out as it goes.
The trade-off: loops can run long, cost more, and occasionally go in circles. Good agent design puts limits on the loop, for example "stop after 10 steps" or "stop when the table is complete." We'll cover guardrails like this later in the block.
Knowledge check
1. According to the lesson, what is the defining characteristic that separates an AI agent from a chatbot?
2. The lesson defines an agent with the formula 'a language model plus tools plus a loop.' What role does the 'loop' play in this definition?
3. In the competitor-research example, the agent searches again after finding only two solid competitors. Which step of the Perceive, Plan, Act, Observe loop does this 'searching again' decision most directly illustrate?
4. Select ALL correct answers. Which of the following are accurately described as 'tools' an agent can trigger, based on the lesson's definition?
Select all the correct answers.
5. Select ALL correct answers. Which statements accurately describe a single prompt (one question in, one answer out) compared to an agent?
Select all the correct answers.
Tools are the agent's hands
Without tools, even the loop is useless. A model that can only talk can't research anything. Tools are how the agent reaches outside its own head.
Common tool types you'll see in real agents:
- Search / retrieval: web search, or looking up your company's internal documents.
- Compute: a calculator or a code runner for math and data work.
- Read/write to systems: query a database, update a spreadsheet, send a Slack message.
- Other agents: yes, an agent can call another agent as a tool.
For the competitor task, the agent needed exactly one tool: web search. Add a "write to Google Sheets" tool and the same agent could drop the finished table straight into your workspace, no copy-paste.
If you want a clear, free primer on how tool use and agent loops fit together, Anthropic's Building Effective Agents guide is vendor-neutral in spirit and widely referenced across the industry.
Where the vendors fit in
The perceive-plan-act-observe loop is identical across providers. What differs is the toolkit each one gives you to build it:
- OpenAI Agents SDK
- Claude Agent SDK (Anthropic)
- Google's Agent Development Kit (ADK)
All three wrap the same loop, handle the tool-calling plumbing, and add features like memory and guardrails. Pick one based on the model you already use; the concepts you learned here transfer directly. The provider deep-dive blocks later in this course cover each SDK hands-on.
For now, the mental model matters more than the tool. If you understand that an agent is *model plus tools plus a loop*, you understand every agent framework on the market in 2026.
A quick self-check
Ask yourself, of any AI feature you use: *does it take multiple actions and decide the next one based on results?*
- "Summarize this email." One step, no tools. Not an agent. Just a prompt.
- "Check my calendar, find a free 30-minute slot next week, and email SamSamServiceable Addressable Market: the slice of TAM you can realistically reach given your current business model, geography, and distribution channels.View full definition → to propose it." Multiple actions, decisions based on what it finds. Agent.
The dividing line is the loop, not how impressive the answer sounds.
Key Takeaways
- An agent = a language model + tools + a loop. Remove any one and you're back to a chatbot.
- The loop has four steps: perceive, plan, act, observe. The agent repeats them, choosing each next step based on what it just learned, until the goal is met.
- Tools are the agent's hands. Web search, code, databases, other agents. Without them, the loop can't touch the real world.
- The loop, not raw model intelligence, is what lets an agent recover from bad results and handle open-ended tasks where you can't script every step.
- The concept is vendor-neutral. OpenAI, Claude, and Google SDKs all wrap the same loop, so learn the pattern once and it transfers everywhere.
Related articles
Recent articles from the blog that build on this lesson.
- AIWhat an AI agent actually is, and where the hype endsThe term "AI agent" is applied to everything from a simple chatbot to autonomous software that books flights and writes code. This article cuts through the noise to explain what agents genuinely are, how they work mechanically, and when they are worth deploying.
- AIHuman oversight in agent workflows: what it actually means to stay in controlAs AI agents take on multi-step tasks autonomously, the question of when and how humans should intervene has become one of the more consequential design decisions in enterprise AI. This article unpacks the mechanics of oversight in agentic systems and explains how to think about it practically, not theoretically.
- AIHuman oversight in agent workflows: what it actually means to stay in controlAs AI agents take on multi-step tasks with real consequences, the question of where humans intervene has become a design problem, not a policy slogan. This article unpacks the mechanics of oversight in agent workflows and explains when to tighten or loosen human control.