Opening page of chapter 2, The agent loop, with its Verification status: draft box
A book page with the safe calculator code listing
Exercise 1 from the book: Predict, Run, Observe, Explain, Record
Interview bank page with questions 27 and 28 and model answers

Build AI agents from the loop up

A course and a 427-page book for developers. You write the agent loop yourself, then add tools, memory, retrieval, evals, security and a shipped capstone. Examples use the Claude API in Python.

Get it in the bundle, $49 Read chapters 00–02 free

A page from chapter 8, Reliability and security, with its status box and the list of what you will be able to do
A page from chapter 8, Reliability and security.

Between a tutorial and a bootcamp

Free courses show you one framework for an afternoon. Bootcamps cost $800 to $2,000 and run on someone else's schedule. This course sits in between. It is long and text-first, so you can study it properly. It doesn't depend on any framework, so what you learn transfers. And you run all of it on your own machine, with your own API key.

12chapters

200,000words, about

77exercises and a capstone

119interview questions with model answers

137glossary terms

4 to 6months at 10 to 15 hours a week

The course map page: Start here, with the three parts that work together
Start here: the course map, from the book.

Twelve chapters, in study order

Choose a chapter to see what you will be able to do, the skill employers ask for and its exercises.

  1. 0 Build in public

    Capture work as you go and turn it into credible posts.

    Employer skill
    Communication, portfolio
    Exercises
    Templates
  2. 1 Foundations

    Call an LLM API, read every part of the response, estimate cost, get validated structured output.

    Employer skill
    LLM fundamentals, API use, prompting
    Exercises
    6
  3. 2 The agent loop

    Write the tool-using loop from scratch, design tools, bound the loop, read traces.

    Employer skill
    Tool use, agent design
    Exercises
    6
  4. 3 Software foundations

    Write typed, tested, async, logged, containerised Python.

    Employer skill
    Production Python, testing, deployment
    Exercises
    10
  5. 4 Context and memory

    Manage what the model sees: trimming, caching, compaction, retrieval, memory.

    Employer skill
    Context management, cost control
    Exercises
    7
  6. 5 Retrieval in depth

    Build and measure a full RAG system with chunking, hybrid search, reranking and citations.

    Employer skill
    RAG, embeddings, vector search
    Exercises
    13
  7. 6 Protocols and extensibility

    Build an MCP server, use skills and hooks, reason about the whole harness.

    Employer skill
    MCP, tool integration
    Exercises
    7
  8. 7 Multi-step patterns

    Choose and build workflows, orchestrators and sub-agents, and prove they beat a single agent.

    Employer skill
    Multi-agent orchestration
    Exercises
    7
  9. 8 Reliability and security

    Build evals, trace failures, red-team your agent, add defences.

    Employer skill
    Evals, observability, guardrails, safety
    Exercises
    8
  10. 9 Frameworks and tooling

    Read and use LangGraph and others, instrument with tracing tools, decide when a framework helps.

    Employer skill
    Framework literacy, observability tools
    Exercises
    4
  11. 10 Production

    Ship, monitor and maintain an agent others can rely on; write a postmortem.

    Employer skill
    Deployment, ops, the capstone
    Exercises
    Capstone in milestones
  12. 11 Career guide

    Position yourself, build a hiring-grade portfolio, pass the interview loop.

    Employer skill
    Getting hired
    Exercises
    9

Every exercise runs the same five moves

  1. Predict what will happen.
  2. Build it.
  3. Observe what actually happened.
  4. Explain the difference.
  5. Record it in your journal.

Principles

  • Build the loop yourself before using a framework.
  • Every run leaves a trace.
  • Bound everything: steps, tokens, money, permissions.
  • Treat tool output as untrusted data.
  • Measure; do not guess.
  • Write down failures.

Your journal entries then become the build-in-public posts that chapter 00 teaches you to write, which makes them a portfolio an employer can check.

Book page: Reading a trace, with an example trace file from a run of agent.py

The real loop, in about 25 lines

This is the function you write in chapter 2. Every run of it leaves a trace you learn to read.

def run(task: str) -> str:
    msgs = [{"role": "user", "content": task}]
    log("task", task=task)
    for step in range(MAX_STEPS):
        r = client.messages.create(model=MODEL, max_tokens=1024, tools=TOOLS, messages=msgs)
        log("model", step=step, stop_reason=r.stop_reason,
            usage={"in": r.usage.input_tokens, "out": r.usage.output_tokens},
            content=[b.model_dump() for b in r.content])
        msgs.append({"role": "assistant", "content": r.content})
        if r.stop_reason != "tool_use":
            return "".join(b.text for b in r.content if b.type == "text")
        results = []
        for b in r.content:
            if b.type != "tool_use":
                continue
            try:
                out, err = HANDLERS[b.name](b.input), False
            except Exception as e:  # tool errors go back to the model, it can recover
                out, err = f"error: {e}", True
            log("tool", step=step, name=b.name, input=b.input, output=out, is_error=err)
            results.append({"type": "tool_result", "tool_use_id": b.id,
                            "content": out, "is_error": err})
        msgs.append({"role": "user", "content": results})
    return "stopped: hit MAX_STEPS"

agent.py, function run, as it stands in the course repo. On the left, the page that teaches you to read its trace.

Files you keep, not a login

  • The book as a 427-page PDF, an EPUB and a single HTML file.
  • The source as Markdown: chapters and exercises, readable in any editor.
  • A Python project managed with uv, with offline tests you can run without an API key.
  • The interview bank, the glossary, and the concept guides on context engineering and harness engineering.
  • Every future update, free. Changes are listed in a public changelog.
The safe calculator code listing, from the book
The interview bank, with model answers
Exercise 1: run the loop and read the trace
Chapter 2 opening, with the Verification status: draft box
The status box that opens chapter 2.

What is checked, and what is not

The course was drafted with AI assistance. Every fact in it was checked against official documentation in October and November 2026, and the fastest-ageing facts (model ids, SDK versions, prices) are re-checked every quarter. The repo's offline tests pass without an API key.

What has not been done: the exercises have not been run end to end against the live API. Each chapter opens with a box that says exactly that. You run them with your own key. If a listing or an exercise does not behave as the book says, email support, and the fix ships to every buyer as a free update.

Who is behind it

Drafted with AI assistance (Claude) and checked against official documentation. Independent: not affiliated with, endorsed by or sponsored by Anthropic.

Manuel Lorenzo

I'm a software engineer in Amsterdam. I build backend systems in Java and Spring Boot, and under the NullTwenty name I ship my own apps for Android and iOS, among them Keysi, Quickspan and AnywhereRoles. Follow my work at manulorenzo.me.

In the bundle, $49

Includes

  • The full course
  • PDF, EPUB, HTML, Markdown
  • The Python repo and tests
  • Free updates

This book is not sold on its own. It comes with the Complete edition of AI Engineer, a 27-chapter course built around one running project, with 196 graded exercises that run without an API key. One purchase, $49, gets both, in every format, with the code and updates.

Not included

API usage. You pay Anthropic directly for your own calls. Most exercises cost cents, and a few cost a few dollars. Set a spend limit first.

Get it in the bundle, $49

The bundle launches soon. Email [email protected] to hear when it does, and read chapters 00–02 free in the meantime.

Checkout runs on the AI Engineer site through Paddle, which acts as the merchant of record and handles VAT and invoices.

Questions before you buy

What do I need to know already?
Basic Python: variables, functions, loops, running a script. Chapter 03 fills the software-engineering gaps (classes, tests, async, packaging) if you need it.
What does it cost to run the exercises?
You need your own Anthropic API key. Most exercises cost cents, and a few cost a few dollars. The course has you set a monthly spend limit before your first call.
Is it tied to Claude?
The examples use the Claude API, but the course teaches the loop, context, retrieval, evals and security in a way that transfers to any model. Chapter 09 covers LangGraph and other frameworks.
Will it get me a job?
It gives you the skills that agent-engineering postings list, and a portfolio that proves them. It cannot give you production experience or guarantee an offer, and chapter 11 says so plainly.
Was it written by AI?
It was drafted with AI assistance, and every fact was checked against official documentation. The exercises have not been run end to end against the live API; the box at the top of each chapter says so. Fixes that readers report ship to everyone as free updates.
How long does it take?
Four to six months at 10 to 15 hours a week. Experienced developers go faster.
What about refunds?
Full refund within 14 days of purchase, no reasons needed, under the bundle's refund policy. Email [email protected] or reply to your Paddle receipt.
Can I share it with my team?
The text is licensed to one learner. The code is MIT. For team licences, contact [email protected].
How will the course keep up with a field that changes monthly?
Each chapter lists its fastest-ageing facts (model ids, SDK versions, prices). Those are re-checked every quarter, and updates are free.

Start with the first three chapters, free

Read Build in public, Foundations and The agent loop. By the end you will have written a working agent. Then decide.

Free sample as PDF, 60 pages Free sample as EPUB

Read chapters 00–02 free Get it in the bundle, $49