Getting Started
Installation via CLI or npm, project setup, and basic configuration.
Install the CLI
npm install -g @kernl-sdk/cliCreate a project
kernl init my-project
cd my-projectYour first agent
Open src/agents/jarvis.ts. This is your agent:
import { Agent } from "kernl";
import { anthropic } from "@kernl-sdk/ai/anthropic";
import { math } from "@/toolkits/math";
export const jarvis = new Agent({
id: "jarvis",
name: "Jarvis",
instructions: "You are Jarvis, a helpful assistant.",
model: anthropic("claude-sonnet-4-5"),
toolkits: [math],
});The starter project includes a simple math toolkit—now let's add something more useful.
Add toolkits
Toolkits give your agent capabilities. You can grab pre-built ones from the registry or write your own.
From the marketplace
Browse kernl.sh/marketplace and add with a single command:
kernl add toolkit githubThis downloads the toolkit to toolkits/, installs dependencies, and shows any environment variables to configure.
Your own tools
Create a tool with tool() and group them into a Toolkit:
import { tool, Toolkit } from "kernl";
import { z } from "zod";
const greet = tool({
id: "greet",
description: "Greet someone by name",
parameters: z.object({ name: z.string() }),
execute: async (ctx, { name }) => `Hello, ${name}!`,
});
export const hello = new Toolkit({
id: "hello",
description: "Greeting tools",
tools: [greet],
});Then wire toolkits into your agent:
import { github } from "@/toolkits/github";
import { hello } from "@/toolkits/hello";
export const jarvis = new Agent({
id: "jarvis",
name: "Jarvis",
instructions: "You are Jarvis, a helpful assistant.",
model: anthropic("claude-sonnet-4-5"),
toolkits: [github, hello],
});Run your agent
There are two ways to run an agent:
Blocking — wait for the full response:
const result = await jarvis.run("What can you help me with?");
console.log(result.response);Streaming — receive events as they happen:
const stream = jarvis.stream("Tell me a joke");
for await (const event of stream) {
if (event.kind === "text.delta") {
process.stdout.write(event.text);
}
}The starter template runs this in src/index.ts. Try it:
pnpm startProject structure
The CLI scaffolds a sensible basic project structure for you:
src/
├── agents/
│ └── jarvis.ts
├── toolkits/
│ ├── math/
│ │ ├── index.ts
│ │ ├── add.ts
│ │ └── ...
│ └── github/ ← added via registry
│ └── index.ts
└── index.tsFor real applications, you'll likely want to run your agent inside a server. Check out the microprojects for production-ready examples:
- Jarvis — Chief of Staff for dev teams with Linear + GitHub toolkits
- Watson — Customer discovery agent with memory and workflows
Both follow the same pattern: a server/ running Hono + kernl, and a web/ frontend chatbot that hits the agent API.