Skip to main content
Section 4

From assistant to agent

The loop that turns a model into something that acts.

4 lessons25-question quiz
4.1

What makes something an agent

6 min read

AI Foundations introduced a rough ladder of autonomy: chat replies to what you type, one turn at a time; an assistant helps inside a task or app with some context; an agent plans and takes multiple steps toward a goal, using tools. This section is about that last rung: what actually makes something an agent, and how the parts fit together.

The test is simple. If a system reads your request and hands back one answer, it is chatting or assisting, no matter how good that one answer is. If it can decide on its own to take an action, check what happened, and decide what to do next, without you typing a new prompt for each step, it is behaving like an agent.

Single replyAgent
You ask"Why is this test failing?""Get this test suite passing."
It doesExplains a likely cause in one messageReads the code, edits a file, reruns the tests, checks the result, and tries again if it still fails
Ends whenThe reply is sentThe goal is met, or it hits a limit and hands back to you
One reply vs. multiple steps toward a goal

The three ingredients

  • A goal, not just a question: "get the tests passing" instead of "why did this fail?"
  • Tools: ways to actually do something, such as running a command, editing a file, or calling an API, not just producing text about it.
  • A loop: the ability to take a step, see the result, and decide the next step, repeated until the goal is met or it stops.
Key idea
An agent is not a smarter model. It is the same kind of model, wired to a loop and a set of tools so it can act on a goal across multiple steps instead of answering once.
Everything in AI Foundations about how a model works, including that it can be confidently wrong, still applies to an agent. Acting on a mistake is worse than stating one, which is why the rest of this section covers the loop itself, then memory, then permissions.
Key terms
Agent
A system that plans and takes multiple steps toward a goal, using tools, rather than answering once.
Autonomy
How much a system does on its own before it hands control back to you.
4.2

The agent loop: plan, act, observe, repeat

7 min read

Under whatever branding a product uses, almost every agent runs the same core loop. Understanding these four stages tells you what an agent is actually doing at any moment, and why it sometimes takes several tries to finish a task.

  1. 1PlanDecide the next step toward the goal
  2. 2ActUse a tool to take that step
  3. 3ObserveRead what actually happened
  4. 4RepeatUntil the goal is met, or it stops
The agent loop

Walking through one pass

  1. Plan: given the goal and everything so far, the model decides what to try next. Not the whole solution, just the next move.
  2. Act: it calls a tool to carry out that move, such as running a command, reading a file, or making a request.
  3. Observe: it reads the actual result, output, an error message, a file's new contents, not what it expected the result to be.
  4. Repeat: it folds that result back into its plan for the next step, and the loop runs again.

The observe step is what separates a real agent from a script that runs blindly. A fixed script keeps going whether or not each step actually worked. An agent reads the result of each action and can change course: retry, try a different approach, or stop and ask for help if it is stuck.

Key idea
Plan, act, observe, repeat. The loop keeps running, one step at a time, until the goal is reached or the agent stops.
This is also why an agent can look "slow" compared to a single chat reply: it may run the loop many times, checking its own work along the way, instead of producing one answer up front.
Key terms
Tool
A specific action an agent can take, such as running a command or reading a file, instead of only producing text.
Observe
The step where an agent checks the actual result of its last action before deciding what to do next.
4.3

Memory and managing context

7 min read

AI Foundations covered the context window: the amount of text a model can hold in view at once, measured in tokens. For a single chat reply, that limit rarely matters much. For an agent running a long loop, it is one of the most important constraints in the whole design, because every plan, action, and observation from the loop has to fit inside that same window.

Why the window fills up fast

Each pass through the loop adds more text: the plan, the tool call, and the result it observed. A task that takes twenty steps can generate a long transcript. If all of that stays in the window along with the original goal and any files involved, an agent can run out of room well before the goal is done.

ApproachWhat it doesTrade-off
SummarizingCompresses older steps of the transcript into a shorter recap, keeping the gist and dropping the detailFaster and simple, but fine detail from early steps can be lost
External memoryWrites key facts or results to a file or store outside the window, then reads them back in only when neededKeeps detail available on demand, but adds a step to save and retrieve it
Two ways an agent keeps working past a full window
Neither approach makes the context window bigger. Both are ways of budgeting a fixed amount of space: deciding what stays in view right now and what gets set aside until it is needed again.

This is also why giving an agent a large, sprawling goal in one shot tends to work worse than breaking it into smaller pieces. A smaller goal produces a shorter loop, which leaves more of the window free for the parts that actually matter to the task at hand.

Key idea
The context window is an agent's short-term memory, and every step of the loop spends some of it. Summarizing and external memory are two ways to keep a long task moving without running out of room.
Key terms
Context window
The fixed amount of text, in tokens, a model can hold in view at once. See AI Foundations for the full explanation.
External memory
Facts or results an agent saves outside the context window, such as to a file, and reads back in only when needed.
4.4

Permissions, review, and a human in the loop

7 min read

A chat reply that is wrong costs you a moment of confusion. An agent that is wrong can delete a file, send a message, or spend money before anyone notices, because it is not just producing text, it is taking real actions through tools. That gap is exactly why permissions and review are not an afterthought; they are part of what makes an agent safe to actually use.

What to gate

CategoryExample actionWhy it needs a limit
DataDeleting or overwriting files, dropping a database tableHard or impossible to undo
MoneyMaking a purchase, sending funds, changing a billing planDirect financial consequence
PeopleSending an email, posting publicly, messaging a customerReaches someone else and cannot be unsent
SystemsChanging account or security settings, granting accessCan widen what the agent, or someone else, can do next
Actions worth extra caution

Common ways to add a limit

  • Ask before acting: the agent pauses and asks approval before a specific, listed kind of action.
  • Read-only by default: the agent can look at things and suggest changes, but cannot make changes without a separate step.
  • Scoped tools: give the agent only the tools it needs for the task, not broad access to every system it could reach.
  • A review step: a person checks the agent's work, especially anything irreversible, before it goes live.

None of this is about distrust of the model specifically. It is the same reason a new hire does not get to wire company funds on day one: the more consequential and harder to undo an action is, the more it deserves a second set of eyes, whether that action came from a person or an agent.

Key idea
Permission an agent by consequence, not by convenience. The less reversible an action is, the more it needs a limit, and anything touching data, money, or people should have a human review step.
This is a general principle, not a specific product's settings. Any real agent tool you use will have its own permission controls; the job here is knowing what to look for and gate before you turn one loose on real systems.
Key terms
Human in the loop
A required person review or approval step before an agent's action takes effect.
Scoped tools
Giving an agent only the specific tools and access it needs for a task, instead of broad access to everything it could reach.

Section 4 quiz

25 questions. Pass at 75% to master this section. Retakes are unlimited, and the quiz is where the learning sticks.

Section 4 quiz · From assistant to agentQuestion 1 of 25

What is the key test for whether a system is behaving like an agent?