# Internals The wire protocol, codec architecture, conversation tree structure, and transport patterns that make up AI Transport under the hood. For curious engineers and codec implementers. The internals section covers the wire protocol, codec architecture, conversation tree structure, and transport patterns that make up AI Transport under the hood. The audience is engineers who want to understand the system before betting on it, and contributors building custom codecs. The internals fit together as four layers, from the application-facing model down to the SDK plumbing. The conversation tree is the highest-level structure: sessions are trees of messages joined by parent and fork-of pointers. The codec architecture sits underneath, encoding domain events into Ably operations on the publish side and decoding them back into messages on the subscribe side. The wire protocol defines what those operations look like on the channel: the transport headers, lifecycle events, and message identity that travel over Ably. The transport patterns are the SDK-internal components, including the `StreamRouter`, the `TurnManager`, the `pipeStream` plumbing, and the cancel routing pipeline, that hold it all together. ## Topics {[ { title: 'Wire protocol', description: 'The Ably channel wire format: transport headers, lifecycle events, content messages, and message identity.', link: '[ably docs ai-transport internals wire-protocol](https://ably.com/docs/ai-transport/internals/wire-protocol.md?source=llms.txt)', }, { title: 'Codec architecture', description: 'How the codec bridges domain events to Ably messages. Encoder, decoder, accumulator, and lifecycle tracker internals.', link: '[ably docs ai-transport internals codec-architecture](https://ably.com/docs/ai-transport/internals/codec-architecture.md?source=llms.txt)', }, { title: 'Conversation tree', description: 'The branching conversation structure. Serial ordering, sibling groups, fork chains, and the flatten algorithm.', link: '[ably docs ai-transport internals conversation-tree](https://ably.com/docs/ai-transport/internals/conversation-tree.md?source=llms.txt)', }, { title: 'Transport patterns', description: 'Internal transport components: StreamRouter, TurnManager, pipeStream, and cancel routing.', link: '[ably docs ai-transport internals transport-patterns](https://ably.com/docs/ai-transport/internals/transport-patterns.md?source=llms.txt)', }, ]} ## Related Topics - [Wire protocol](https://ably.com/docs/ai-transport/internals/wire-protocol.md?source=llms.txt): The Ably channel wire format used by AI Transport. Headers, lifecycle events, content messages, and message identity. - [Codec architecture](https://ably.com/docs/ai-transport/internals/codec-architecture.md?source=llms.txt): How the AI Transport codec bridges domain events to Ably messages. Encoder, decoder, accumulator, and lifecycle tracker internals. - [Conversation tree](https://ably.com/docs/ai-transport/internals/conversation-tree.md?source=llms.txt): How AI Transport maintains a branching conversation structure. Serial ordering, sibling groups, fork chains, and flatten algorithm. - [Transport patterns](https://ably.com/docs/ai-transport/internals/transport-patterns.md?source=llms.txt): Internal transport components in AI Transport. StreamRouter, TurnManager, pipeStream, and cancel routing. ## Documentation Index To discover additional Ably documentation: 1. Fetch [llms.txt](https://ably.com/llms.txt?source=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.