Skip to content

Durable Streams

The data primitive for the agent loop. For building resilient, collaborative, multi-agent systems.

What are Durable Streams?

Durable Streams are persistent, addressable, real-time streams. They're a flexible, swiss-army-knife data primitive that's ideal for:

  • token streaming
  • collaborative AI sessions
  • real-time presence

They're resumeable and resilient to patchy connectivity. They're high-throughput, low-latency and highly scalable. They unlock building multi-user, multi-agent systems.

They're extensible, with wrapper protocols for everything from type-safe JSON streams running off a Standard Schema, to multi-modal data and structured database sync.

Why do we need them?

Modern applications frequently need ordered, durable sequences of data that can be replayed from arbitrary points and tailed in real time.

Durable Streams addresses this gap for apps and agents across all platforms: web browsers, mobile apps, native clients, IoT devices, and edge workers.

Use cases

  • token streaming - stream LLM token responses
  • agentic apps - stream tool outputs and events
  • database sync - stream database changes
  • collaborative editing - sync CRDTs and OTs across devices
  • real-time updates - push state to clients and workers
  • workflow execution - build durable workflows on durable state

Benefits

  • multi-tab - works seamlessly and efficiently across browser tabs
  • multi-device - start on your laptop, continue on your phone
  • never re-run - don't repeat expensive work because of a disconnect
  • share links - consume and interact with the same stream
  • refresh-safe - refresh the page, switch tabs or background the app
  • massive fan-out - scale to millions of concurrent viewers

How do they work?

The core primitive is a byte stream that can be written to and consumed via an open protocol using a wide range of client libraries.

Resilient, scalable data delivery

The protocol is a generalization of the Electric HTTP API.

It ensures resilience and reliable, exactly-once message delivery. Which can be scaled out through existing CDN infrastructure.

High throughput, low-latency

The core streams are extremely simple: append-only binary logs.

As a result, they support very high throughput (millions of writes per second) and can be cached and served with single-digit ms latency at the cloud edge.

Real-time and asynchronous collaboration

Streams are persistent and addressible, with their own storage and URL.

Clients can consume the stream from any position in the log, providing message history and resumability. They can connect and subscribe to them at any time, for both asynchronous and real-time collaboration.

Wrapper protocols

Durable Streams support multiple wrapper protocols for different use cases:

  • Binary streams — efficient binary encoding for high-throughput data
  • JSON mode — human-readable JSON for debugging and interoperability
  • Proxy — transparent proxy mode for existing SSE endpoints
  • Durable state — persisted session state with automatic recovery
  • TanStack AI — integration with TanStack Query for AI responses
  • Vercel AI SDK — drop-in transport adapter for Vercel AI SDK
  • Yjs — CRDT-based collaborative editing with Yjs

Durable Transports for your AI SDK

We've released Durable Streams based transport and session integrations for TanStack AI and the Vercel AI SDK. With turnkey hosting on Electric Cloud.

Announcing Hosted Durable Streams

Hosted durable streams are live on Electric Cloud. You can now sync and stream AI sessions and low-latency real-time data alongside structured database changes.

From fiction to reality, you can now build difficult things

Four years ago, building a collaborative parametric CAD app was completely out of reach for a solo developer. I built one in a week, using the Electric stack and coding agents.

Durable Sessions — the key pattern for collaborative AI

As the world moves to getting things done through agents, products need to combine AI with team-based collaboration. Durable Sessions are the best way to do that.

Durable Streams 0.1.0 and State Protocol

The first official npm release of Durable Streams, introducing the State Protocol for database-style sync semantics, improved conformance tests and community experiments.

Announcing Durable Streams

Introducing Durable Streams, an open protocol for persistent, addressable, real-time streams, based on a generalization of the battle-tested Electric sync protocol.

Building AI apps? You need sync

AI apps are collaborative. Building them requires solving resumability, interruptibility, multi‑tab, multi‑device and multi‑user.

More information

See the project website for more info.