Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

The course

This course takes you from "what is an agent?" to shipping real applications built on one. Every lesson is short, and every lesson has one program behind it. The code on each page is copied from an example in the repository, and CI compiles every one of them, so what you read is what runs.

You do not need to know anything about agents to start. You do need a little Rust: functions, async, Result and ?. If you are coming from Python or TypeScript, the first lessons go slowly enough that the Rust stays out of the way.

How the lessons work

Each lesson has the same shape. We start with the problem, the moment in a real project where you would want this. Then we read the example together, a few lines at a time. Then you run it, and the page tells you what to look for in the output.

The online examples call anthropic/claude-haiku-5-5, priced in the built-in catalog at 0.10 dollars per million input tokens and 0.50 per million output tokens, and every one of them sets a spend cap in code of at most four cents per run. Set your key once:

export ANTHROPIC_API_KEY=sk-ant-...

and run any lesson from a clone of the repository with cargo run -p troupekit --example <name>. Lessons that need the knowledge or llama feature show the full command.

The levels

LevelLessonWhat you build
0Why agents, why Rusta one-line agent, and a reason to want one
BeginnerYour first agentan agent you build once and run many times
BeginnerToolsan agent that looks things up instead of guessing
BeginnerSpend limitsan agent that stops before it overspends
IntermediateMemoryan agent that remembers each user across restarts
IntermediateKnowledgean agent that answers from your documents
IntermediateGraphsa fixed chain of Rust steps and an agent
IntermediateTracinga record of everything a run did
AdvancedRuns that survive a killa pipeline that finishes after its process dies
AdvancedBudgets across runsa per-user cap that holds across restarts
ApplicationsA support agent with knowledgeanswers from your articles, remembers customers, capped per customer
ApplicationsA research pipeline that survives a killtwo agents in a graph that finishes after its process dies
ApplicationsA spend-capped team of agentsthree agents under one team budget
ApplicationsAn offline assistanta private agent on a model on the device; Apple Foundation Models from Swift and LiteRT-LM models from Kotlin since 0.4

The applications level puts the pieces together. Every application is a complete program you can run and change.