Agents and Tool Use
Learn the published mechanisms for reasoning, tool use, planning, reflection, memory, search, and multi-agent interaction.
Background reading
Introduction to Agents and Tool Use
An AI agent is a system in which a model can choose an action, receive the result, and use that new information to choose what happens next. Tools give those actions an effect outside the model’s text generation.
Suppose the task asks for a fact the model does not know. A single model call can guess, but an agent can search, read the result, and decide what to do next.
Reasoning and Acting (ReAct) organizes that process as a sequence of thoughts, actions, and observations. A thought records what information is needed. An action asks the environment to do something, such as search. The observation is the result returned by that action.
The task and everything produced so far form the context. After a search result is added, the next model step can use that new evidence. It is not choosing from the original question alone.
A thought changes only the text in the context. It does not call a tool or change the outside environment. An action is different: software executes it and returns an observation.
The loop repeats until the model produces a finishing action or reaches a step limit. The pseudocode below shows that control flow directly.
Planning, retrieval, memory, and communication with other agents can be added around this loop. They are additional capabilities, not part of the definition of every agent.
Continue with Pro
Get Pro on codebaobab.com.
What you will learn next
- 01The Agent Around the Model
- 02The Reason–Act–Observe Loop
- 03What a ReAct Thought Does
- 04Where ReAct Still Fails
- 05Tool Schemas and Function Calling
- 06Learning When to Use a Tool
- 07Training Across Many APIs
- 08Planning Independent and Dependent Tool Calls
- 09Delegating Tasks to Specialist Models
- 10Retrying With a Stored Reflection
- 11Searching More Than One Trajectory
- 12Using Executable Code as the Action
- 13Memory and State
- 14When Agents Work Together
- 15Evaluating Accuracy and Cost
- 16The Agent Threat Model
- 17Follow the ReAct Trajectory
- 18Keep the API Call That Helps Prediction
- 19Run Two Independent Searches Together
- 20Turn a Failed Trial Into the Next Attempt’s Memory
- 21Use an Execution Result in the Next Turn
- 22Containing a Tool-Using Agent
- 23Comparing Agents by Accuracy and Cost
- 24Review
- 25References