Quickstart
Run your first agent with a tool in five minutes.
1. Install
npm install cencori zod# .env
CENCORI_API_KEY=csk_...Get a key from your project's API keys page. Use a secret key: the SDK runs on your server.
2. Define a tool and an agent
// agent.ts
import { Agent, tool } from 'cencori/agents';
import { z } from 'zod';
export const getWeather = tool({
name: 'get_weather',
description: 'Current weather for a city.',
parameters: z.object({ city: z.string() }),
execute: async ({ city }) => ({ city, tempC: 31, sky: 'sunny' }),
});
export const assistant = new Agent({
name: 'Assistant',
instructions: 'Answer briefly. Use tools for live data.',
tools: [getWeather],
});No model means the default, GPT OSS 120B on Cerebras: fast and good at calling tools. Set model to any model in the catalog.
3. Run it
import { run } from 'cencori/agents';
import { assistant } from './agent';
const result = await run(assistant, "What's the weather in Lagos?");
console.log(result.finalOutput); // "It's 31°C and sunny in Lagos."The model asked for get_weather, the SDK ran it in your process, sent the result back, and the model answered.
4. Stream it
const stream = run(assistant, "What's the weather in Lagos?", { stream: true });
for await (const event of stream) {
if (event.type === 'text_delta') process.stdout.write(event.delta);
}
const result = await stream.completed;5. Keep the conversation going
const first = await run(assistant, "What's the weather in Lagos?");
const second = await run(assistant, 'And in Nairobi?', { sessionId: first.sessionId });6. See the trace
Open Observability → Traces in your project. Every run is there with its turns, tool calls, timings and cost.
Next
- Agent definitions: everything an agent can take.
- Guardrails and approvals: pause for a human before risky tools.
- Agent UI: put the agent in a chat that answers with charts and tables.

