Firstpass v0.2.1
DocsGuaranteeBenchmarksCLIGitHub

Docs / How Agents Talk to Models

How Agents Talk to Models

An agent doesn't “use an AI.” It makes a stream of ordinary HTTP calls, each one stateless and metered by the token. This short course builds the whole picture from first principles — following one real task, a coding agent fixing an endpoint — from its very first request out to a full tool-using, cached, multi-turn session, then streaming, structured output, images, MCP, and errors. No prior Firstpass knowledge needed; the last module shows where it changes the bill.

Thirteen short, visual-first modules. Each is one idea — a diagram or a real payload, then a few lines — with a progress bar and next/back. Follow them in order for the full arc, or jump to the one you need.
The task we'll follow One job a developer hands a coding agent: “Make POST /orders reject a request with no total field, and add a test.” You'll watch the actual HTTP requests it produces — one call becomes a conversation, then a tool loop, then a whole session — and see the bill build on a single thread.
13
short, visual modules
1
real task, followed the whole way
~20m
start to finish
what output costs vs input

Start · Module 1 →

The story, in one picture

The core path is one arc: a single call is nearly free, but conversation compounds it, tools multiply it, and caching bends it back down — and a full session is the sum of all of it. Each module below adds (or removes) one layer of this bill.

The cost story of the core path as a single rising-then-dipping curve. A single request is nearly free. Adding multi-turn conversation raises the cost because the transcript is resent every turn. Adding tool calls raises it sharply because one task becomes many billed round-trips. Prompt caching then bends the curve back down by re-pricing the repeated prefix. A full Claude Code session is the sum of all these layers. Each core-path module adds or removes one layer of this bill. How the bill builds across the core path — and what bends it back down cost of one task nearly free compounds × many calls −90% input the sum one call + multi-turn + tools + caching a session
The whole core path in one line: cost climbs with conversation and tools, caching bends it down, and a full session is the sum. The modules below walk each layer — request, meter, multi-turn, tools, caching, shapes, session.

Part A · The core path

The main road — the path our one task actually walks, from a single request to a full session.

Part A2 · Beyond the core path

The turns a real agent takes off the happy path — each a dedicated module, take them in any order.

Part B · Where Firstpass fits