Skip to content

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/agent

Run 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#

PackageLicensePurpose
@caveman-ai/agentApache-2.0defineAgent, tool, runInProcess, Caveman, Session, compileAgentFolder, Caveman Gates, Sensors, plus @caveman-ai/agent/harness
@caveman-ai/harnessApache-2.0Open-source Harness v4 engine (HarnessSession, model-native loadouts, LocalEnv, DockerEnv, SandboxEnv, QuickJS code-mode MCP)
@caveman-ai/protocolMITCanonical SessionEvent, UserEvent, exit codes 0..6, and JSON Schemas (agent-build.schema.json, eval-file.schema.json)
@caveman-ai/evalsMIT30 fail-closed TypeScript graders (deterministic checks, tool-call checks, BLEU/ROUGE, SSRF-pinned webhooks, bias-guarded judges)
caveman-evals (Python)MITPython eval runner and grader parity
@caveman-ai/reactApache-2.0React hooks for streaming sessions and approval UIs
@caveman-ai/adapter-kitApache-2.0Adapter interfaces for bringing external frameworks onto the Caveman protocol
@caveman-ai/create-agentApache-2.0Project scaffolder (npm create @caveman-ai/agent)

Explore the Agent SDK#

Harness v4 Engine

Model-native tool surfaces, QuickJS with_mcp code mode, 270 s cache keepalive, and execution environments.

Sessions, Gates & Escalation

Multi-turn streaming sessions, fail-closed Caveman Gates, Sensors, and cheap-first model escalation.

Evals, Graders & Protocol

30 fail-closed graders, Session Protocol v1 schemas, and the 5 verified starter recipes.

AGENT.md Format

Compile identical deterministic agent.json manifests from folders or TypeScript.

Esc

Start here