Build a production AI agent (from one API call up)
2 scenes · ~14 min · build the primitive

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
  1. 01
  2. 05

One call

Text in, text out. No memory. Check why it stopped.

  1. 01
    One request, one reply, one confident guess — the model API request and reply, priced in tokens
    A model API is a function from text to text: it knows only what is inside the request you send, it is billed by the token, and when it knows nothing it still answers fluently.
    ~7 min

Tools & loop

The model asks, your code acts, and then it loops.

  1. 05
    The model asks. Your code is the one that acts — the tool call, the gap, and who executes it
    A tool call is a message the model emits before it stops; your code decides whether to run it, runs it, and appends the result — so until your code acts, nothing has happened anywhere.
    ~7 min

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