Cereal docs
TypeScript SDK

TypeScript SDK

Author agents, call the API, and stream sessions with the interface that fits your code.

The SDK has three distinct jobs: authoring an agent with its tools, calling the Cereal HTTP API, and displaying a session in the browser. You can use each independently.

Setup and compatibility

The current starter uses the SDK in the Cereal repository. Follow the TypeScript quickstart to install workspace dependencies and build it. Repository access is required; the HTTP quickstart does not depend on SDK distribution. Do not substitute a similarly named npm package.

The generated reference records the package version used to generate its signatures. Examples are compiled against the same checkout. The browser AI SDK adapter targets the SDK's declared ai peer range; check packages/sdk/package.json when updating dependencies. Cereal's HTTP contract is versioned separately under /v1.

ImportJobRead
@trycereal/sdkdefineProvider, defineAgent, configureCereal, tools, routers and agent actionsAuthoring
@trycereal/sdk/clientcreateCerealClient and typed API namespacesClient
@trycereal/sdk/browserStream readers, transcript state, UI adaptersBrowser
@trycereal/sdk/verifyVerify callbacks and inspect claimsVerification
@trycereal/sdk/nodeAdapt Web Request/Response handlers to Node HTTPNode adapter
@trycereal/sdk/devProgrammatic outbound development channelsDevelopment channel

Definitions are inert. The first agent action initializes dependencies automatically; await agent.init() initializes early. Provider and agent objects can reference each other without receiving a client. Authoring explains the lifecycle.

The root also exports getCerealClient() for direct calls through the shared runtime. Error classes such as CerealError and SessionNotFoundError are imported from @trycereal/sdk, not @trycereal/sdk/client.

Find a signature

Use TypeScript signatures for the actual supported functions, options, returned objects, and client namespaces. Internal options are excluded. The API/SDK map explains composite helpers and HTTP coverage identifies operations the client does not call.

Keep the product model shared

Sessions, versions, identity, and tool execution belong to the platform model. This section documents TypeScript behavior; the HTTP reference documents wire requests and responses.

On this page