# Concepts These concepts describe how AI Transport works, what the session is and how it's structured. 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](https://ably.com/docs/ai-transport/concepts/sessions.md) 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](https://ably.com/docs/ai-transport/concepts/turns.md) 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](https://ably.com/docs/ai-transport/concepts/transport.md) 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](https://ably.com/docs/ai-transport/concepts/transport.md#codec) page and in the [codec API reference](https://ably.com/docs/ai-transport/api/javascript/codec.md). ## The conversation tree holds every branch The [conversation tree](https://ably.com/docs/ai-transport/concepts/conversation-tree.md) 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](https://ably.com/docs/ai-transport/concepts/authentication.md) 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](https://ably.com/docs/ai-transport/concepts/infrastructure.md) 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. ## Read next - [Getting started with the Vercel AI SDK](https://ably.com/docs/ai-transport/getting-started/vercel-ai-sdk.md): build a working app in a few minutes. - [Frameworks](https://ably.com/docs/ai-transport/frameworks/vercel-ai-sdk-ui.md): see how AI Transport composes with your AI framework. - [Features](https://ably.com/docs/ai-transport/features/token-streaming.md): browse what AI Transport does once you have a session running. ## Related Topics - [Sessions](https://ably.com/docs/ai-transport/concepts/sessions.md): Understand sessions in AI Transport: persistent, shared conversation state that exists independently of any participant's connection. - [Conversation tree](https://ably.com/docs/ai-transport/concepts/conversation-tree.md): Understand how AI Transport organises messages into a branching conversation tree, and how views provide each participant with their own linear perspective. - [Turns](https://ably.com/docs/ai-transport/concepts/turns.md): Understand turns in AI Transport: the logical unit of agent work that structures prompt-response cycles with lifecycle states, cancellation, and execution resilience. - [Transport](https://ably.com/docs/ai-transport/concepts/transport.md): Understand the transport layer in AI Transport: client transport, agent transport, and the codec that bridges your AI framework to Ably. - [Authentication](https://ably.com/docs/ai-transport/concepts/authentication.md): Understand how authentication works in Ably AI Transport: Ably token auth for channel access, HTTP headers for server endpoints, and cancel authorization. - [Infrastructure](https://ably.com/docs/ai-transport/concepts/infrastructure.md): How Ably's platform provides the integrity, reliability, performance, and availability that a durable AI session layer requires. ## Documentation Index To discover additional Ably documentation: 1. Fetch [llms.txt](https://ably.com/llms.txt) for the canonical list of available pages. 2. Identify relevant URLs from that index. 3. Fetch target pages as needed. Avoid using assumed or outdated documentation paths.