Rethinking streaming for agents A demo called Durable Chat, built on Durable Streams and published with code on GitHub, stores an agent's output as it is written rather than inside a single HTTP response, letting any tab or device resume a reply after a page refresh. The write-up argues that server-sent events streaming was designed for short chat replies, and that agent runs lasting minutes or hours, taking actions such as writing files and opening pull requests, and read by multiple users expose three failures when the connection drops: the browser cannot resume, the server has nothing saved to replay, and only one connection can watch the output. When an agent works on a task for five minutes, it streams its progress back to the browser the whole time: tokens, tool calls, intermediate results. What happens if, three minutes in, you refresh the page? The HTTP response that carried the stream is gone, and so is everything that came through it. The agent might still be running on the server, but the browser has no way to reconnect to the stream and nothing to replay. Apps like ChatGPT and Claude do bring you back to your session after a refresh. They can because they keep the session in their own storage, separate from the stream, and wrote the code that reconnects you to it. Most teams building agents have to write that machinery themselves, because the tool they stream with a single HTTP response was made for chat, and agent output has outgrown it. Right above is a clip from Durable Chat https://br-frosty-sunset-bgioxtua-chat.compute.c-9.eu-central-1.aws.neon.tech/ , a demo that works differently. It's built on Durable Streams https://durablestreams.com/ , so the agent's output is stored as it's written instead of living in the connection, and any tab or device can pick up the reply where it left off here's the code https://github.com/samwillis/neon-durable-chat-demo . But let's not get ahead of ourselves. Streaming was built for chat A model writes its answer one token at a time. If the app waited for the whole answer before showing anything, the user would stare at a spinner for ten or twenty seconds. So LLM apps stream instead: each token goes to the browser as soon as the model produces it, and the answer appears word by word. The usual way to do this is simple: - The browser sends one HTTP request. - The server starts the response but doesn't finish it: it keeps the response open and writes each new token into it, usually in the server-sent events SSE format. - When the model is done, the server closes the response. While the model is still writing, the open response is the only place the output exists. The server passes tokens through as they arrive, and the app usually saves the reply to its database only once it's finished. Until then, the browser holds whatever it has received, and nothing else holds the rest. Ordinary events end that response. A page refresh, a phone switching from Wi-Fi to cellular, a laptop going to sleep, and a server restarting during a deploy all close the connection. When it closes mid-reply, three things are true: 1. The browser can't pick up where it stopped. It has no way to tell the server "I already have everything up to here, send me the rest." 2. There's nothing to send even if it could ask. The in-progress output was never saved, so the server can't replay what the browser missed. At best, the app saves the finished reply later. 3. Nobody else can watch the output as it's written. The response belongs to one connection, so a second tab, a teammate, or a background worker can't open it too. For a chat reply, this was a reasonable tradeoff. The reply took a few seconds and was only text. If the connection dropped, the user lost a few seconds of in-progress output, and the app could show the saved reply once the model finished. Agents changed what a stream is An agent run is a different kind of thing, and each difference raises the cost of losing the stream: - Runs are long. An agent can work for minutes or hours. The longer the run, the more likely the connection drops at least once. - Runs take actions. Agents call tools, write files, open pull requests, and send messages. Asking again means running those actions again, which is expensive at best and unsafe at worst. - Runs have many readers. The user follows along on a laptop and then checks in from a phone. A teammate joins to review. A worker acts on the output, and another agent picks up where the first one stopped. A single HTTP connection has exactly one reader. - The stream is the record. The ordered sequence of what the agent saw, said, and did is often the only account of the run. Taken together, these mean an agent's stream is much more than a way to show progress: it holds the session itself. So apps that take agents seriously store that output. Usually that means running two systems side by side: a stream that carries output to the browser, and a database that keeps it. Then there's the code that ties them together: saving each piece of output as it's produced, tracking how far each reader got, and replaying what a reader missed after it reconnects. Durable Streams puts transport and storage in one place. The stream itself is stored, ordered, and addressable, and anyone with permission can read it from wherever they left off. Durable Streams: an open protocol for agents At Electric we built Durable Streams https://durablestreams.com/ to fix this. A durable stream replaces the single long HTTP response with stored output that has its own URL. With a normal streaming response, the agent's output exists only while the connection is open; with a durable stream, the agent writes its output to the stream and the server keeps it. Readers ask the server for that output, starting from wherever they left off. Each stream is a URL: Two requests do most of the work: - Writing: the agent sends a POST to the URL with its next piece of output, and the server adds it to the end of the stream. - Reading: a client sends a GET to the URL with an offset, a marker for where to start reading. Here's what happens when a connection drops. Say the agent has appended three pieces of output: A , B , and C . 1. The browser reads the stream and receives A and B . 2. Each response carries a Stream-Next-Offset header with the position just after the last thing received. The browser saves it, so it now holds the position after B . 3. The connection drops. 4. The browser reconnects and sends GET ?offset=