
Learn that an agent is a model, tools, and a loop, with the model deciding tool calls and the loop enabling multi-step actions; the course builds self-healing agents in Python.
Set up python environment with uv, create a self healing agent project, install Entropic and pytest, and prepare an Entropic API key for the first API call in .env file.
Define a tool by building a function, a schema, and a registry, then register it and drive a model to count words in text.
Explore the stop reason concept in self-healing AI agents, distinguishing end turn and tool use, and how max token limits affect tool calls.
Explore how a model returns a list of typed blocks and how tools are invoked to fetch price and market cap data, with final results in the second call.
Build and test your first ai agent loop using a stock price tool with Apple, Microsoft, and Google, then explore typos, unknown tickers, and ambiguous questions to enable self-healing.
Explore six AI agent failure modes—wrong output, stuck loop, tool error, hallucination, timeout, cost blowout—and understand loud vs silent failures, plus detection via sanity checks, schema validation, and LLM critique.
Develop the execution monitor to produce a trace of every step—tool calls, model results, and outputs—capturing timing, results, errors, and a confidence score for detection and learning.
Detect silent failures by building a detector that reads the trace and output to emit failure objects, using sanity rules, structural checks, and an LLM self-critique in order for efficiency.
Build a silent detector class in Python that applies three safety checks—sanity rules, repetition detection, and an LLM critique—to flag failures and hallucinations.
Diagnose failures by classifying them into five root causes—bad input, bad tool, bad prompt, bad model, and bad logic—and route targeted recoveries accordingly.
Define a diagnostician with Cause, Diagnostics, and Diagnostician classes to analyze traces and failure codes, using an LLM to output JSON with cause, evidence, fix, and confidence.
Build and test a Python diagnostician to classify failures, capture traces, evidence, and suggested fixes, and validate prompts and retry logic across three scenarios.
Learn how to use prompt self-modification with delta edits to fix failing system prompts, balancing depth with the one-sentence constraint.
Discover how strategy switching lets ai agents generate diverse alternatives, score them, and pick the best approach, including chunked summarization and novel recovery strategies.
Introduce the recovery confidence score to determine whether a recovered output actually solves the task, using semantic comparison with the original failure and a strict 0–1 llm evaluation.
This lecture introduces a 20-test adversarial suite to probe a self-healing agent's honest failure handling before production. It covers typo variants, tool failures, and prompt conflicts.
Learn to use pytest to build and run unit tests for AI agents, exploring test files like test_calculator, fixtures and parameterized tests, and validating self-healing behavior.
Showcases pytest parametrized typo tests and adversary testing against an AI self-healing agent, capturing failures, evidence, confidence, and recovery actions to correct misinterpreted tickers like AAPL, APPL, MSTF, XYZ.
Explore unit tests for silent failures—invented citations, historical fabrication, and partial result disclosures—to build robust, self-healing AI agents with Python.
Explore recovery correctness testing for self-healing AI agents, including recovery logs, polite and genuine failures, and recovery score thresholds. Learn how unit tests across categories validate robust recovery behavior.
Expose a self-healing agent via a Python FastAPI server with uvicorn. Create endpoints like run and health, using logging for production observability.
Explore building self-healing AI agents in Python that know when they fail in production. Share your work with the community to learn, contribute, and ship honest systems that reveal failures.
Most agent tutorials teach you to build agents that work on the happy path.
Ticker is valid. API returns 200. Model doesn't hallucinate. Tool schema hasn't changed. Input is well-formed. Everyone's polite.
Then you ship it.
And at 3am on a Tuesday, your agent is stuck in a loop calling the same broken tool 47 times, burning through your API budget, returning confidently wrong answers to your users, and you're the one who has to fix it.
This course is about the other 90% of the job.
I'm going to teach you how to build an agent that detects its own failures, diagnoses why it failed, rewrites its own broken tool calls, modifies its own system prompt, switches strategies when one approach stops working, remembers its mistakes so it doesn't repeat them, and knows exactly when to escalate to a human instead of pretending it has the answer.
Not error handling. Genuine self-correction.
Over 14 modules, you'll build every component from scratch in Python —
The execution monitor,
The silent failure detector,
The diagnostician,
The tool repair layer,
The prompt self-modifier,
The strategy switcher,
Session and long-term memory,
Recovery scoring,
Graceful degradation, and
human escalation.
Then at the end, you'll run it against an adversarial test suite — 20 deliberate attacks designed to break your agent in every way agents break in production. Typos. Flaky tools. Prompt injections. Contradictory instructions. Hallucination bait. Poisoned memory.
If your agent recovers from all 20, you ship it.
By the end of this course, you will have built something most production teams haven't figured out yet — an agent that gets harder to break every single time it fails.
Your agent will fail. Teach it to fix itself.
Agents that survive production.
Self-Healing AI Agents in Python.
Build an agent that gets harder to break every time it fails.
Let's build it.