Build your own production AI agent (from one API call up)
A model API is a function from text to text — it remembers nothing, does nothing and fails without saying so. Everything an agent actually does lives in the program around it: the loop, the tools, the window, the budgets, the gates, the sandbox, the run log. Build that program, one mechanism at a time, until it can resolve a support ticket and issue a refund exactly once.
- Scenes
- 2 interactive scenes
- Time
- about 14 minutes
- Topic
- Consensus, Coordination & Durable Execution
What you are building, and why
Scaffold. Authored in stage 6.
What you will be able to explain afterwards
- the model writes text; the harness is what acts
One call
Text in, text out. No memory. Check why it stopped.
Tools & loop
The model asks, your code acts, and then it loops.
Where you'll use this
Product designs whose trade-offs turn on what this curriculum teaches.
More in Consensus, Coordination & Durable Execution
Getting N machines to agree, and getting one job to happen exactly once: Raft, coordination services, CRDTs, locks, leader election, schedulers and durable workflows.
- Build Build Raft — consensus you can defendReplicate a deterministic state machine across N servers with safety as a theorem and liveness under partial synchrony. Build the protocol from term to commit to safety proof to reads, and feel why etcd, Cockroach, and TiKV ship slightly different Rafts.
- Build Build a workflow engine (Temporal / Airflow / Cadence style)A function that survives crashes, restarts, and re-deploys — and still finishes. Build a durable execution engine where workflow code is replayed deterministically from an event history, activities retry with exponential backoff, sagas compensate on failure, and the same workflow definition runs identically a year later. Internalize why 'just retry the cron job' breaks at the second step.
- Distributed LockRedlock controversy, fencing tokens, lease vs lock.
Prefer to design it yourself?
The same subject as a staged workspace: draw the architecture, and a simulator traces requests through the boxes you drew.
Open the Build a production AI agent (from one API call up) workspace