Skip to content

Chapter 1 of 14 · Understand · 5 min read

What an AI agent is: model, tools, loop and context

AI Tool Garage editors·

“Agent” has become one of the most overused words in technology, but the idea underneath it is simple. An AI agent is a language model that is allowed to do things, not just say things, and that keeps going in a loop until a job is finished. A chatbot answers your question and waits. An agent reads your request, decides on a step, takes it, looks at what happened, and decides on the next step, over and over, until it can hand you a result. This first chapter of the course gives you a mental model you can use for every agent you meet, from coding assistants in your terminal to research tools in your browser.

The four parts of every agent

Strip away the branding and almost every agent is built from the same four parts. Once you can name them, you can reason about what an agent is good at, why it fails and how to make it better.

PartWhat it isEveryday analogy
ModelThe language model that reads, reasons and decides what to do nextThe brain of a capable new colleague
ToolsActions the model can request: read a file, run a command, search the web, call an APITheir hands, keyboard and access badge
LoopThe program that runs tools on the model’s behalf and feeds results back until the task is doneTheir working day: try, check, adjust, repeat
ContextEverything the model can see right now: instructions, conversation, tool results, loaded skillsThe desk in front of them and what’s on it

The model

The model is the part people talk about most, but on its own it can only produce text. It cannot open a file, browse a page or remember yesterday. What makes modern models useful as agents is that they are good at reading a situation, breaking a goal into steps and choosing which tool to use next. A stronger model generally makes better choices, recovers from mistakes more gracefully and needs fewer hints.

Tools

A tool is a named action with a description and a set of inputs, such as read_file(path) or search_web(query). The model never runs a tool itself. It writes a structured request saying which tool it wants and with what inputs, and the surrounding program decides whether to run it. That separation is what makes agents controllable: the program can ask you for permission, refuse dangerous actions or log everything that happens. Chapter 2 covers tools in detail.

The loop

The loop is the quiet engine of every agent. In plain terms it looks like this:

The agent loop in plain English

1. Send the model the instructions, the conversation so far and the list of tools. 2. The model replies with either a final answer or a request to use a tool. 3. If it asked for a tool: run it (or ask the user first), then add the result to the conversation. 4. Go back to step 1. 5. Stop when the model gives a final answer, or when a limit on steps, time or cost is reached.

That’s really all there is to it. The intelligence lives in the model; the loop just keeps the conversation going and does the model’s bidding. Because each pass through the loop sends the whole conversation again, long tasks get slower and more expensive as the context fills up, which is why good agents are careful about what they put into it.

Context

Context is the model’s working memory: the text it can see in a single request. It includes a system prompt from the agent’s builder, your messages, every tool result so far and any skills or files that have been loaded. The model has no other memory. If something isn’t in the context, the model doesn’t know it, and if the context is crowded with irrelevant material, the model gets distracted. Much of the craft of building and using agents is really context management.

When an agent does something odd, ask “what could it see at that moment?” The answer is nearly always in the context: a misleading tool result, a missing instruction or too much noise.

Chat versus agent

The difference between a chat assistant and an agent isn’t the model. Often it’s the same model. The difference is whether it has tools and a loop, and how much autonomy it is given.

Chat assistantAgent
What it producesText for you to read and act onChanges in the world: edited files, sent requests, finished tasks
Who does the workYou copy, paste and run thingsThe agent runs steps itself, within the permissions you grant
Length of a taskOne question, one answerMany steps, sometimes many minutes
How it checks itselfIt can’t, unless you report backIt can run tests, re-read files or search again
Main riskA wrong answerA wrong action, which is why permissions matter

In practice the line is blurry. Many chat apps now have a few tools, such as web search or code execution, and run short loops behind the scenes. It’s more useful to think of a spectrum of autonomy: from “suggests text” through “uses a tool when asked” to “works through a multi-step task on its own and reports back”.

What agents are good at today

  • Tasks with a clear goal and a way to check success, such as making the tests pass, fixing a lint error or producing a report in a set format.
  • Work that involves many small, tedious steps across files or pages: renaming, migrating, summarising, collecting.
  • Research where the agent can search, read, compare and cite rather than rely on memory.
  • Repeating a known procedure the same way every time, especially when that procedure is written down as a skill.

They are weaker when the goal is vague, when success can’t be checked, or when a mistake is costly and hard to undo. That doesn’t mean you shouldn’t use them there. It means you keep a human in the loop and give the agent fewer permissions.

Where skills fit in

Tools give an agent abilities. Skills give it know-how. An agent skill is a folder of instructions, and sometimes scripts, that teaches the agent how to do one kind of job well, loaded only when the task calls for it. If tools are the agent’s hands, skills are the playbooks it reaches for. The rest of this course is mostly about skills: how they work, how to use them and how to write your own. If you want a quick overview first, read What are agent skills?.

Key takeaways

  • An agent is a model plus tools plus a loop, working inside a context window.
  • The model asks for tools; the surrounding program decides whether to run them.
  • The context is the agent’s only memory, so what goes into it shapes everything.
  • Chat and agent sit on a spectrum of autonomy; more autonomy means permissions matter more.
  • Skills are packaged know-how that agents load on demand, which is where this course goes next.

Put it into practice

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Written by the AI Tool Garage editors. Tool details link to their catalogue pages, which are refreshed weekly; spotted something out of date? Tell us.