Concepts

These concepts describe how AI Transport works, what the session is and how it's structured.

Open in

AI Transport is built around the following concepts. The session is the durable conversation, the turn is one unit of agent work inside the session, the transport is how a participant connects, the codec translates between your framework and Ably, the conversation tree organises every message and branch, and the infrastructure is the platform that holds it all together at scale.

These concepts compose. The session is the anchor: it contains the conversation tree, hosts turns, and is read and written through transports. The transport carries codec-encoded messages over a channel. The infrastructure is what makes any of it reliable across reconnects, regions, and load.

The session is the state

The session is the persistent, shared state of a conversation. It exists independently of any participant: clients connect and disconnect, agents spin up and terminate, and the session endures.

Every other concept on this page operates on or within a session.

A turn is one unit of agent work

A turn is one unit of agent activity inside the session: the user's input, the agent's response, any tool calls, and the final completion. The turn is the level at which you start, observe, and cancel work.

A session contains many turns. Turns coexist on the same session and have independent lifecycles.

The transport connects you to the session

The transport is how a participant connects. The client transport is a long-lived object that subscribes to the channel and materialises the session into a tree. The agent transport is short-lived and handles one execution attempt within a turn.

The transport is not the session. Multiple transports connect to the same session.

The codec translates between your framework and Ably

The codec is the boundary between your domain (text deltas, tool calls, finish events for whatever framework you use) and Ably's message primitives. The transport works with any framework that has a codec implementation.

The codec is documented in detail on the transport page and in the codec API reference.

The conversation tree holds every branch

The conversation tree is how messages are organised inside the session. Every message, including every branch from an edit or regenerate, is preserved as a node in the tree. A view is a linear path through the tree: the conversation as a participant sees it.

The tree is what makes branching, edit, and regenerate work without losing history.

Authentication runs at three layers

Authentication covers three concerns at once: an Ably token for channel access, HTTP headers for the server endpoint, and a server-side hook that authorises cancel signals.

The first two are standard Ably auth; the third is specific to how AI Transport handles cancellation across participants.

The infrastructure carries it at scale

The infrastructure page describes the four guarantees the session layer depends on: integrity (exactly-once, in order), reliability (multi-region, no single point of failure), performance (low latency wherever the user connects from), and availability (horizontal scale).

If you are evaluating whether the session layer will hold in production, this is the page to read.