@agent-harness-experimental/adapter-claude-code
Adapter for running Claude Code
as an agent inside agent-harness-experimental.
Install
npm install agent-harness-experimental @agent-harness-experimental/adapter-claude-code
Usage
import { createAgentSession } from "agent-harness-experimental";
import { claudeCode } from "@agent-harness-experimental/adapter-claude-code";
const agent = createAgentSession({
adapter: claudeCode(),
});
const result = await agent.generate("Create a hello world Express server");
console.log(result.text);
await agent.close("stop");
Configuration
claudeCode({
// Claude model to use
model: "claude-sonnet-4",
// Maximum conversation turns
maxTurns: 20,
// Extended thinking mode
thinking: "adaptive", // or 'disabled' or { budgetTokens: 10000 }
// Reasoning effort level
effort: "high", // 'low' | 'medium' | 'high' | 'max'
});
| Option | Type | Default | Description |
|---|
model | string | — | Claude model ID |
maxTurns | number | — | Max conversation turns |
thinking | 'adaptive' | 'disabled' | { budgetTokens } | — | Extended thinking mode |
effort | 'low' | 'medium' | 'high' | 'max' | — | Reasoning effort |
auth | object | — | Optional per-adapter auth override (gateway or ) |
Sandbox runtime options such as template, timeoutMs, and httpHandler
belong on createAgentSession({ sandbox }).
const agent = createAgentSession({
adapter: claudeCode({ model: "claude-sonnet-4" }),
sandbox: {
template: "snap_abc123",
timeoutMs: 60000,
httpHandler: async (request: Request) => fetch(request),
},
});
Auth
auth is optional. If you omit it, Claude Code uses the shared ambient
gateway/OIDC fallback first: AI_GATEWAY_API_KEY, then VERCEL_OIDC_TOKEN.
claudeCode({
model: "claude-sonnet-4",
auth: {
anthropic: {
apiKey: { env: "ANTHROPIC_TEAM_B_API_KEY" },
},
},
});
Claude Code exposes standardized builtin names through agent-harness-experimental. The native runtime names are shown for reference:
| Tool | Native Tool | Description |
|---|
read | Read | Read file contents |
write | Write | Write content to a file |
edit | Edit | Edit a file by replacing text |
bash | Bash | Execute a shell command |
glob | Glob | Find files matching a glob pattern |
grep | Grep | Search file contents with regex |
Features
- Tool interception: Built-in tools can be intercepted for approval via the
permissions option on createAgentSession
- Skills: Written to
.claude/skills/{name}.md with YAML frontmatter
- Subagents: Full support for delegating to named subagents
- Token-level streaming: Real-time text and reasoning deltas
- Session resume: Persistent sandbox sessions across restarts