Agents in the Docs: Parts, Loop and Limits
The building blocks of an agent, when to use one or several, and questions to ask of any agent.
An agent uses a model, tools, memory and a loop to finish a task. It can hand work to other agents, and guardrails keep it in bounds. Start with one agent. Use tracing to see each step, and always set step and spend limits.
- Handoff
- Passing a job from one agent to another.
- Guardrail
- A check or limit that keeps an agent in bounds.
- Tracing
- A record of every step an agent took.
People use the word agent loosely. The OpenAI guide gives a clear picture. An agent can plan and finish tasks using tools. It can work with other agents. It keeps track of context across steps. This lesson turns that into a checklist you can use when you read any agent documentation.
The parts of an agent
- Model: the brain. It decides what to do next.
- Tools: search, files, code, your own services and MCP servers.
- Memory: the chat so far, saved sessions and notes. Each product stores these in its own way.
- Handoffs: one agent passes a job to a specialist.
- Guardrails: checks on inputs and outputs, and limits on what it may do.
- Tracing: a record of every step, so you can see what happened.
The loop
An agent repeats a simple cycle. It looks at the goal, picks an action, uses a tool, reads the result and decides again. It stops when the goal is met or a limit is reached.
One agent or several
Start with one agent. It is easier to build and to understand. Add more only when one agent is overloaded. Signs include too many tools, mixed jobs or very long instructions. Then split the work into a few focused agents.
- One agent: a contained job with a few tools.
- Several agents: separate skills, such as research, writing and checking.
- Always give each agent one clear job.
Questions to ask of any agent product
- What can it do on its own, and what needs my approval?
- What does it remember, and where is that stored?
- Can I see each step it took?
- What limits stop it from running forever or spending too much?
- How do I stop it?
A worked example
Say you want an agent that books meetings. The goal is simple: find a time that works and send the invite. The tools are a calendar lookup and an email sender. The memory holds the people and the rules, such as no meetings before nine. The guardrail says to ask a person before it sends an invite to anyone outside the company. The limit says to stop after ten steps.
Now watch the loop. It looks at the goal and checks calendars. It picks a slot, then checks the rules. It asks for approval and sends the invite. If a calendar is full, it tries again with another slot. It stops when the invite is sent or the limit is reached.
This one agent is enough. You only need a second agent if the job grows, such as adding travel booking with its own tools.
When you read about any agent product, map it onto these parts. Ask which part is strong and which is missing. A product with great tools but no step limits is risky. A product with limits but no tracing is hard to trust.
- ✓An agent uses a model, tools, memory and a loop to finish a task.
- ✓Handoffs pass work between agents, and guardrails keep them in bounds.
- ✓Start with one agent and split only when it is overloaded.
- ✓Tracing shows each step, which is key for trust.
- ✓Always set step and spend limits.
Draw an agent on paper
- Choose a task, such as booking a meeting.
- List the model's goal, the tools it needs and what it must remember.
- Mark the steps that need a human approval.
- Write a step limit and a spend limit.
Q1What is the agent loop?show answer
Look at the goal, decide, act with a tool and check the result. Then repeat.
Q2When should you add a second agent?show answer
When one agent is overloaded, such as too many tools or mixed jobs.
Q3What does tracing give you?show answer
A record of every step, so you can see what the agent did and why.