Caveman Agent SDK· Open sourceAgent SDK & Harness v4
Caveman Agent SDK: Build Production Agents on Harness v4
Install @caveman-ai/agent to define, gate, evaluate, and run AI agents in-process on the open-source Harness v4 engine or deploy the exact same definition to Caveman Cloud.
@caveman-ai/agent (caveman-ai/agent-sdk, Apache-2.0) is the TypeScript Agent SDK built directly on the open-source Harness v4 engine (@caveman-ai/harness). Run an agent in-process with Node.js 22+ and your own Anthropic or OpenAI key (zero daemon, no account required), or run the exact same definition on Caveman Cloud with durable zero-compute parking.
Want to deploy an AGENT.md template straight from the CLI with zero TypeScript setup? Go to Templates & Quick Setups.
Install or scaffold a project#
# Add to an existing project (Node.js 22+)
npm install @caveman-ai/agent
# Or scaffold a starter project
npm create @caveman-ai/agentRun an agent in-process (zero daemon, no account)#
Set ANTHROPIC_API_KEY or OPENAI_API_KEY and run:
import { defineAgent, runInProcess, tool } from "@caveman-ai/agent";
const lookupInvoice = tool(
"lookup_invoice",
"Find an invoice by id",
{ type: "object", properties: { id: { type: "string" } }, required: ["id"] },
async ({ id }: { id: string }) => ({ id, status: "paid", amountUsd: 42 }),
);
const billing = defineAgent({
name: "billing",
instructions: "Answer billing questions briefly using lookup_invoice.",
computer: "none",
tools: [lookupInvoice],
});
const result = await runInProcess({
agent: billing,
task: "Check invoice 4411",
model: "anthropic/claude-sonnet-4-6",
});
console.log(result.text);
console.log(result.usage);Run the exact same definition on Caveman Cloud#
Pass your Caveman Cloud API key to new Caveman(...) to run durable sessions with zero-compute parking, event logs, and Cloud sandboxes:
import { Caveman } from "@caveman-ai/agent";
const cave = new Caveman({ apiKey: process.env.CAVEMAN_API_KEY });
const result = await cave.run({
agent: "billing",
task: "Check invoice 4411",
budget: { usd: 1 },
});
console.log(result.text);Package ecosystem#
Explore the Agent SDK#
Model-native tool surfaces, QuickJS with_mcp code mode, 270 s cache keepalive, and execution environments.
Multi-turn streaming sessions, fail-closed Caveman Gates, Sensors, and cheap-first model escalation.
30 fail-closed graders, Session Protocol v1 schemas, and the 5 verified starter recipes.
Compile identical deterministic agent.json manifests from folders or TypeScript.