Skip to content
Integrations
Integrations

Anthropic — Claude Code

Spawn Anthropic's Claude Code from inside agent loops with budget caps, schema-bound output, and the official claude_agent_sdk.

Spawn Anthropic's Claude Code from inside agent loops. The Python harness uses the official claude_agent_sdk package directly, so plan-mode reasoning and multi-turn refactors run with no CLI sitting in your container.

Reach for Claude Code when the work needs careful reasoning — code reviews, surgical refactors, multi-step planning, or anything that benefits from the agent thinking before it edits.

Quickstart

Install the official Claude SDK alongside AgentField. The TypeScript and Go harnesses drive the claude CLI as a subprocess, so install that path instead if you're not on Python.

Call the harness

Attach a HarnessConfig to the agent so every .harness(...) call inherits sensible defaults — provider, model, budget, permission mode — without re-specifying them. Override per call when a specific task needs something different.

Composition pattern — plan-then-implement

Claude Code is a strong planner. Pair it with a faster implementer like Codex for the actual edits — same loop, one field flipped.

Options

OptionTypeDefaultWhat it does
providerstringrequired"claude-code" for this provider.
modelstring"sonnet"Any model alias the claude_agent_sdk accepts ("sonnet", "opus", "haiku").
permission_modestringnull"plan" (plan-first, then execute) or "auto" (bypass permissions). Maps to bypassPermissions on the SDK.
toolsstring[]["Read","Write","Edit","Bash","Glob","Grep"]Allowed tool names — gates what Claude Code is allowed to invoke.
max_turnsint30Hard cap on agent iterations.
max_budget_usdfloatnullCost ceiling. The SDK aborts when total spend would exceed this.
system_promptstringnullCustom system prompt prepended to the loop.
envdict{}Extra environment variables forwarded to the subprocess.
cwdstringworking dirWorking directory the agent treats as the repository root.
schemamodelnullPydantic class / Zod schema / Go struct. Forces JSON output validated against the schema.

Authentication

  • Set ANTHROPIC_API_KEY in the harness's environment. The SDK picks it up automatically; you do not need to pass it through app.harness.
  • For Anthropic Vertex or Bedrock routing, follow the official claude_agent_sdk configuration.

When to choose Claude Code

  • Code review and audits — plan mode lets the agent enumerate findings before changing any files.
  • Multi-turn refactors where intermediate reasoning matters more than throughput.
  • Surgical edits in a known codebase — Claude excels at minimal, targeted diffs.
  • Reasoning-heavy tasks where stepping through the problem beats brute iteration.

Pairs well with

  • Codex — Claude reviews, Codex implements. Run them in sequence.
  • Gemini CLI — let Gemini ingest the whole repo first, then hand findings to Claude for surgical edits.
  • OpenCode — adversarial pattern: Claude proposes, an open-weight OpenCode loop verifies.

See also