What you will learn in Build an AI Agent (From Scratch)
Agents that reason, plan, and act autonomously
Chapter by chapter
Chapter 1: What is an AI agent?
The introduction explains why the book builds agents from scratch rather than relying on frameworks from the outset.
What you learn in chapter 1 →Chapter 2: The brain of AI agents: LLMs
Introduces the research agent built throughout the book and identifies the LLM as its decision-making brain.
What you learn in chapter 2 →Chapter 3: Enabling actions: Tool use
The chapter introduction explains why agents need tools and sketches how an LLM uses a tool result to produce an answer.
What you learn in chapter 3 →Chapter 4: Implementing a basic ReAct agent
This introduction presents ReAct as the repeating reasoning-and-action pattern that combines an LLM with tools to solve problems.
What you learn in chapter 4 →Chapter 5: Building knowledge bases with RAG
Introduces knowledge bases with RAG as the next context-engineering enhancement to the basic agent and previews the chapter’s focus on vector and structure-based search.
What you learn in chapter 5 →Chapter 6: Adding memory to your agent
The chapter introduces why agents need memory and defines the context-growth problem that memory management must address.
What you learn in chapter 6 →Chapter 7: Planning and reflection for complex tasks
Introduces why a reactive agent can struggle with multistep tasks and how planning and reflection address different parts of that problem.
What you learn in chapter 7 →Chapter 8: Empowering agents with code execution
The introduction contrasts predefined tools with giving an agent an environment where its LLM can write and run code.
What you learn in chapter 8 →Chapter 9: Orchestrating multi-agent systems
The introduction explains why growing task complexity motivates specialist agents and shows that the multi-agent system builds on the book’s existing Agent foundation.
What you learn in chapter 9 →Chapter 10: Evaluating agents
This introduction explains why agent autonomy makes rigorous, automated evaluation necessary and why defining success can be difficult.
What you learn in chapter 10 →Concepts explained in this book
- tool usageA tool call is a model-generated specification requesting invocation of a particular external tool with particular arguments.
- AI agentAn AI agent is a software system that uses artificial intelligence to perceive information, perform tasks, and make or execute decisions on a user's or organization's behalf.
- tool descriptionA tool definition is a structured declaration of a callable tool's name, description, parameters, types, and required arguments for access by a language model.
- structured dataData organized according to a defined schema with predictable fields, types, or relationships.
- similarity searchRetrieval is the technique of obtaining relevant information from external data sources for use during task execution.
- rubricAn explicit framework of criteria and performance standards for judging the quality or success of an output.
- code executionCode execution is the running of a program or code fragment in a computational environment to obtain behavior or results.
- GAIAThe GAIA dataset is a collection of benchmark problems, metadata, and associated task files for evaluating general-purpose AI assistants.
- planningPlanning is the construction of an ordered strategy or set of steps for completing a complex task.
- SessionA session is a persistent stateful container that associates conversation history, events, and execution state with a particular conversation identifier across agent runs.
- language modelA large language model is a neural language model trained on extensive text data that generates and interprets language.
- reflectionReflection is an agent technique for examining intermediate reasoning or results and revising subsequent actions.
- pipelineA workflow is a predefined sequence of computational steps that controls execution while delegating selected steps to language models or other components.
- execution contextAn execution context is a structured container for an agent execution session's identifier, event history, step counter, mutable state, and final result.
- transfer patternA transfer pattern hands control of an in-progress task from one AI agent to another agent that continues execution with the conversation context preserved.
- promptAn instruction supplied to a language model that establishes high-level behavior or constraints for an interaction.
- ReActThe ReAct pattern is an agent design in which reasoning and action alternate so the agent can incorporate tool results and adapt its subsequent behavior.
- MCPModel Context Protocol is an open protocol that standardizes how AI applications connect to tools, prompts, resources, and external services.
- tool-based agent consumptionThe agent as tool pattern exposes an AI agent through a callable tool interface so another agent can invoke it with parameters and receive its result.
- human-in-the-loopHuman evaluation is the direct assessment of system outputs by professional graders or domain experts.
- context engineeringThe discipline of designing which information is provided to a language model, when it is provided, and how it is represented for task completion.
- transfer_to_agent toolThe transfer_to_agent tool is a callable capability that hands control from the current agent to a selected target agent.
- tool executionTool execution is the process of sending a tool request with arguments to a server, running the tool, and returning its result.
- pluginAn agent skill is a reusable capability that packages knowledge or procedures for carrying out a class of tasks.
- MCP serverAn MCP server is a protocol component that exposes tools, executes requested tools, and returns their results, potentially by connecting to external services or data.
- embeddingA vector is an ordered collection of numerical values representing an object or its properties in a mathematical space.
- sandboxingA sandbox environment is an isolated execution environment that restricts code or tool operations from affecting the surrounding system.
- rate limitA rate limit is a provider-imposed bound on how many requests or operations a client may perform within a period or concurrently.
- PendingToolCallA pending tool call is a structured representation of a tool invocation awaiting execution approval, including its approval-request information.
- callbackA callback is a callable supplied to software so it can be invoked automatically at a specified event or stage of execution.
- SessionManagerSessionManager is a component that persists, retrieves, and manages sessions across multiple agent interactions.
- evaluation datasetA collection of evaluation examples reserved for measuring a system's performance after development or tuning.
- memoryAgent memory is a mechanism for retaining and retrieving information across an agent's reasoning steps or interactions.
- web searchWeb search is a tool capability that retrieves information from internet-accessible search indexes or pages.
- loopA loop workflow repeatedly runs one or more agents across iterations until a stopping condition is met or an iteration limit is reached.
- evaluation promptAn evaluation prompt is instruction text that specifies how a model should answer a benchmark question and format its response.
- E2BAn E2B sandbox is an isolated cloud execution environment that provides program execution, filesystem access, and command-line operations.
- A2AThe A2A protocol is an HTTP-based open protocol for discovering and coordinating remote AI agents through standardized agent cards, task requests, and responses.
- LlmRequestLlmRequest is a structured container for a single language-model request, including instructions, conversation contents, available tools, and tool-selection settings.
- research agentA research agent is an LLM agent that gathers and synthesizes information from multiple sources to produce a research report.
- isolationContext isolation is the separation of the information supplied to one agent from the context supplied to another agent during coordinated execution.
- specialized agentA specialized agent is an AI agent designed for domain-specific tasks that require substantial expertise or extended processing.
- evaluationAgent evaluation is the systematic measurement of an agent's behavior and task performance.
- text chunkText chunking is the division of source text into smaller segments for storage, retrieval, or processing.
- compactionA compaction strategy replaces processed or externally stored content in an agent's context with lightweight references that permit later retrieval.
- schemaA schema is a formal specification of the fields, types, and constraints that valid structured data must satisfy.
- trajectoryAn execution trace is a chronological record of events and intermediate activity produced during program or agent execution.
- LiteLLMLiteLLM is an open-source software library that provides a unified interface for calling language models from different providers.
- prompt engineeringPrompt engineering is the practice of designing prompts and instructions to elicit accurate or appropriately formatted outputs from a language model.
- semaphoreA semaphore is a synchronization primitive that limits how many concurrent operations may enter a protected region.
- workspaceAn agent workspace is an execution environment in which the agent can create, inspect, and manipulate task-related artifacts.
- multi-agent systemA multi-agent setup is an architecture in which multiple agents cooperate to complete a task.
- validationData validation is the process of checking data against specified structural, type, and constraint requirements.
- exceptionError handling is the detection and management of failures arising during program execution or external requests.
- routingA router agent is an AI agent that examines a request and transfers control to an appropriate specialist agent.
- benchmarkA benchmark is a standardized evaluation used to compare system performance on a specified set of tasks.
- evaluatorLLM-as-a-judge is an evaluation method in which a language model scores or classifies another system's outputs according to an evaluation rubric.
- tool resultA tool result is the output produced by an external tool after processing an invocation and its arguments, including whether execution succeeded or failed.
- after_tool_callbackAn after-tool callback is a hook invoked after a tool executes that can replace the tool's original result.
- before_tool_callbackA before-tool callback is a hook invoked before a tool executes that can bypass execution by supplying a result.
- tool confirmationTool confirmation is a control mechanism that requires user approval before selected tools execute and supports continuing execution after approval decisions are received.
- refusal behaviorA model refusal is a model response that declines to answer or perform a requested task instead of attempting it.
- control flowControl flow is the sequence and selection of computational operations that determines what a program does next.
- parallel flowA parallel workflow runs multiple constituent agents or steps concurrently and combines their results.
- structure-based searchStructure-based exploration is the technique of navigating information by following its existing organizational structure.
- error analysisError analysis is a record field explaining why a problem-solving attempt failed.
- objective functionA metric is a quantitative indicator that aggregates evaluation judgments into a value trackable across cases or over time.
- sequential processingA sequential workflow executes agents in a fixed order, passing each agent's output context to the next agent.
- run()run() is an Agent method that manages the overall agent execution loop and returns its execution result.
- execute_pythonexecute_python is a tool that runs Python code in an execution environment and returns its results.
- session IDA session identifier is a value used to associate multiple agent invocations with the same persistent interaction session.
- cosine similarityCosine similarity is a measure of the angular similarity between two vectors, commonly computed as their dot product divided by the product of their magnitudes.
- exponential backoffA backoff strategy progressively delays repeated operations after transient failures or service throttling.
- dynamic tool discoveryTool discovery is the standardized process by which a client requests and receives the definitions of tools available from a server.
- mcp clientAn MCP client is the protocol component that connects a host application to one MCP server, retrieves tool definitions, and forwards tool-execution requests.
- file reading and writingFile reading is a tool capability that retrieves content from files available to an agent.
- FunctionToolFunctionTool is the book's tool wrapper that adapts a callable function and its tool definition to the BaseTool interface.
- autonomyAutonomy is the capacity of a system to determine and continue its own actions without a predetermined sequence controlling every step.
- training datasetTraining data is the collection of examples used to fit a machine-learning model's parameters and learned patterns.
- pre-execution blockingPre-execution blocking is a safety technique that prevents an action from running until the required approval has been granted.
- tool confirmation decisionA tool confirmation decision is a user's approval or rejection, optionally with modified arguments, for a pending tool call.
- whitelist approvalWhitelist approval is an approval policy in which only explicitly approved pending operations are executed and all others are rejected.
- agent treeAn agent tree is a hierarchical structure that organizes agents through parent, child, and sibling relationships and defines permitted transfers.
- generationA task response is a standardized A2A message returned by an agent server with the result of processing a task request.
- lexical searchKeyword search is an information-retrieval technique that ranks documents according to the occurrence and importance of query words.
- Agent classThe Agent class is the book's abstract programming interface for representing an agent loop.
- evaluation pipelineAn evaluation pipeline is an automated sequence that submits evaluation cases to models, validates responses, and records results and metadata.
- exact-match accuracyExact-match evaluation scores a prediction as correct only when it matches the reference answer under specified normalization rules.
- continuous improvementA reasoning process that repeatedly evaluates intermediate results and determines subsequent steps.
- relevanceRelevance is the degree to which an answer focuses on the central aspects of a user's question without unrelated content.
- citation reliabilityCitation reliability is the degree to which an answer's key claims are supported by the provided evidence and its citations match those claims.
- requirement complianceRequirement compliance is the degree to which an answer follows the requested format, criteria, scope, length, and language.
- tool selectionTool selection is the process by which a language model determines whether a tool is needed and chooses the appropriate available tool.
- agent cardAn agent card is an A2A JSON document that describes an agent, identifies its endpoint, and advertises its capabilities to potential clients.
- context optimizationContext optimization is the deliberate transformation of model-facing context to improve efficiency or suitability for a particular language-model call.
- datasetA dataset is a structured collection of representative examples used for analysis or evaluation.
- transfer targetA transfer target is an agent to which the current agent is permitted to transfer control.
- code-based evaluationCode-based evaluation is automated grading of an agent's response through predefined rules or executable programs.
- feedbackEnd-user feedback is information about system quality or satisfaction provided by people who interact with the deployed system.
- BaseToolBaseTool is the framework's abstract base class that defines the required interface and behavior for executable tools.
- dialogueConversation history is the accumulated sequence of prior messages retained for continuing an interaction with a language model.
- compositional tool useTool composition is the combination of multiple callable capabilities into a larger functionality or processing pipeline.
- asynchronous programmingAsynchronous operation is execution in which a task proceeds independently of the initiating interaction and reports its result later.
- telemetryOperational data and signals generated by a running system and transmitted for monitoring and analysis.
- JSON SchemaJSON Schema is a standard for describing and validating the structure, types, allowed values, and required fields of JSON data.
- hybrid searchHybrid search combines multiple retrieval methods and integrates their scores to rank results.
- eventAn event is a structured record that wraps an execution content item with metadata about its producer and occurrence time.
- behavioral boundaryA behavioral boundary is an explicit restriction defining which actions or responses an autonomous AI agent may or may not perform.
- context windowA context window is the maximum amount of tokenized input and generated context that a language model can process together.
- negative guideA negative guide is an instruction that specifies situations in which a model should not perform a particular action.
- trigger patternA trigger pattern is a linguistic signal that indicates when a particular action or tool invocation is appropriate.
- intentionUser intent is the goal or desired outcome underlying a user's request to an AI system.
- ContentItemA ContentItem is a typed structured unit representing one piece of conversational, language-model, or tool-interaction content.
- LlmResponseLlmResponse is a structured representation of a language-model response, including generated content, tool calls, errors, and usage information.
- summarizationSummarization is a context-reduction technique that replaces information with a shorter representation of its meaning, typically generated by a language model.
- failure taxonomyA failure taxonomy is a structured set of broader categories used to organize related observations about system failures.
- accuracyAccuracy is the proportion of evaluated answers or predictions that match the correct reference outcomes.
- model calibrationCalibration is the agreement between a model's confidence or solvability judgments and the correctness of those judgments.
- self-awarenessModel self-awareness is a model's ability to recognize whether it can solve a problem or lacks the information or capability required.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.
