TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/mattpocock/sandcastle/llms.txt
Use this file to discover all available pages before exploring further.
claudeCode provider is the default agent provider for Sandcastle. It invokes Claude Code inside the sandbox using --print --output-format stream-json, streams the JSON output line by line, and automatically captures each session to your host after every iteration.
Import
Signature
Model strings
Pass any Claude model identifier as the first argument:Options
Reasoning effort level passed to Claude Code via
--effort. Higher effort levels give the agent more time to think before acting. The "max" level is only available on Opus models.Environment variables injected by this agent provider. Merged at launch time with env from the sandbox provider and any run-level
env option.When
false, session capture is disabled and no JSONL files are written to the host. See session capture below.Required environment variable
Claude Code requiresANTHROPIC_API_KEY to be set. Add it to .sandcastle/.env before running any agent:
.sandcastle/.env is listed in .sandcastle/.gitignore by default. Do not commit it.Session capture
After each iteration, Sandcastle automatically copies the Claude Code session JSONL from the sandbox to your host at:cwd fields inside each JSONL entry are rewritten to match your host repo root, so claude --resume works natively without path adjustments.
Session capture is enabled by default. To opt out, pass captureSessions: false:
IterationResult exposes the captured file path and parsed token usage:
Session resume
PassresumeSession to run() to continue a prior Claude Code conversation inside a new sandbox. Sandcastle validates the session file exists on the host, rewrites its cwd fields to match the sandbox-side path, and passes --resume <id> to Claude Code on the first iteration.
Constraints
resumeSessionis incompatible withmaxIterations > 1. Sandcastle throws before sandbox creation if both are set.- The session file must exist at
~/.claude/projects/<encoded-path>/sessions/<id>.jsonl. If it does not exist, Sandcastle throws before sandbox creation. - Only the first iteration receives the
--resumeflag. Any subsequent iterations start fresh. - Non-Claude agent providers ignore
resumeSession.