Sandcastle is a TypeScript library that orchestrates AI coding agents inside isolated sandboxes. This page walks you through everything you need — from installing the package to running your first agent — so you reach a working state as quickly as possible.Documentation 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.
Prerequisites
Before you begin, make sure you have the following installed:- Git — Sandcastle uses git worktrees to manage branches
- A sandbox provider — Sandcastle needs an isolated environment to run the agent in:
- Docker Desktop — the most common choice for local development
- Podman — a rootless alternative to Docker
- Vercel — cloud-based Firecracker microVMs via
@vercel/sandbox
You only need one sandbox provider. Docker Desktop is the recommended starting point if you don’t have a preference.
Set up Sandcastle
Scaffold the config directory
Run This creates the following files:
sandcastle init to create the .sandcastle/ config directory. The command prompts you to choose a sandbox provider (Docker or Podman), a backlog manager (GitHub Issues or Beads), and a workflow template.Configure your API key
Copy the example env file and fill in your Open
ANTHROPIC_API_KEY..sandcastle/.env and set your key:Edit the prompt file
Open
.sandcastle/prompt.md and write the instructions you want the agent to follow. This file is passed directly to the agent at the start of each iteration.{{SOURCE_BRANCH}} and {{TARGET_BRANCH}} are built-in prompt arguments that Sandcastle injects automatically — you do not need to pass them via promptArgs.Minimal TypeScript example
The full.sandcastle/main.ts entry point that sandcastle init scaffolds is a thin wrapper around the run() function. Here is the minimal version:
run() returns a RunResult with the commits the agent made, the branch it worked on, and the number of iterations it completed:
Next steps
Key concepts
Understand sandboxes, agents, branch strategies, and how Sandcastle orchestrates them.
Sandbox providers
Configure Docker, Podman, or Vercel as your sandbox environment.
Prompts guide
Use prompt arguments, shell expressions, and built-in variables in your prompt files.
Branch strategies
Control how the agent’s commits land — directly on HEAD, a temp branch, or a named branch.