kraken-ai
v0.0.3
Published
Kraken AI SDK: a very lightweight, fully-typed multi-model AI agent framework
Maintainers
Readme
kraken-ai
A fully typed, multi-model AI agent framework with a single dependency (zod) plus the provider SDK of your choice. Create simple agents or build sophisticated multi-model orchestrators with team delegation, custom execution loops via kernels, middleware injection, and event hooks.
We built this because we were tired of poor developer experience with existing frameworks, and we wanted to create something very lightweight yet useful.
- Model-agnostic — swap providers without changing agent code
- Zod-native tools — define tools with Zod schemas, get full type inference
- Structured output — constrain model responses to a Zod schema
- Multi-agent teams — agents delegate to team members; the model decides when
- Human-in-the-loop — tools with
requiresApprovalpause execution for human decision - Middleware — intercept and transform LLM calls, tool calls, and tool definitions
- Observability — structured events for every LLM call, tool execution, and lifecycle transition
- Mock provider — deterministic testing with pattern-matched responses
- Custom kernels — full control over the execution loop
Install
pnpm add kraken-aiQuick Start
import { Agent, tool, google } from "kraken-ai";
import { z } from "zod";
const lookupPrice = tool({
name: "lookup_price",
description: "Look up the current price of a product by SKU",
parameters: z.object({ sku: z.string() }),
execute: async ({ sku }) => {
const price = await db.products.getPrice(sku);
return { sku, price };
},
});
const agent = new Agent({
name: "pricing-analyst",
model: google("gemini-3-flash-preview"),
instructions: "You are a pricing analyst. Use tools to look up product data.",
tools: [lookupPrice],
});
const result = await agent.run([{ role: "user", content: "What is the price of SKU-4821?" }]);
if (result.status === "complete") {
console.log(result.output);
}Documentation
- Models — providers, lazy resolution, custom providers
- Tools — Zod-native tools, human-in-the-loop approval
- Structured Output — constrain responses to a schema
- Multi-Agent Teams — delegation, parameter propagation
- Middleware — intercept LLM calls, tool calls, and transitions
- Observability — structured event callbacks
- Custom Kernels — async generator kernels
- Testing — mock provider with pattern matching
- API Reference — full API surface
Requirements
- Node.js 18+
- TypeScript 5+
zod4+ (peer dependency)@google/genai1+ (optional — required for the Google provider)
Enterprise
For full governance, observability, and managed infrastructure, see the Kraken AI platform.
License
Apache-2.0
