Pingerchips LogoPingerchips
Chat / Sessions

Chat / Sessions

Durable, real-time messaging for AI agents and human conversations.

What it is

Chat gives every conversation a persistent thread backed by the Durable Objects ring. Messages survive restarts. Token streams from LLMs accumulate in memory and flush to subscribers every 40ms. When a run ends, the final message is committed to the WAL and Postgres.

Mental model

Loading diagram…

A thread is the durable unit — one WebSocket channel per thread:

chat:v1:app:{appKey}:thread:{threadId}

A run is one LLM generation: it starts, streams tokens, and ends. Token chunks are batched every 40ms; each flush writes one log entry for the run's stream:{runId} slot (its text so far, never the whole thread) and broadcasts only the new span. The full thread state is snapshotted just once every 32 log entries.

Run lifecycle

Loading diagram…

When to use

  • AI chat interfaces — customer support, copilots, assistants
  • Multi-agent pipelines that need a durable audit log
  • Any product with persistent, searchable conversation history

If you only need fast pub/sub without persistence, use Channels instead.


New here? Start with the Quickstart — you'll have a working chat interface in 15 minutes.

Know what you're looking for? Jump to the Reference.

On this page