A protocol is an agreement about bytes, and one LLM request crosses about eight of them, stacked so that each solves one problem, costs round trips or guarantees, and fails in its own recognisable way.
One running example. A user types "What colour is the sky?" and the app sends one streaming request to an LLM API: a POST /v1/messages with a 117-byte JSON body, answered by five tokens streamed back one by one. To record every byte, the request goes to a local stand-in for an LLM API that answers in the event format of Anthropic's Messages API, trimmed (the On the wire tab built it, 5 October 2026, Apple M1 Pro, Python 3.13.16 with OpenSSL 3.5.9, curl 8.7.1). Fig. 1 stacks its journey as glass plates, top to bottom in the order the request meets them; each plate names the page that owns it. The request (orange dots) goes down, the answer (green) comes back up.
Fig. 1 · One request's journey: every step is a different protocol, and each has its own page
api.anthropic.com into 160.79.104.10. Free when cached (2.4 ms inside curl), one round trip to a resolver when not (212 to 451 ms for an uncached name, measured in the On the wire tab). Caching is DNS's whole failure surface: a "does not exist" answer is cached too, and nothing can push a change. Owner: DNS: resolution, caching and the failure modes.x-api-key; a 401 means the credential did not prove who you are, a 403 that it did and you are not allowed. Users and agents get scoped, short-lived OAuth tokens instead of keys. Owner: Auth: API keys, OAuth 2.1, OIDC, JWTs, mTLS and agent-era auth.tools/call); to hand a whole task to someone else's agent it opens an A2A task. Either way the result comes back as text the model reads (purple dots), so a tool's output is untrusted input. Owners: MCP: building servers and clients, transports, auth and security and Agent-to-agent and beyond: A2A, agent commerce, agents driving devices.Numbers measured on this page's running request (On the wire tab and src/read/code/); the IP address of api.anthropic.com was read through this machine's resolver on 5 October 2026. The round-trip count on the figure assumes an uncached name. The plates are the order the request meets the protocols, not a layer model (section 1 has that). The engineer's own path to a GPU box is a ninth protocol, SSH (section 5).
Every protocol trades round trips (waiting for the other side) against guarantees (order, delivery, privacy, identity). Most "slow" or "stuck" bugs are a round trip or a guarantee you did not know you were paying for.
No layer reads the others' headers, so a problem is visible only to the layer that owns it: a bad certificate is invisible to TCP, and a TCP stall is invisible to your JSON parser, which just sees a read that never returns. Section 11 maps symptoms to layers.
MCP made tools pluggable, and with them every tool's output became text the model reads as if it were instructions (section 10).
New terms (the Glossary at the end of this tab has the rest):
How this tab marks numbers: measured comes from this page's runs; derived numbers show their formula. Every exchange was run for this page on 5 October 2026 or is quoted from its specification.
| Step on the wire | Protocol | The problem it solves | What it costs | How it usually fails | Owner |
|---|---|---|---|---|---|
| Find the server | DNS | Turns the name into an address a packet can be sent to | One round trip to a resolver when the answer is not cached; stale answers until a timer runs out | Missing or negatively cached name; 5 s stalls from a lost query | DNS |
| Open a connection | IP, TCP (or UDP and QUIC) | Delivers bytes to the right program on the right machine, complete and in order, without flooding the network | One round trip before any data; one lost packet stalls everything behind it; speed capped by window over round-trip time | Refused, hangs, or silently dead after an idle timeout | Networking foundations |
| Make it private | TLS 1.3 | Proves the server is who it claims and hides the bytes from everyone in between | One more round trip and about 3.5 KB of handshake on this request (measured) | A certificate the client cannot verify (expired, missing intermediate, wrong name) | TLS and certificates |
| Ask | HTTP/1.1, 2 or 3 | A shared vocabulary for requests and answers: methods, status codes, headers | Header bytes on every request; every proxy on the path has its own timeouts | The smallest timeout on the path; 502, 503, 504 from a hop in front | HTTP |
| Stream the answer | Server-Sent Events | Sends tokens as they are generated, inside one long HTTP response | A connection held open for the whole generation | Buffering proxies; a stream cut with no final event | Streaming and real-time |
| Prove who is calling | API keys, OAuth 2.1, JWTs, mTLS | Lets the API decide whether this caller may do this | Secrets to store, rotate and never leak | 401 (who are you?) against 403 (not allowed); a token for the wrong audience | Auth |
| Call internal services | REST, gRPC | Typed, fast calls between the API's own services, with deadlines | Schemas and code generation; long-lived connections that load balancers handle badly | No deadline set; all traffic on one replica | Service APIs |
| Let the model use tools | MCP, A2A | One standard way for any agent to reach any tool or other agent | Every tool result is untrusted text entering the model's context | Instructions hidden in a tool result; tokens passed through | MCP, Agent-to-agent |
| Reach the GPU box | SSH | An encrypted, authenticated shell and tunnels to a machine you administer | Keys or certificates to manage; one more hop through a jump host | A changed host key; an idle session cut | SSH |
| GPUs talk to each other | RDMA, NCCL | Moves gradients and activations between GPUs without the operating system in the path | A special, near-lossless network fabric | A job that hangs at start-up on the wrong network interface | Networking foundations (section 14) |
The tabs go further without repeating this one: On the wire records the running request byte by byte on HTTP/1.1, HTTP/2 and HTTP/3; Failure lab breaks it on purpose and shows the symptom each failure produces; Protocol atlas compares every protocol on one set of axes with its specification and dates.
Each protocol solves one problem and assumes the others are solved. On the way out every layer wraps the message it was handed in its own header and passes it down; on arrival every layer strips its own header and passes the rest up.
| Layer (internet model) | Job | In our request | Unit and address |
|---|---|---|---|
| Application | What the bytes mean | HTTP carrying JSON and Server-Sent Events | a message; named by a URL |
| Security (between the two) | Privacy, integrity, identity | TLS 1.3 | a TLS record |
| Transport | Right program, complete, in order, not too fast | TCP (or QUIC over UDP for HTTP/3) | a segment (TCP) or datagram (UDP); a port number picks the program |
| Internet | Get across many networks to the right machine | IPv4 or IPv6 | a packet; an IP address picks the machine |
| Link | Move bits over one cable or radio hop | Ethernet, Wi-Fi | a frame; a MAC address picks the next device |
The four-layer internet model is the one the protocols were built on (RFC 1122, section 1.1.3). Interviews and load-balancer docs use the numbers of the older seven-layer OSI model instead: "L4" means the transport layer (TCP, UDP) and "L7" the application layer (HTTP), so an "L4 load balancer" forwards connections without reading HTTP and an "L7" one reads every request. TLS has no clean place in either model; it sits between transport and application.
For the request, wrapping is 252 of the 369 bytes on the cable (mostly HTTP headers); for a streamed token, 213 of 216. A few hundred bytes per token is nothing for any link; what streaming costs is a connection held open for the whole generation.
JSON, HTTP and TLS bytes measured on this page's run (the TLS record of the request is 299 bytes on the wire against 277 bytes of HTTP inside it: a 5-byte record header, 1 byte of inner content type and a 16-byte authentication tag, RFC 9846, section 5.2). TCP, IP and Ethernet sizes come from their specifications, because capturing packets needs administrator rights this build did not have: a TCP header is 20 bytes plus options (RFC 9293, section 3.1), here 12 bytes of the timestamps option that Linux and macOS send by default (RFC 7323, section 3); an IPv4 header is 20 bytes (RFC 791, section 3.1; IPv6 is 40); Ethernet adds a 14-byte header and a 4-byte checksum (IEEE 802.3).
Fig. 2 · The running request wrapped by each layer, to scale
The same 117-byte JSON body, handed down layer by layer and then unwrapped on arrival. Switch to one streamed token to see what the answer costs.
Each tool answers one question about one layer; learning which is most of network debugging. All of them were run against the local server for this page.
| Question | Layer | Command | Owner page for the details |
|---|---|---|---|
| Does the name resolve, and for how long is it cached? | DNS | dig name, dig name SOA | DNS, section 12 |
| Is the port reachable? | TCP | nc -vz host port: success means routing, firewalls and a listening program are all fine | Networking foundations, section 15 |
| Which connections are open? | Sockets | lsof -nP -iTCP on macOS, ss -tnp on Linux; ss -ti adds each connection's round-trip time, window and retransmission count | Networking foundations, section 15 |
| Where do packets stop? | IP | traceroute or mtr; tcpdump or Wireshark for the packets themselves (administrator rights) | Networking foundations, section 15 |
| Is TLS healthy? | TLS | openssl s_client -connect host:443 -servername host: the chain, the version, the cipher, whether verification passed | TLS and certificates, section 9 |
| Where did the time go? | All | curl -w: a timer per phase (name lookup, TCP connect, TLS done, first byte, total) | HTTP, section 12 |
| What happened, in order? | All | curl -v: name resolution, TCP connect, the TLS handshake, the certificate check, ALPN, then the request (> lines) and response headers (< lines). The first thing to run on any HTTP problem. | HTTP, section 12 |
nc, openssl s_client, curl -w, lsof and curl -v against the running requestnc -vz (TCP)
openssl s_client (TLS): the chain is two links, CN=api.llm.test issued by the throwaway Wire Lab Root CA that the client was told to trust (the depth=1 and depth=0 lines)
curl -w timing, seconds since the start
lsof -nP -iTCP: one streaming request in flight, the server's listening socket and the two ends of one connection, 127.0.0.1:49197 -> 127.0.0.1:9443: the client's ephemeral port 49197 talking to the server's port 9443 (the process owner is shown as dev)
curl -v, HTTP/1.1
Light in fibre covers about 200 km per millisecond, so distance sets a floor no protocol can beat (High Performance Browser Networking, chapter 1). Most LLM API calls are latency-bound, not bandwidth-bound, and the latency before the first token is mostly handshakes that each wait one round trip. Which handshakes you pay depends on choices made at three different layers: the HTTP version, the TLS version, and whether a connection is reused.
Bandwidth has a round-trip ceiling too. Once data flows, one connection carries at most one window of unacknowledged bytes per round trip: throughput ≤ window / RTT. That is why one checkpoint upload between regions uses a fraction of a fast link, and why every fix is parallel streams.
Add one round trip for an uncached DNS answer before any of them, and one for the request itself after. measured on an emulated 50 ms path (On the wire tab, sections 5 and 6): a TLS 1.3 handshake took 53 ms against 107 ms for TLS 1.2, and the first byte came 108 ms after the start on a new connection against 54 ms on a reused one.
The Domain Name System (DNS) is a worldwide, distributed, cached lookup from names to records (RFC 1034, 1987). Your process asks a stub resolver (getaddrinfo in the C library), the stub asks one recursive resolver, and on a cache miss the resolver walks down from a root server through the .com servers to the zone's own authoritative servers. Each answer carries a TTL (time to live), the seconds a cache may keep it.
The one thing that crosses every other layer: caching is DNS's whole failure surface. There is no way to push a change or invalidate a cache; "propagation" is every cache's TTL running out. A "does not exist" answer is cached too, so a record created a minute after a failed lookup can stay invisible for as long as the zone says (30 minutes for anthropic.com, measured). DNS failures surface as connection errors in other layers: a 5-second stall on every new connection (a lost query and the C library's default retry timer), a pod flooding the cluster DNS (Kubernetes' ndots:5), a certificate error from a filter that answers DNS itself (section 5).
Where DNS meets agents. In DNS rebinding a name first resolves to the attacker's server, then to an internal address such as 127.0.0.1 or the cloud metadata address 169.254.169.254, so a check made on the first answer is bypassed by the second. Any service run on 0.0.0.0 without authentication (a notebook, a model server) is reachable this way from a browser on the same network, and the MCP specification names it among the attacks a client must guard against when it fetches URLs a server gave it.
IP gives every machine an address (32 bits for IPv4, 128 for IPv6) and forwards a packet one hop at a time, best effort: packets may be lost, duplicated, delayed or reordered, and IP will not tell you (RFC 791, section 1.2). A port picks the program; protocol, source and destination address and port, the 5-tuple, name one connection. Every guarantee is added above IP, and the three transports add different ones:
| TCP (RFC 9293) | UDP (RFC 768) | QUIC (RFC 9000) | |
|---|---|---|---|
| Gives | A reliable, ordered byte stream with flow and congestion control | IP plus ports and a checksum: an 8-byte header, nothing else | Many independent reliable streams, encrypted, in one connection |
| Setup | One round trip (SYN, SYN-ACK, ACK), then TLS on top | None | One round trip including TLS 1.3 |
| A lost packet | Stalls every byte behind it (head-of-line blocking) | Is simply gone | Stalls only its own stream |
| Runs | In the kernel | In the kernel; the application adds any rules | In user space, on UDP; more CPU per byte than kernel TCP, and blocked UDP on port 443 means every client needs a TCP fallback |
| Carries | HTTP/1.1, HTTP/2, gRPC, TLS, SSH | DNS questions, voice, games, QUIC itself | HTTP/3 |
Two transport facts other layers keep running into. Head-of-line blocking is the thread through the HTTP versions (section 6). And a connection can die without either end knowing: a NAT or load balancer forgets a connection that was idle too long (350 seconds on an AWS NAT gateway), and TCP alone never notices a silent peer, so long-lived connections (streams, SSH sessions, connection pools, a training job's rendezvous) need keepalives or heartbeats shorter than the shortest idle timeout on the path.
Where the GPUs talk. Training traffic avoids this path for its data: GPU clusters use RDMA (the network card writes straight into the other machine's memory, no operating system in the path) over InfiniBand, RoCE or AWS's EFA, and NCCL picks NVLink, then RDMA, then plain TCP sockets. NCCL still bootstraps over ordinary TCP sockets, which is why a wrong network interface can hang a job at start-up even on an InfiniBand cluster.
TLS (version 1.3, now RFC 9846, July 2026) gives three guarantees on top of a connection: confidentiality (nobody in between can read), integrity (any changed byte is detected) and authentication (the client knows it reached the real server). It is the "S" in HTTPS. In one round trip the two sides agree on a fresh secret in public (Diffie-Hellman key exchange, so stealing the server's key later does not unlock recorded traffic), the server sends its certificate and signs the handshake with the matching private key, and both send a keyed checksum of everything exchanged. The certificate chains up to a root in the client's trust store, through certificates signed by certificate authorities.
SSH, the protocol you use to reach a GPU box, solves the same problem with the same ideas and one different choice: whom to trust.
| TLS (every API call) | SSH (a shell on a machine you administer) | |
|---|---|---|
| Server identity | A certificate signed by a CA the client already trusts | A host key, trusted the first time it is seen (the known_hosts prompt), or an SSH certificate signed by your own CA |
| Client identity | Usually none at this layer (an API key or token rides inside HTTP); mutual TLS when a workload must prove itself | Always: a user key, an agent, or a user certificate |
| Key exchange in 2026 | Hybrid post-quantum by default with OpenSSL 3.5 or later (the running request used X25519MLKEM768) | Hybrid post-quantum mlkem768x25519-sha256 by default since OpenSSH 10.0 |
| What a warning means | A certificate error: never "fixed" by turning verification off | "Host key changed": never clicked through |
verify=False, curl -k and InsecureSkipVerify keep the encryption and drop the authentication, which means encrypting to whoever answers, attacker included. The fixes are serving the full chain on the server, or adding the right CA to the client's trust store.
What TLS still leaks, and why that matters for token streams. An eavesdropper still sees the server name and protocol in the ClientHello (unless Encrypted Client Hello is used), the sizes of all records and their timing. In the streamed answer that meant one record per token, 146 to 148 bytes each, about 51 ms apart (measured): the rhythm of generation is visible though the text is not, and researchers reconstructed 29% of assistant responses from token lengths alone (Weiss et al., 2024). The defence lives in the streaming layer: pad records or group tokens.
Certificates now expire on a schedule built for automation (200 days since 15 March 2026, 47 days from 15 March 2029), so an expired certificate is the most common TLS outage and automated issuance (ACME) is mandatory in practice. Mutual TLS runs the proof in the other direction and is the strongest way for one service to prove itself to another (section 9).
HTTP is the shared vocabulary for requests and answers, and the key to its versions is that the meaning and the wire format are specified separately. Methods, status codes and headers are defined once in RFC 9110 (HTTP Semantics) and mean the same in every version; HTTP/1.1, HTTP/2 and HTTP/3 only change how those messages are cut into bytes. Your code almost never notices the version; your latency and your proxies do. Each version exists to remove a form of head-of-line blocking:
| HTTP/1.1 (1997, RFC 9112) | HTTP/2 (2015, RFC 9113) | HTTP/3 (2022, RFC 9114) | |
|---|---|---|---|
| Format | Text lines | Binary frames, compressed headers (HPACK) | Binary frames, compressed headers (QPACK) |
| Requests per connection at once | One; clients open several connections (browsers about 6 per host) | Many, as independent streams | Many, as independent QUIC streams |
| Head-of-line blocking | A slow response blocks the connection | Fixed between requests, but one lost TCP packet still stalls every stream | Gone: a loss stalls only its own stream |
| Handshakes before the request | TCP + TLS: 2 round trips | TCP + TLS: 2 round trips | QUIC with TLS inside: 1 round trip |
| Where you meet it | Many APIs and most server-to-server code | gRPC; browsers to CDNs and APIs | Browsers and mobile apps to CDNs |
For one long streaming request on a clean network all three behave alike. They differ when packets are lost: measured on the running request, one dropped TCP packet delayed all three concurrent HTTP/2 streams (by 68, 56 and 43 ms), while over HTTP/3 only the stream that lost a packet was delayed (by 66 ms). HTTP's Fig. 4 replays these runs (On the wire, section 4, has the summary).
Three HTTP facts that decide what other layers must do.
overloaded_error that way, streaming docs). 401 against 403 is auth's distinction (section 9); 502, 503 and 504 come from a proxy or gateway reporting on the hop behind it.A model generates tokens over seconds or minutes; waiting for the whole answer makes the app feel dead, and a long silence invites every proxy on the path to cut the connection. Server-Sent Events (SSE) answer with content-type: text/event-stream and keep one HTTP response open, writing small text events (event: and data: lines ending in a blank line, WHATWG HTML, section 9.2). Because it is plain HTTP it passes every proxy, which is why every major LLM API and MCP's HTTP transport use it. The choice among the four ways to deliver a result depends on direction and on how long the work takes:
| Mechanism | Direction | Use it for | What it costs |
|---|---|---|---|
| SSE | Server to client, inside one HTTP response | Token streams, progress updates; MCP's HTTP transport | One direction only; text only; buffering proxies break it |
| WebSockets (RFC 6455) | Both ways at any time, after an HTTP upgrade | Voice agents and realtime APIs where the user can interrupt | Not HTTP after the first exchange: you write heartbeats, reconnection and resume yourself; long-lived connections complicate load balancing; browsers do not apply the same-origin policy, so the server checks Origin |
| Webhooks | Provider to your server, later, as a separate signed POST | "Your batch job finished": fine-tunes, batch inference, evaluations | A public endpoint, so verify signatures; delivery is at least once, so handle duplicates |
| Long polling | Client asks, server holds the request until there is news | A fallback where nothing else gets through | A full request per batch of events; awkward timeouts |
Where streaming breaks, and which layer owns the fix. Tokens arriving in one burst at the end mean a proxy buffered the response (HTTP's proxies). A stream that dies after exactly 60 s while the model is thinking is an idle timeout on one hop; heartbeat comments every 15 s or so are the HTML standard's own advice. A stream that ends without its final event (message_stop) failed, even with no error: retry it with an idempotency key.
Behind POST /v1/messages the API calls its own services thousands of times a second, between programs written by different teams in different languages. The style decides who writes the schema, how calls are encoded, and how they fail:
| Style | Shape | Right for | Cost |
|---|---|---|---|
| REST (JSON over HTTP) | Resources with URLs, standard methods and status codes, stateless server (Fielding, 2000) | Public APIs, including every major LLM API's external face; anyone with curl can call it | Loose contracts unless you publish a schema (OpenAPI) |
| gRPC | Services in a .proto file, generated clients, binary protobuf over HTTP/2, four call modes | Internal calls where you own both ends; high call rates, streaming, deadlines | Code generation; long-lived HTTP/2 connections that L4 balancers handle badly |
| GraphQL | One endpoint and a typed schema; the client names the fields it wants | Many front ends reading overlapping data | Hard to cache; one query can fan out into many backend calls |
| JSON-RPC 2.0 | A JSON object with method, params and id, answered by result or error | The smallest call format; MCP and A2A use it | No schema or transport of its own |
Two ideas that only show across services. A deadline is the time after which the caller no longer wants an answer, passed on by every hop, so that when the user closes the tab the router and the inference server stop too; by default gRPC sets none, so a client can wait effectively forever (gRPC docs). And L4 against L7 balancing: an L4 balancer picks a backend per connection, an L7 one per request. A gRPC client keeps one long-lived HTTP/2 connection, so behind an L4 balancer all its calls land on one replica while the others idle (gRPC blog); LLM serving adds routers that send a conversation back to the replica holding its KV cache, which only an L7 router can do.
TLS proved the server's identity to the client; the API now needs the reverse. Two questions, often confused: authentication (who are you?) and authorization (what may you do?). A 401 means the first failed, a 403 the second. The credentials differ in what they prove, whether a thief can use them, and how long they live:
| Credential | What it proves | Stolen copy usable? | Lifetime | Right for |
|---|---|---|---|---|
API key (the running request's x-api-key) | "This is account X" | Yes: a bearer credential, checked by value | Until revoked | Your backend calling a provider, from a secrets manager |
| OAuth 2.1 access token | "This user let this client do these things at this API" | Yes, but only at its audience, within its scopes | Minutes | Apps, CLIs and agents acting for a user (authorization code with PKCE) |
| OIDC ID token | "This person logged in" | Should never be sent to an API | Minutes | The app learning who the user is |
| JWT | A token format, not a grant: signed claims a server verifies offline | Yes, until it expires: it cannot be revoked early | Kept short | Access tokens checked without a call to the issuer |
| mTLS certificate | "This workload holds this key" | No: bound to a private key | Hours (rotated by a mesh or SPIFFE) | Service to service inside a mesh |
| Signed request (AWS SigV4) | "Whoever holds the role's temporary key signed exactly this request" | No reusable secret crosses the wire | Temporary credentials | Cloud APIs from a role |
| SSH key or certificate | "This user holds this key" | Only with the private key | Keys: until removed; certificates: hours | Shells on GPU boxes (section 5) |
The agent-era twist. An agent holds credentials and decides what to do with them from text it reads, some written by strangers (section 10). Auth cannot stop an agent being talked into misusing a credential it legitimately holds; it can decide how much each credential is worth when that happens. Three rules follow: least privilege (read-only scopes unless it must write, separate scopes for destructive actions); audience binding (a token issued for one tool server must not work anywhere else); no token passthrough (a server that receives a token never forwards it upstream; it obtains its own, by token exchange). For actions that cannot be undone, a human approval outside the conversation, which text arriving through a tool cannot fake.
A model on its own only produces text. Before 2024 every app wired every tool by hand, so N apps and M tools meant N × M integrations; agent protocols make it N + M: a tool or an agent is written once against a standard and any host can use it. Both main protocols speak JSON-RPC 2.0 (section 8), over HTTP with SSE for streaming (sections 6 and 7) and OAuth for remote callers (section 9): they are a new layer on the old stack, not a new stack.
| MCP (Model Context Protocol) | A2A (Agent2Agent) | Commerce and payments (UCP, ACP, AP2, x402) | |
|---|---|---|---|
| Connects | An agent's host to tool servers it controls | An agent to someone else's opaque agent | A shopping agent to a merchant, and to a way to pay |
| Unit of work | A tool call (tools/call), a resource read, a prompt | A task with states (submitted, working, input required, auth required, completed, failed, canceled, rejected) and artifacts | A checkout session; a signed mandate or a per-request payment |
| Discovery | The host is configured with servers; the server lists its tools | An Agent Card at /.well-known/agent-card.json | A profile at /.well-known/ucp, negotiated by intersection |
| Transports | stdio for a local child process; Streamable HTTP remotely | JSON-RPC, gRPC and HTTP+JSON bindings | REST, MCP, A2A; x402 rides on an HTTP 402 |
| Who plans the steps | Your model, one tool call at a time | The other side's agent; you send the goal and get the outcome | The merchant's rules; "a person must finish this" is a state |
MCP's current revision is 2026-07-28, which made the protocol stateless; A2A 1.0.0 is from March 2026. Both are governed by the Agentic AI Foundation under the Linux Foundation. The other agent protocols, with their dates and status, are on Agent-to-agent and beyond (section 11), the one dated table of the topic.
The trust boundary: tool output is untrusted input. Whatever a tool returns enters the model's context next to the user's request, and the model cannot tell from the text alone which words came from the user and which from a stranger's web page. Instructions hidden in a tool result are indirect prompt injection, and no protocol can prevent it: it is what any tool that returns outside text does. It becomes data theft when private data, untrusted content and a way to send data out meet in one agent, which Simon Willison called the lethal trifecta (16 June 2025); remove any one leg and the attack has nowhere to go. When the tool moves money or a robot arm, an injected instruction is no longer a leak but an irreversible action, so limits must live below the model: in scopes, in device-level limits, in a human approval the conversation cannot fake.
measured 2026-07-28: src/read/code/r6_mcp/, a one-tool server (fetch_page, returning a fixed page; nothing is fetched) and a client in the same Python process acting as host, 5 October 2026. No model is called: the model's decision to use the tool is shown as the step it would be, and the host's next request to the model is built by the script in the Messages API shape, exactly as a host would send it. 2025-11-25: the recording from TypeScript: LLM apps and agents, section 8, its src/tl/outputs/g3_mcp_http.json (a count_tokens tool over Streamable HTTP; session IDs replaced by a placeholder there).
One tool call through host, client and server, recorded byte for byte through a logging proxy. The page the tool returned contained a hidden instruction (an HTML comment telling "AI assistants" to call a read_file tool on ~/.aws/credentials), and the host put it, unchanged, into the model's context next to the user's request. Switch to the 2025-11-25 revision to replay the same kind of call with the older handshake and session: the before and after of the stateless redesign.
Start from what you see, find the layer, run the one command that confirms it. The order is roughly the order of the request: a failure early in the path hides everything after it. The Failure lab reproduces 39 of these failures on the running request, and each child page has its own symptom table.
| What you see | Layer, likely cause | First command |
|---|---|---|
Name or service not known, getaddrinfo failed | DNS: typo, missing record, negative cache, wrong resolver inside a container | dig name; dig name SOA; compare dig @8.8.8.8 name |
| Every new connection takes about 5 s extra | DNS: a lost query and the resolver's 5 s retry | curl -w '%{time_namelookup}\n' -o /dev/null -s URL |
Connection refused immediately | TCP: nothing listening, or wrong port | nc -vz host port; on the server ss -ltn |
| Connect hangs, then times out | Network: firewall or security group drops packets | nc -vz -w 3 host port; mtr host |
| Small calls work, big uploads hang | IP: MTU blackhole | ping -M do -s 1472 host (Linux) |
| Transfer far below link speed | TCP: window or loss limited, one stream | ss -ti; iperf3 -P 1 against -P 8 |
Idle connection fails on next use (connection reset) | NAT or load-balancer idle timeout | Correlate with idle time; enable keepalives below the timeout |
certificate verify failed, unable to get local issuer certificate | TLS: missing intermediate, proxy re-signing, stale CA bundle | openssl s_client -connect host:443 -servername host -showcerts |
certificate has expired / not yet valid | TLS: renewal failed / client clock wrong | openssl x509 -noout -dates; date -u |
| 401 vs 403 | Auth: not authenticated vs not allowed (scope, audience, role) | Decode the token's claims; check aud, exp, scope |
| 429 | Rate limit | Read retry-after and rate-limit headers in curl -i |
| 502 / 503 / 504 from a proxy | HTTP hop behind it: upstream crashed or closed / no healthy upstream / upstream too slow | The proxy's own logs; curl -v straight to the upstream, skipping the proxy |
| Stream arrives in one burst at the end | HTTP proxy buffering | curl -N -v through and around the proxy; check X-Accel-Buffering |
| Stream cut at a round number of seconds | Idle or read timeout on one hop | Time several failures; find the hop whose timeout matches |
| gRPC traffic all lands on one replica | L4 load balancing of long-lived HTTP/2 connections | Per-replica request counts; switch to L7 or client-side balancing |
| Distributed training hangs at start-up | NCCL picked the wrong network interface, or a firewall blocks its ports | NCCL_DEBUG=INFO; set NCCL_SOCKET_IFNAME |
| An agent did something nobody asked for | Agent: instructions arrived inside a tool result | Read the transcript's tool results; check what tools and scopes the agent held |
| You need to | Use | Because |
|---|---|---|
| Serve a public API to arbitrary clients | HTTPS + JSON (REST style), SSE for streaming | Every language and proxy understands it |
| Stream tokens to a browser or app | SSE | Plain HTTP, one direction, survives proxies when configured |
| Let the user interrupt (voice, realtime) | WebSockets (or WebRTC for audio from a device) | Both directions at any time |
| Tell another system that a long job finished | Webhook (signed, idempotent consumer), or a queue inside your own systems | No connection held open for hours |
| Call internal services at high rate | gRPC with deadlines | Typed, compact, streaming, cancellation across hops |
| Move a big checkpoint over a long path | Many parallel TCP streams (multipart upload) | One stream is capped by window over RTT and per-flow limits |
| Move tensors between GPUs | NCCL over NVLink and RDMA | No kernel, no copies, microsecond latency |
| Give an agent tools | MCP (stdio locally, Streamable HTTP remotely) | Write a tool once, any host can use it |
| Delegate a task to someone else's agent | A2A | Discovery, task lifecycle and streaming between opaque agents |
| Authenticate users / services / your backend to a provider | OIDC with PKCE / mTLS or cloud IAM / an API key in a secrets manager | Section 9 |
| Reach a GPU box | SSH with keys (or certificates), through a jump host | Encrypted, authenticated, multiplexes forwarded ports |
Each child takes one row of the one-screen table to full depth, with its own recordings. Read them in this order if the topic is new; each also stands alone. Times are the ones each page's header states.
Reading tab of Topic: protocols, written 5 October 2026 and rebuilt as a map on 24 October 2026. Recorded exchanges: src/read/code/ (run with run_all.sh); the earlier, longer Reading tab is kept in src/read/retired/parts/.
One request, followed byte by byte. A chat app asks a streaming LLM API "What colour is the sky?" and the answer comes back token by token. This tab follows that one request down through every layer and back up, and every byte and every millisecond on it was recorded from a real run on . The Reading tab explains each layer; this tab is the evidence.
netem.py, our proxy that holds every chunk 25 ms in each direction, like a server a few thousand kilometres away. It can also lose one packet on purpose.The app sends a POST to /v1/messages with a JSON body; the server answers 200 with content-type: text/event-stream and then sends Server-Sent Events (SSE): small text blocks, each an event: line, a data: line and a blank line (WHATWG HTML Standard, section 9.2). The event names and JSON shapes follow Anthropic's Messages API streaming format, trimmed to message_start, one content_block_delta per token, and message_stop. No model runs: the five tokens are fixed, the first comes after (standing in for the model reading the prompt) and the rest apart, so every run sends the same bytes.
Under the bytes, each mark is one recv() call returning bytes to the app over plain HTTP/1.1 (port 8080, no encryption), so the timing is the server's, not the network's. Source: raw/h1_arrivals.json.
Before the first byte of the answer can arrive, the client has to find the server (DNS), open a connection (TCP, or QUIC for HTTP/3), and secure it (TLS). Each bar on the right is the median of repeated runs of our instrumented clients, which timestamp every step; tap a bar for every run.
curl -w (medians)curl measures the same phases from inside a different TLS library (macOS SecureTransport): time_namelookup (DNS), time_connect (TCP done), time_appconnect (TLS done), time_starttransfer (first byte), all from the start. Source: raw/curl_local.tsv, raw/curl_netem.tsv, raw/public_curl.tsv.
The HTTP/2 run of the request (the version curl and most SDKs pick when the server offers it), message by message: the left stack is the client, the right stack the server, and the panel under them shows the real bytes of each message and the time it happened. Fifteen messages in seven stretches:
One request, every message, on loopback
127.0.0.1, so the panel shows the same question asked of a real LLM API with dig: one address and its TTL, and a DNS filter on this laptop that answered even a query sent straight to a root server.:status 200 and text/event-stream open the stream; after the server's pause the first token arrives, drawn to scale layer by layer.Three copies of the request (call them A, B and C, as when an agent fires three model calls at once) went out 10 ms apart on one connection, over the emulated 50 ms path, and one packet was lost: the one carrying request A's second token, " sky". The figure of this measurement now lives where head-of-line blocking is taught: HTTP, Fig. 4 replays these same runs token by token for HTTP/2 and HTTP/3. The result, from this page's runs (raw/hol/):
Time runs down. Arrows slope because each direction takes 25 ms. Message names and sizes from OpenSSL's message callback in wire_client.py; times measured at the client. Source: raw/tls1.2_netem.json, raw/tls1.3_netem.json.
The same client and server, forced to TLS 1.2 and then to TLS 1.3, over the emulated 50 ms path. Every message below was logged by OpenSSL itself as it went out or came in. TLS 1.2 needs two round trips before the request can go; TLS 1.3 needs one, because the client sends its key share in its very first message instead of waiting to be told which one to use.
The two handshakes, flight by flight
The first request on a new connection pays for TCP and TLS. A resumed TLS session (the client shows a ticket the server gave it last time) skips the certificate; a kept-alive connection (the same open connection, reused) skips the handshakes altogether. Measured on the emulated 50 ms path, HTTP/2; the chart opens on the finished race, and play replays it in time.
Every failure below was caused on purpose on one machine, against the same streaming LLM request the rest of the page follows, and recorded: the exact error each client printed, the one or two commands that pinpoint it, and their real output. Find yours by pasting the error text, filter by layer or by the tool that showed it, test yourself in the drill, or walk the decision tree from symptom to layer.
Start from what you saw. Each answer narrows the layer; the leaves open the recorded failures.
Every command was run through sh -c exactly as printed, and its output (standard output and standard error together) is shown unedited except that the scratch directory reads $WORK. The variables: $PY is the lab's Python 3.13, $CL its client scripts, $CA the lab root CA from the On the wire tab, $OPENSSL OpenSSL 3.6, $PKI the lab's certificates. Python clients print the exception exactly as the last line of its traceback reads; Node prints the error and its cause.
All servers ran on 127.0.0.1: the On the wire tab's LLM stand-in (hypercorn), a real nginx 1.31.6 as the proxy and TLS terminator, small socket servers that misbehave in one way each, local DNS servers (dnspython), gRPC backends (grpcio), a JWT-checking gateway and OAuth endpoint (PyJWT), and MCP servers (the official Python SDK). A few lookups touched the public network, read-only: a reserved TEST-NET address (connect timeout), an .invalid name (NXDOMAIN), api.anthropic.com's TTL (twice), and cloudflare-dns.com and 1.1.1.1 (the DNS interception case). The machine's local network addresses and its filtering software's name are redacted. Where part of a setup is simulated, the card says so in a red-edged box.
Scripts, configurations and raw outputs: src/fail/ (run_all.sh reruns everything; check_embed.py confirms this page embeds exactly those outputs).
Every protocol this topic touches, on one map, each checked against its primary source (RFC, specification or official documentation) on 5 October 2026, each with a real command and its real output. Pick a view: the stack shows what runs on what; which protocol when asks four questions and recommends; the timeline puts every version on one axis; compare sets two side by side; old notes checked lists what the earlier pages got wrong.
Try: click any protocol. Green lines go down to what it runs on, purple dashed lines go up to what runs on it. Then press play under the map to watch one message go down the stack, gaining a layer at each step.
Try: answer the questions; the recommendation updates at once and names the reason, what to avoid and how to authenticate. Every pick opens its full entry.
The earlier written pages (the root and its ten children, last edited 21 to 28 September 2026) were treated as unverified notes. Every claim the atlas relies on was checked; these are the ones worth knowing about, including some that turned out right. Claims that could not be checked against a primary source were left out of the atlas.
Every outside link was checked on 5 October 2026; child times were read from their headers on 24 October 2026. Times are reading times for the part worth reading, not whole books. If you are new to networks, the suggested order is: this page's Reading tab, Julia Evans' two zines, the first four chapters of High Performance Browser Networking, then the specification of whatever you are debugging.
Addresses and the path, a connection's life, loss, windows and congestion control, Nagle and streamed tokens, NAT and idle timeouts, MTU hangs, QUIC, moving checkpoints, TCP in a GPU job. Reading: 49 min, plus 17 in closed details.
Delegation and resolution on a private DNS tree, records, caching with negative and stale answers, glibc and musl, Kubernetes ndots and headless Services, DNSSEC, encrypted DNS and rebinding. Reading: 45 min, plus 17 in closed details.
The TLS 1.3 handshake decrypted, resumption and 0-RTT, certificates and chains, ACME and lifetimes, revocation, mTLS and workload identity, post-quantum TLS, the classic failures. Reading: 45 min, plus 21 in closed details.
A message piece by piece, methods, status codes and caching, CORS and cookies, HTTP/1.1, HTTP/2 and HTTP/3 frame by frame, proxies, the timeout chain, retry safety. Reading: 45 min, plus 15 in closed details.
SSE byte by byte and what LLM APIs send, cut, resume and cancel, WebSocket frames and production, webhook delivery, WebRTC, gRPC streams and WebTransport. Reading: 38 min, plus 18 in closed details.
REST done properly, OpenAPI, idempotency keys, rate limits, webhooks, LLM provider APIs as a design case, protobuf, one gRPC call on the wire, deadlines, load balancing, GraphQL, JSON-RPC. Reading: 52 min, plus 16 in closed details.
401 against 403, API keys, sessions against tokens, OAuth 2.1 and OIDC, JWT validation, bound tokens, SigV4 and mTLS, token exchange, audience binding and no token passthrough for agents. Reading: 42 min, plus 10 in closed details.
Roles, JSON-RPC messages, primitives, the two transports, the stateless revision, versions, MCP's authorization profile, protocol-level threats, building a server, a client and a host. Reading: 37 min, plus 14 in closed details.
The Agent Card, tasks and states, streaming and push, A2A against MCP, the agent protocols dated, UCP and ACP, AP2 and x402, the Model Hardware Standard, the trust boundary for irreversible actions. Reading: 39 min, plus 9 in closed details.
One connection on the wire, keys and agents, host keys, SSH certificates, ProxyJump against agent forwarding, multiplexing, tunnels for notebooks, keepalives, moving files, cluster workflows. Reading: 42 min, plus 33 in closed details.
The running request byte by byte on HTTP/1.1, HTTP/2 and HTTP/3, with timings under added delay and loss.Read after sections 2 to 7, when you want to see frames and timings.
The same request broken on purpose, one failure at a time, with the symptom and the command that shows it.Read when debugging; pairs with section 11's table.
Every protocol on one set of axes, with its specification and dates.Read when choosing, or to place a protocol you just met.
What NCCL's collectives move between GPUs, and when. For section 4's last part.
Nodes, GPUs, networks and storage tiers of a training cluster.
NVLink, InfiniBand and the hardware under RDMA.
Building one service end to end; its API design (errors, pagination, idempotency, versioning) is taught on Service APIs.
Timeouts, retries, backoff and failure budgets as a system.
Where webhooks and long jobs land.
Seeing requests across hops: logs, metrics, traces.
Load balancing and how much a service can take.
Parses SSE from real reads that split events mid-line.
Builds an MCP server and client with every message recorded.
An HTTP service with axum, measured against FastAPI. 27 min, plus 19
The hosts that use MCP: Claude Code and the rest.
What sits behind the API: routers, model servers, clusters.
A short illustrated zine: packets, TCP, ports, the tools. About 30 min.Read first; it makes the toolbox in section 1 feel natural.
Resolvers, caching, TTLs and the failures of section 3, drawn. About 30 min.Read with section 3. Her post on a DNS resolver in 80 lines of Go shows the referral walk in code.
The clearest explanation of why latency, TCP and TLS decide performance; free online (2013, so before HTTP/3). Chapters 1 to 4, about 3 h.Read after this page, starting with Building Blocks of TCP and Transport Layer Security.
Every byte of a real TLS 1.3 handshake, annotated; a QUIC version exists too. About 45 min.Read after section 5 when you want the bytes inside the records this page shows from outside.
Sockets from the programmer's side: connect, bind, listen, send, recv. About 2 h for the first chapters.Read when you write your own server or debug one at the socket level.
The reference you will actually open for methods, status codes and headers, plus a guide to Server-Sent Events. About 1 h for the core pages.Keep open while building APIs.
What methods, status codes and headers mean in every HTTP version. Sections 9 and 15, about 1 h.Read when you argue about retries or status codes.
The consolidated TCP specification. Sections 3.1 to 3.5, about 40 min.Read with section 4 if you want the handshake and states exactly.
TLS 1.3 respecified, replacing RFC 8446. Section 2 (overview), about 30 min.Read with section 5. Cloudflare's detailed look at TLS 1.3 (2018) explains the design choices.
The transport under HTTP/3. Sections 1 to 3, about 40 min.Read after Cloudflare's HTTP/3: past, present and future (2019) and The road to QUIC (2018), which explain why it exists.
The original design, still accurate. Sections 2 to 5, about 1 h.Read when a DNS problem does not match what you expected.
The whole SSE format and parsing rules. About 20 min.Read before writing an SSE parser or proxy.
Handshake, framing, closing. Sections 1, 5 and 7, about 1 h.Read when building a realtime or voice channel.
Service definitions, the four call types, deadlines and cancellation. About 40 min.Read with section 8; add the protobuf encoding guide (30 min) for the wire format.
The consolidated OAuth: PKCE always, no implicit or password grants. About 2 h 30 min in full.Read the flows you use after Parecki's guide.
The clearest flow-by-flow explanations, by one of the editors of the OAuth 2.1 draft. 30 min, then about 1 h.Read first for anything OAuth.
The pitfalls list: algorithms, audiences, key handling. About 40 min.Read before accepting JWTs in a service.
Retries made safe with idempotency keys, from the API that popularised them. 15 min.Read before retrying POSTs.
The current revision; short and well written. Start with the changelog and the security best practices. About 1 h 30 min.Read before building or deploying a server.
The maintainers' own explanations of each revision and the roadmap. About 30 min for recent posts.Read to keep current.
Agent Cards, tasks and their states, the three bindings. About 1 h.Read when agents must call agents you do not control.
Why private data, untrusted content and an outbound channel together make agents leak. 15 min.Read before giving an agent tools.
Reading encrypted assistant responses from token-sized TLS records. About 1 h.Read with section 5's note on what TLS leaks.
Measured post-quantum key agreement on clients and origins. 20 min.Read for the post-quantum numbers on the TLS child (section 8).
Buffer sizes and settings for long, fast paths, from the people who run a 100G science network. About 40 min.Read when a single transfer is slow (section 4).