The Claude Code adapter is the most used adapter in Company Agents. Claude Code is Anthropic’s interactive agent CLI with a mature tool-calling loop, and pairing it with the orchestrator gives you a task queue, budgets, memory scopes, and audit trail on top of what Claude Code already does well.

Prerequisites

  • Claude Code installed and on your PATH as claude. Install instructions at claude.com/claude-code.
  • An Anthropic API key exported as ANTHROPIC_API_KEY, or sign into Claude Code once with claude so the adapter can reuse your session.
  • Company Agents orchestrator running and the MCP server reachable at http://localhost:4200.
Verify:
claude --version
# => claude-code 1.x.x

curl http://localhost:4200/healthz
# => { "ok": true }

Hiring a Claude Code agent

In the dashboard: Agents → Hire → Claude Code. Fill in the form:
  • Name — what this agent is called in your company
  • Role — the team role (IC engineer, head of design, etc.)
  • Team — the team they belong to
  • Model — the Anthropic model to use (claude-sonnet-4-6 by default; pick another for specific tasks)
  • Budget policy — per-task and daily ceilings
  • Approval policy — which actions require a human yes
From the CLI:
company-agents agent hire \
  --adapter claude-code \
  --name "Senior Engineer" \
  --role ic-engineer \
  --team engineering \
  --model claude-sonnet-4-6 \
  --task-budget 2.50 \
  --approvals "push-to-main,prod-deploy"
The agent is now on the roster and can be assigned tasks from any workflow.

What the adapter does at run time

When the orchestrator assigns a task to the agent, the adapter:
  1. Creates the workspace under ~/.company-agents/instances/default/runs/{run-id}/
  2. Writes the agent’s role files (AGENTS.md, TOOLS.md, MEMORY.md) into .company-agents/agent/ inside the workspace
  3. Launches the claude binary with the workspace as cwd, passing the lease token and MCP server URL in the environment
  4. Pipes Claude Code’s stdout/stderr into the orchestrator’s log collector
  5. Parses Claude Code’s structured tool-call events and relays them through the MCP server
  6. Renews the lease on the configured cadence
  7. On Claude Code’s normal exit, reads the final progress report and calls mark_complete or mark_failed
  8. On any other exit (crash, kill, timeout), tears down the process group and releases the lease

Environment variables

The adapter reads these from the orchestrator’s environment:
VariablePurpose
ANTHROPIC_API_KEYAuth for Claude Code
CLAUDE_CODE_BINBinary name (default claude)
CLAUDE_CODE_MODELDefault model if the agent didn’t pick one
CLAUDE_CODE_EXTRA_ARGSExtra args passed verbatim to claude
And sets these inside the Claude Code process’s environment:
VariablePurpose
MCP_SERVER_URLWhere Claude Code can reach the MCP server
CA_LEASE_TOKENThe current lease token
CA_FENCING_TOKENThe fencing token for this run
CA_TASK_IDThe task being worked on
CA_RUN_IDThe run identifier
Claude Code’s own env vars (ANTHROPIC_API_KEY, etc.) are passed through as well.

MCP tools

Claude Code is configured with an MCP server on every run, which gives it access to the orchestrator’s tool set:
  • read_task / update_task
  • report_progress
  • post_comment
  • request_approval
  • delegate_subtask
  • mark_complete / mark_failed
  • read_memory / write_memory / promote_memory
  • get_budget / report_cost
  • request_human_help
The exact tool list depends on the agent’s policy; tools the agent is not authorized to call are filtered out of the MCP registration before Claude Code starts.

Cost accounting

Claude Code reports token counts in its tool-call events, and the adapter forwards those to the orchestrator’s cost layer after applying the current pricing table. The dashboard shows the run’s token spend in real time while the agent runs. If you use a proxy like OpenRouter via LLM_BASE_URL, the adapter still captures the tokens from Claude Code’s events; pricing is based on the model name, not on the provider.

Known quirks

  • Context compaction: Claude Code compacts its own context when it gets long. The compaction step is its own LLM call and is counted toward the task budget. The adapter’s progress report includes a compacted flag so the reviewer can see when compaction happened.
  • Auto-accept vs. ask: Claude Code has its own auto-accept setting for tool calls. The adapter forces auto-accept off for any tool tagged requires_approval in the agent’s policy, so the orchestrator’s approval flow always wins.
  • /bash in the workspace: Claude Code’s bash tool runs inside the workspace, which is what you want. The adapter confines it to the workspace via the filesystem sandbox runtime service.

Debugging

  • Agent not starting: check that claude --version works as the user running the orchestrator. The adapter does not escalate privileges.
  • “Lease expired” in logs: the task took longer than the lease window and the renewal failed. Check MCP server reachability and the orchestrator log.
  • Tool calls rejected: check the agent’s policy against the tool being called. A permission_denied error is almost always a policy mismatch.

Next