v0.1 · experimental · MIT
Watch, price, and safely cheapen the small decisions your AI agent makes.
krino is a TypeScript library for the Vercel AI SDK and the Claude Agent SDK. It puts a small, cheap decision model next to your agent, records what it would decide, and shows what that would save. You turn it on only when the data agrees.
$ npm i @krinolabs/krinohow it works
- 1
Shadow
krino asks a small decision model in the background and records its answers. Your agent behaves exactly as before.
- 2
Report
npx krino reportshows how often krino agreed with your agent, what it would save, and the latency it adds. - 3
Enforce
When the data agrees, turn on enforce mode for tool selection. If krino is slow or unsure, your agent gets all its tools.
quick look
TypeScript
import { createKrino, DEFAULT_FLUSH_TIMEOUT_IN_MILLISECONDS } from "@krinolabs/krino";
import { withKrino } from "@krinolabs/krino/ai-sdk";
import { createJevAiGatewayProvider } from "@krinolabs/krino/providers/jev";
import { generateText, stepCountIs, tool } from "ai";
import { z } from "zod";
const krino = createKrino({
projectName: "my-agent",
decisionModes: { toolSelection: "shadow", riskGate: "shadow" },
decisionProvider: createJevAiGatewayProvider(),
});
const tools = {
getWeather: tool({
description: "Gets the current weather for a city.",
inputSchema: z.object({ city: z.string() }),
execute: async ({ city }) => ({ city, forecast: "sunny" }),
}),
};
const result = await generateText(
withKrino({ model: "anthropic/claude-haiku-4.5", tools, prompt: "Weather in Paris?", stopWhen: stepCountIs(5) }, krino),
);
console.log(result.text);
await krino.flushAll(DEFAULT_FLUSH_TIMEOUT_IN_MILLISECONDS);built to fail safe
- Tool selection fails open
- On a timeout, an error, or a low-confidence answer, your agent gets all its tools. The worst case is the cost you pay today.
- The risk gate fails closed
- When unsure, it suggests asking a human. Block lists in your code always win over the model.
- Tools change only at step 0
- A later change would break the prompt cache, so krino picks tools once and keeps that list.
- Traces stay on your machine
- Daily JSONL files, with no raw task text or messages by default. Costs count cache reads and writes.
krino is experimental and its APIs may change in any release. Read the limitations.