Knaph
IntermediateAiAi AgentsLLM+3

AI Agents Level 2: Build Your Own Agent

Build a small coding agent in Python, one piece at a time - the API call, the conversation, tools, the loop, permissions and hooks, context and caching, instructions, skills and subagents - and understand every agent better because you wrote one.

modules
8
modules
lessons
20
lessons
quizzes
8
quizzes
exercises
9
exercises
Start course →

About this course

An agent looks like magic until you build one. Then it turns out to be a language model and about two hundred lines of ordinary Python around it.

In this course you write that Python yourself. You start with a single call to the Claude API and learn to read what comes back: the content blocks, the stop reason and the usage that says what the reply cost. You keep a conversation, give the model a system prompt, describe tools for it and run the calls it asks for. Then you write the loop that turns all of that into an agent, and the program around it: tools that read and change files in one folder, permission checks, hooks, a guard against instructions hidden in data, counting and compacting the context, prompt caching, loading an AGENTS.md and skills, and a subagent that takes on side tasks. Along the way the program grows into mini, a small coding agent you can run on your own projects.

The last module is about what comes after: testing an agent when its answers vary, and when to use a framework instead of your own code. Every lesson shows real, current code, and Python exercises (which run in the browser, with no API key) let you write the important parts yourself. You need basic Python and an understanding of how agents work: tokens, the context window, tools and the loop.