API reference

The complete client surface

Every method is fully typed end to end. This reference covers the core of the @crow/client package.

createCrow(options)

Create a configured client instance.

reference.ts
1const crow = createCrow({
2 agent: "support-triage",
3 token: process.env.CROW_TOKEN,
4 auth: async () => getSessionToken(),
5 scope: { userId: session.user.id },
6})

crow.send(message, options?)

Send a message and receive a streaming response.

reference.ts
1const stream = await crow.send("Summarize this thread", {
2 thread: thread.id,
3 tools: { lookupOrder },
4})
5
6for await (const chunk of stream) {
7 process.stdout.write(chunk.text)
8}

crow.tool(definition)

Define a typed tool the agent can call.

reference.ts
1const lookupOrder = crow.tool({
2 name: "lookupOrder",
3 schema: z.object({ id: z.string() }),
4 run: async ({ id }) => db.orders.find(id),
5})

crow.threads

Create, fetch, fork, and replay conversations.

reference.ts
1const thread = await crow.threads.create()
2const history = await crow.threads.messages(thread.id)
3const forked = await crow.threads.fork(thread.id)