API reference

Reference for every public API in the @ably/ai-transport package. The SDK is organised into seven entry points so you only import what you need.

This reference covers every public API in the @ably/ai-transport package. The SDK is organised into seven entry points so you only import what you need.

Quick example

A minimal client session setup using the Vercel-pre-bound factory:

JavaScript

1

2

3

4

5

6

7

8

9

10

11

import * as Ably from 'ably';
import { createClientSession } from '@ably/ai-transport/vercel';

const ably = new Ably.Realtime({ authUrl: '/api/auth/token' });

const session = createClientSession({
  client: ably,
  channelName: 'conversation-42',
});

await session.connect();

Entry points

Entry pointImport pathContents
Core@ably/ai-transportcreateClientTransport, createAgentTransport, createClientSession, createAgentSession, defineCodec, Invocation, the WireCodec interface
React@ably/ai-transport/reactClientSessionProvider, useClientSession, useView, useTree, useCreateView, useMessagesWithSeed, useAblyMessages, createSessionHooks
Vercel@ably/ai-transport/vercelcreateUIMessageCodec, Vercel-bound createClientSession and createAgentSession, createChatTransport, vercelRunOutcome, createToolResultFork
Vercel React@ably/ai-transport/vercel/reactChatTransportProvider, useChatTransport, useMessageSync, useMessagesWithSeed, plus the Vercel pre-typed re-exports of ClientSessionProvider, useClientSession, useView, useCreateView, useTree, and useAblyMessages
OpenAI@ably/ai-transport/openaiResponsesCodec, toResponsesInput, and the loop-correlation helpers resolvedCallIds, unansweredCalls, and approvedUnexecutedCalls
Temporal@ably/ai-transport/temporalcreateAblyTransportPlugin and stepIdFor, both worker-side
Temporal workflow@ably/ai-transport/temporal/workflowwithRun, openRun, and RunHandle, for code inside the workflow sandbox

Peer dependencies

ably is required. The rest are optional, and you only need the ones matching the entry points you import:

PackageNeeded for
ablyEvery entry point.
aiThe Vercel entry points.
openaiThe OpenAI entry point.
reactThe React entry points.
@temporalio/activityThe Temporal worker entry point.
@temporalio/workerThe Temporal worker entry point.
@temporalio/workflowThe Temporal workflow entry point.

JavaScript

Transport

You can publish and subscribe to codec events alongside run and step lifecycle events, and build your own application state from them. Your own code holds the conversation state, so you decide which events to keep and how to shape them for your UI.

Core

Vercel

Temporal

React

Core

Vercel

Errors