Build an AI Agent (From Scratch)
by Manning Publications (Jungjun Hur and Younghee Song)
Write your own ReAct agent in Python, then add RAG, memory, planning, sandboxed code execution, multi-agent handoffs and LLM-as-a-judge evals, all without a framework.
Overview
Build an AI Agent (From Scratch), by Jungjun Hur and Younghee Song, was published by Manning in July 2026 (336 pages). It builds one Python research agent across ten chapters and deliberately avoids agent frameworks, so every layer is code you wrote. Part 1 covers the foundations: what separates a fixed workflow from an LLM-directed agent loop, choosing models and calling stateless LLM APIs, prompt engineering, tool definitions and MCP, and then a full ReAct agent with an ExecutionContext store, a tool abstraction, an LLM communication layer and structured output, all scored on GAIA tasks. Part 2 adds the advanced capabilities: vector and structure-based RAG with callbacks, agent memory (in-run context management, sessions and state, long-term memory across sessions), planning and reflection, code execution in cloud sandboxes with a filesystem workspace and agent skills, multi-agent orchestration (workflows, agent-as-tool, agent transfer, and A2A across networks), and an evaluation chapter on observability, dataset building, LLM-as-a-judge grading and CI/CD. The MIT-licensed companion repo (shangrilar/ai-agent-from-scratch) packages the finished agent as an installable scratch_agents library, uses uv and Python 3.13, and includes a pytest suite that runs without API keys. Hur is an independent AI and data engineer who builds agentic systems for e-commerce and wrote Practical AI Application Development Using LLMs; Song is an AI consultant at PwC.
At a Glance
- Topic
- Agentic
- Level
- Intermediate
- Format
- Book
- Cost
- Paid
- Duration
- 336 pages, 10 chapters plus runnable notebooks; roughly 25-35 hours self-paced (estimate)
- Provider
- Manning Publications (Jungjun Hur and Younghee Song)
- Hands-on
- Yes — code/exercises
- Certificate
- None
What You’ll Learn
- ✓Tell a fixed developer-defined workflow apart from an LLM-directed agent loop, and know when each fits
- ✓Define tools for LLM function calling and standardize them through the Model Context Protocol
- ✓Implement a ReAct agent with an execution context, tool abstraction and an LLM communication layer
- ✓Measure your agent's real limits by running it against tasks from the GAIA benchmark
- ✓Add vector search and structure-based retrieval to an agent, and extend it with callbacks
- ✓Manage in-run context, session state and long-term memory that persists across agent sessions
- ✓Use explicit planning and reflection steps to reduce looping and hallucination on multi-step tasks
- ✓Give an agent sandboxed code execution, a filesystem workspace, CLI access and reusable agent skills
- ✓Orchestrate multiple agents with workflows, agent-as-tool, agent transfer and the A2A protocol
- ✓Evaluate agents with observability, curated datasets, LLM-as-a-judge grading and CI/CD checks
Highlights
- •No agent framework anywhere: the final scratch_agents package is code you built yourself, so you can see what LangGraph-style libraries hide
- •GAIA benchmark tasks run through the whole book as a fixed test, so you can see each new capability move the score
- •Current agent topics you rarely find in one book: MCP, A2A, agent skills, cloud sandboxes and context rot
- •The companion repo is MIT-licensed, uses uv and Python 3.13, ships per-chapter snapshot files and has a test suite that runs without API keys
- •Ends on evaluation and CI/CD, the part most agent tutorials skip
Who It’s For
Best For
- ✓Python developers who have used an agent framework and want to understand what it does underneath
- ✓AI engineers designing a custom agent harness instead of adopting LangGraph, CrewAI or similar
- ✓Engineers who need to add memory, sandboxed code execution or multi-agent routing to an existing agent
- ✓Teams setting up LLM-as-a-judge evaluation and CI for agent behavior
Prerequisites
- •Working Python, including installing packages and running Jupyter notebooks
- •Some machine learning background and basic familiarity with calling an LLM API
- •API keys for the hands-on chapters: OpenAI and Anthropic, Tavily search, E2B sandboxes, and a Hugging Face account with GAIA access (the calls are billable)
FAQ
What is Build an AI Agent (From Scratch)?
Build an AI Agent (From Scratch) is a July 2026 Manning book for Python developers who want to understand agents below the framework layer. You build one research agent chapter by chapter and test it against the GAIA benchmark. By the end you can design, extend and evaluate a tool-using, multi-agent system you wrote yourself.
Is Build an AI Agent (From Scratch) free?
Build an AI Agent (From Scratch) is a paid resource.
What level is Build an AI Agent (From Scratch) for?
Build an AI Agent (From Scratch) is aimed at a intermediate audience. Recommended background: Working Python, including installing packages and running Jupyter notebooks, Some machine learning background and basic familiarity with calling an LLM API, API keys for the hands-on chapters: OpenAI and Anthropic, Tavily search, E2B sandboxes, and a Hugging Face account with GAIA access (the calls are billable).
How long does Build an AI Agent (From Scratch) take?
Expect roughly 336 pages, 10 chapters plus runnable notebooks; roughly 25-35 hours self-paced (estimate). Most learners work through it at their own pace.
What will I learn from Build an AI Agent (From Scratch)?
You'll learn: Tell a fixed developer-defined workflow apart from an LLM-directed agent loop, and know when each fits; Define tools for LLM function calling and standardize them through the Model Context Protocol; Implement a ReAct agent with an execution context, tool abstraction and an LLM communication layer; Measure your agent's real limits by running it against tasks from the GAIA benchmark; Add vector search and structure-based retrieval to an agent, and extend it with callbacks; Manage in-run context, session state and long-term memory that persists across agent sessions; Use explicit planning and reflection steps to reduce looping and hallucination on multi-step tasks; Give an agent sandboxed code execution, a filesystem workspace, CLI access and reusable agent skills; Orchestrate multiple agents with workflows, agent-as-tool, agent transfer and the A2A protocol; Evaluate agents with observability, curated datasets, LLM-as-a-judge grading and CI/CD checks.
Topics
Sources
This page was written from 3 sources, 1 on domains other than manning.com.