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.
| Import | Job | Read |
|---|---|---|
@trycereal/sdk | defineProvider, defineAgent, configureCereal, tools, routers and agent actions | Authoring |
@trycereal/sdk/client | createCerealClient and typed API namespaces | Client |
@trycereal/sdk/browser | Stream readers, transcript state, UI adapters | Browser |
@trycereal/sdk/verify | Verify callbacks and inspect claims | Verification |
@trycereal/sdk/node | Adapt Web Request/Response handlers to Node HTTP | Node adapter |
@trycereal/sdk/dev | Programmatic outbound development channels | Development 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.