TypeScript SDK
HTTP API and TypeScript SDK map
Which interface you are calling, what it adds, and where its contract lives.
The platform concepts are shared. The TypeScript helper signature and the HTTP request shape are separate contracts. Use this map when moving between examples.
| TypeScript call | HTTP relationship | Added behavior |
|---|---|---|
client.agents.upsert({ slug, definition }) | POST /v1/agents/upsert | Typed inputs/results and errors |
client.sessions.create({ agentId, initialMessage }) | POST /v1/sessions/create | Requires an explicit agent ID |
agent.sessions.start({ message }) | Initializes dependencies and agent, then creates a session | Supplies agentId; translates message to initialMessage |
agent.init() | Provider/connection/agent upserts and supporting lookups | Derives tool configuration and learns target verification context; does not deploy code |
client.sessions.stream(id) | Token minting followed by GET /sessions/{id}/stream | An async iterable over one projected SSE connection; requires data scope |
subscribe({ tokenSource, ... }) | Browser stream consumer | Token renewal and automatic reconnection |
agent.approvals.allow(id, toolCallId) | POST /v1/sessions/decide | Supplies decision: "allow" |
client.me() | POST /v1/auth/me | Different namespace placement |
createNodeHandler(agent) | No Cereal operation | Adapts incoming Node requests to Web Request/Response |
agent is the return value of defineAgent. client is the return value of
createCerealClient. They are not interchangeable: agent.sessions.start is not
client.sessions.start, and there is no HTTP operation named sessions.start.
Find the exact contract
- TypeScript signatures come from the actual SDK declarations.
- HTTP coverage is checked against transport calls in the current client.
- HTTP operations describe the server's JSON contract.
- Platform model explains sessions, definitions, and where code runs.
An operation available over HTTP may have no typed SDK wrapper. Use its documented HTTP request instead of inferring a method name. A helper may call several operations, so its scope requirements can exceed those of one read operation.