Leanpub Header

Skip to main content

AI Engineering Visualized: Agents, The Course

The instructor has published 99% of this course.Last updated on 2026-11-03

Build the harness that makes an AI support agent safe, module by module: nearly 2 hours of video, 100+ doodles, 17 exercises, 17 quizzes and a certificate.

Minimum price

$34.99

$49.99

You pay

Author earns

$

Also available for 1 course credit with a Learner Membership

PDF
EPUB
WEB
About

About

About the Course

One harness, built module by module.

I wrote this course for developers who have shipped a language-model feature and now have to let it act: issue a refund, cancel an order, change an address, wait for a courier, hand a case to a person. A stronger model won't stop it refunding someone else's order. The code around the model will, and that's what we draw and build here, one part at a time.

What you'll build

You start with an assistant that can be talked into refunding someone else's order. By the end, your agent:

  • runs in a harness where the model proposes and code authorizes, with the customer's identity carried from the session, never from the model
  • calls tools with typed specs, and caps and previews on anything that moves money
  • checks its plans in code and repairs only the branch that broke
  • passes verifiers it can't talk its way past before anything is committed
  • moves through a state machine with checkpoints, idempotency keys, a ledger and named stop reasons
  • waits for couriers, asks people for approval and hands cases off cleanly
  • keeps memory you can correct, a context budget and retrieval it chooses itself
  • connects to MCP servers it can trust, and survives loops, retry storms and failing dependencies
  • is graded on outcomes and trajectories in a sandbox, across repeat runs, before a release gate lets it ship

What's inside

  • 17 modules, plus a short Start Here module that sets up the code
  • 17 video lessons, 6 to 7 minutes each, so nearly 2 hours of video in all
  • 100+ hand-drawn doodles, each one a named mental model like the Agent Harness or the Clean Handoff
  • 17 one-page doodle cheat sheets
  • 17 coding exercises, each with a prediction question, the expected output and a worked solution
  • 17 quizzes. Conceptual questions only. Retake as often as you like; your best result counts.
  • A certificate of completion: pass with 70% or more, or 90% or more for a distinction

How each module works

Watch the video. Read the lesson. Keep the cheat sheet. Do the exercise: predict what the code will print, run it, compare. Take the quiz. That's it, at your own pace, with no start date and no deadline.

The code

Everything runs on Python 3.10 or newer, with one requirements file to install. A built-in stub model means you don't need an API key or a paid account, and every exercise has an expected output you can check against. If you'd like to try a real model, you can point the same code at Ollama on your own machine.

Who it's for

Developers who can read Python and have taken Volume 1, or covered the same ground: message lists, tools, evals and a basic agent loop. You don't need a machine learning background.

Who it's not for

If you want a tour of agent frameworks or want to train models, this isn't that course. It builds a plain loop so that every check is code you can read.

Modules

0 Start Here · 1 The Agent Harness · 2 Tool Engineering · 3 Planning · 4 Verification Before Commit · 5 State Machines, Checkpoints and Stop Reasons · 6 Side Effects · 7 Long-Running Tickets · 8 Human Oversight · 9 Agent Memory · 10 Context Engineering · 11 Agentic RAG · 12 MCP · 13 Tool Trust · 14 Multi-Agent Systems · 15 Agent Failure Engineering · 16 Agent Evaluation · 17 Agent Reliability

The course and the book

The course follows the book AI Engineering Visualized, Volume 2: Agents (Vol 2), chapter for chapter. If you already have the book, the course adds the videos in each module, the one-page doodle cheat sheets, the prediction questions, the quizzes and the certificate, with your progress tracked as you go.

Share this course

Instructor

About the Instructor

Prateek Singh

Prateek Singh is an Infrastructure Developer, an avid PowerShell blogger, and a community contributor. In 2017 and 2018, FeedSpot and SQLHack recognized his blog RidiCurious.com as among the “Top 50 PowerShell blogs in the world.” Find his open-sourced at GitHub, and reach out to him on Twitter at @singhprateik.

Prateek has written more than 250 articles on his blog and several other websites such as 4SysOps.com, IPSwitch.com, and TechTarget.com and also runs a YouTube channel. He is a published author of 3 books and contributing author of 2 Book and currently writing the 6th one, following is the complete list:

Material

Course Material

  • Module 0: Start Here

  • Welcome to the Course

  • How each module works

  • Setting Up the Code

  • How to Read the Doodles

  • The visual language

  • The text walkthrough

  • Reuse them

  • A worked example

  • Finishing the Course

  • Module 1: The Agent Harness: Everything Around the Model

  • Watch: The Agent Harness: Everything Around the Model

  • Read: The Agent Harness: Everything Around the Model

  • The Agent Harness

  • The Agent Contract

  • The Identity Chain

  • Sidebar: Framework vs Plain Loop

  • Further Reading

  • Next

  • Doodle Cheat Sheet: The Agent Harness: Everything Around the Model

  • Cheat Sheet at a Glance

  • Exercise: Move a ticket down a rung

  • Check Your Work

  • Quiz: The Agent Harness

    99 attempts allowed

  • Module 2: Tool Engineering: Schemas, Validation and Safe Actions

  • Watch: Tool Engineering: Schemas, Validation and Safe Actions

  • Read: Tool Engineering: Schemas, Validation and Safe Actions

  • A Tool Is an API for a Model

  • Blast Radius

  • Further Reading

  • Next

  • Doodle Cheat Sheet: Tool Engineering: Schemas, Validation and Safe Actions

  • Cheat Sheet at a Glance

  • Exercise: Add a safe cancel

  • Check Your Work

  • Quiz: Tool Engineering

    99 attempts allowed

  • Module 3: Planning: Dependencies, Validation and Replanning

  • Watch: Planning: Dependencies, Validation and Replanning

  • Read: Planning: Dependencies, Validation and Replanning

  • The Task Tree

  • Plan Repair

  • Further Reading

  • Next

  • Doodle Cheat Sheet: Planning: Dependencies, Validation and Replanning

  • Cheat Sheet at a Glance

  • Exercise: Lose the pickup

  • Check Your Work

  • Quiz: Planning

    99 attempts allowed

  • Module 4: Verification Before Commit: Checks, Bounded Revision and Postconditions

  • Watch: Verification Before Commit: Checks, Bounded Revision and Postconditions

  • Read: Verification Before Commit: Checks, Bounded Revision and Postconditions

  • Verify Outside the Model

  • The Reflection Loop

  • Sidebar: Visible vs Hidden Reasoning

  • Further Reading

  • Next

  • Doodle Cheat Sheet: Verification Before Commit: Checks, Bounded Revision and Postconditions

  • Cheat Sheet at a Glance

  • Exercise: Take the rule away

  • Check Your Work

  • Quiz: Verification Before Commit

    99 attempts allowed

  • Module 5: State Machines, Checkpoints and Stop Reasons

  • Watch: State Machines, Checkpoints and Stop Reasons

  • Read: State Machines, Checkpoints and Stop Reasons

  • The Agent as a State Machine

  • Checkpoint and Resume

  • Every Stop Has a Reason

  • Further Reading

  • Next

  • Doodle Cheat Sheet: State Machines, Checkpoints and Stop Reasons

  • Cheat Sheet at a Glance

  • Exercise: Add a pending state

  • Check Your Work

  • Quiz: State Machines, Checkpoints and Stop Reasons

    99 attempts allowed

  • Module 6: Side Effects: Idempotency, Transactions and Compensation

  • Watch: Side Effects: Idempotency, Transactions and Compensation

  • Read: Side Effects: Idempotency, Transactions and Compensation

  • One Operation, One Receipt

  • Compensation Is a New Action

  • Sidebar: Idempotency Keys Across Restarts and Tools

  • Further Reading

  • Next

  • Doodle Cheat Sheet: Side Effects: Idempotency, Transactions and Compensation

  • Cheat Sheet at a Glance

  • Exercise: Lose the response

  • Check Your Work

  • Quiz: Side Effects

    99 attempts allowed

  • Module 7: Long-Running Tickets: Waits, Progress and Cancellation

  • Watch: Long-Running Tickets: Waits, Progress and Cancellation

  • Read: Long-Running Tickets: Waits, Progress and Cancellation

  • The Waiting Ticket

  • Status Is an Event

  • Sidebar: Timeouts on Waiting Steps

  • Further Reading

  • Next

  • Doodle Cheat Sheet: Long-Running Tickets: Waits, Progress and Cancellation

  • Cheat Sheet at a Glance

  • Exercise: Race the courier

  • Check Your Work

  • Quiz: Long-Running Tickets

    99 attempts allowed

  • Module 8: Human Oversight: Approvals, Interrupts and Escalations

  • Watch: Human Oversight: Approvals, Interrupts and Escalations

  • Read: Human Oversight: Approvals, Interrupts and Escalations

  • Approval Policies

  • The Clean Handoff

  • Sidebar: Confidence Thresholds for Escalation

  • Further Reading

  • Next

  • Doodle Cheat Sheet: Human Oversight: Approvals, Interrupts and Escalations

  • Cheat Sheet at a Glance

  • Exercise: Hold the second refund

  • Check Your Work

  • Quiz: Human Oversight

    99 attempts allowed

  • Module 9: Agent Memory: Lifetime, Scope and Correction

  • Watch: Agent Memory: Lifetime, Scope and Correction

  • Read: Agent Memory: Lifetime, Scope and Correction

  • Memory by Lifetime and Scope

  • Correct It Everywhere

  • Sidebar: Memory, Privacy and Consent

  • Further Reading

  • Next

  • Doodle Cheat Sheet: Agent Memory: Lifetime, Scope and Correction

  • Cheat Sheet at a Glance

  • Exercise: Withdraw consent

  • Check Your Work

  • Quiz: Agent Memory

    99 attempts allowed

  • Module 10: Context Engineering for Long-Running Agents

  • Watch: Context Engineering for Long-Running Agents

  • Read: Context Engineering for Long-Running Agents

  • The Growing Context

  • Just-in-Time Context

  • Sidebar: Compaction Variants

  • Further Reading

  • Next

  • Doodle Cheat Sheet: Context Engineering for Long-Running Agents

  • Cheat Sheet at a Glance

  • Exercise: Halve the budget

  • Check Your Work

  • Quiz: Context Engineering for Long-Running Agents

    99 attempts allowed

  • Module 11: Agentic RAG: Retrieval the Agent Chooses

  • Watch: Agentic RAG: Retrieval the Agent Chooses

  • Read: Agentic RAG: Retrieval the Agent Chooses

  • Retrieval Is a Tool

  • Is the Evidence Enough?

  • Further Reading

  • Next

  • Doodle Cheat Sheet: Agentic RAG: Retrieval the Agent Chooses

  • Cheat Sheet at a Glance

  • Exercise: Ask two things at once

  • Check Your Work

  • Quiz: Agentic RAG

    99 attempts allowed

  • Module 12: MCP: Hosts, Clients, Servers and Discovery

  • Watch: MCP: Hosts, Clients, Servers and Discovery

  • Read: MCP: Hosts, Clients, Servers and Discovery

  • Host, Client, Server

  • Tool Discovery and Selection

  • Sidebar: MCP vs Plain Function Calling

  • Further Reading

  • Next

  • Doodle Cheat Sheet: MCP: Hosts, Clients, Servers and Discovery

  • Cheat Sheet at a Glance

  • Exercise: Ignore the decoy

  • Check Your Work

  • Quiz: MCP

    99 attempts allowed

  • Module 13: Tool Trust: Credentials, Allow-Lists and Untrusted Output

  • Watch: Tool Trust: Credentials, Allow-Lists and Untrusted Output

  • Read: Tool Trust: Credentials, Allow-Lists and Untrusted Output

  • Keep Secrets Outside Context

  • The Tool Allow-List

  • Further Reading

  • Next

  • Doodle Cheat Sheet: Tool Trust: Credentials, Allow-Lists and Untrusted Output

  • Cheat Sheet at a Glance

  • Exercise: Upgrade the courier tool

  • Check Your Work

  • Quiz: Tool Trust

    99 attempts allowed

  • Module 14: Multi-Agent Systems: Handoffs, Coordination and Trade-offs

  • Watch: Multi-Agent Systems: Handoffs, Coordination and Trade-offs

  • Read: Multi-Agent Systems: Handoffs, Coordination and Trade-offs

  • Orchestrator and Workers

  • Shared vs Private Context

  • Pipeline vs Handoff

  • Sidebar: When Not to Go Multi-Agent

  • Further Reading

  • Next

  • Doodle Cheat Sheet: Multi-Agent Systems: Handoffs, Coordination and Trade-offs

  • Cheat Sheet at a Glance

  • Exercise: Run it three ways

  • Check Your Work

  • Quiz: Multi-Agent Systems

    99 attempts allowed

  • Module 15: Agent Failure Engineering: Loops, Cascades and Side Effects

  • Watch: Agent Failure Engineering: Loops, Cascades and Side Effects

  • Read: Agent Failure Engineering: Loops, Cascades and Side Effects

  • Loops, Oscillation and Drift

  • The Error Cascade

  • Sidebar: The Circuit Breaker

  • Further Reading

  • Next

  • Doodle Cheat Sheet: Agent Failure Engineering: Loops, Cascades and Side Effects

  • Cheat Sheet at a Glance

  • Exercise: Let the courier recover

  • Check Your Work

  • Quiz: Agent Failure Engineering

    99 attempts allowed

  • Module 16: Agent Evaluation: Outcomes and Trajectories

  • Watch: Agent Evaluation: Outcomes and Trajectories

  • Read: Agent Evaluation: Outcomes and Trajectories

  • Trajectory vs Outcome

  • The Sandbox World

  • Sidebar: Mock APIs and Fixtures

  • Further Reading

  • Next

  • Doodle Cheat Sheet: Agent Evaluation: Outcomes and Trajectories

  • Cheat Sheet at a Glance

  • Exercise: Ask, don’t act

  • Check Your Work

  • Quiz: Agent Evaluation

    99 attempts allowed

  • Module 17: Agent Reliability: Repeat Runs, Scorecards and Gates

  • Watch: Agent Reliability: Repeat Runs, Scorecards and Gates

  • Read: Agent Reliability: Repeat Runs, Scorecards and Gates

  • Reliable Across Runs

  • The Agent Scorecard

  • Further Reading

  • Next

  • Doodle Cheat Sheet: Agent Reliability: Repeat Runs, Scorecards and Gates

  • Cheat Sheet at a Glance

  • Exercise: Refund under fire

  • Check Your Work

  • Quiz: Agent Reliability

    99 attempts allowed

  • Wrap-Up

  • You Built the Whole Harness

  • Get Your Certificate

  • Where to Go Next

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub