adding-an-agent-provider

adding-an-agent-provider is an agent for coding agents from mattpocock/sandcastle. It costs 0 tokens per session (3,310 once invoked), scanned A, original, MIT.

A contributor guide for adding a new coding agent, such as Claude Code or Codex, as a built-in provider in Sandcastle. It explains the checks and code changes needed to support the agent's command-line interface.

In plain words
What is it for?
Evaluating whether an agent can be supported, implementing the provider interface, updating setup commands, and completing the integration checklist.
Why use it?
It turns an unfamiliar integration into a defined checklist, including unattended runs, prompt input, and automatic approval inside a sandbox, which is an isolated environment.

Agent

About the project

Sandcastle is a TypeScript library that runs AI coding agents inside isolated sandboxes and merges their branch changes back into a project. It is used to run agents in parallel, build review pipelines, or coordinate agent work through providers such as Docker, Podman, or Vercel.

mattpocock/sandcastle · 7,830 stars · on GitHub

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/mattpocock/sandcastle/adding-an-agent-provider
Clone the repo
git clone --depth 1 https://github.com/mattpocock/sandcastle

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for adding-an-agent-provider

README.md
[![agentmods](https://agentmods.dev/badge/agents/mattpocock/sandcastle/adding-an-agent-provider.svg)](https://agentmods.dev/agents/mattpocock/sandcastle/adding-an-agent-provider)
Your own site
<a href="https://agentmods.dev/agents/mattpocock/sandcastle/adding-an-agent-provider"><img src="https://agentmods.dev/badge/agents/mattpocock/sandcastle/adding-an-agent-provider.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,310 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.03310
Opus 5 $0.00000 $0.01655
Sonnet 5 $0.00000 $0.00662
Haiku 4.5 $0.00000 $0.00331

Measured 5d ago against content hash e0a8673e7108, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

adding-an-agent-provider scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

docs/agents/adding-an-agent-provider.md · 175 lines

How it starts

The opening of the file, as written. The whole thing — 175 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Adding an agent provider

This document is for contributors adding support for a new agent (e.g. Claude Code, Codex, gemini-cli) as a built-in agent provider. It covers:

  1. Evaluating a new agent — the questionnaire used to decide whether an agent's CLI can be supported.
  2. The AgentProvider interface — what you implement.
  3. Scaffold integration — what sandcastle init needs to offer the agent.
  4. Implementation checklist — every file to touch.

For terminology (agent, agent provider, sandbox, etc.), see CONTEXT.md.

Evaluating a new agent

Before implementing, confirm the agent's CLI satisfies the must-haves below. If a must-have is missing, the agent likely cannot be supported until its CLI changes.

Must-have CLI capabilities

  • Non-interactive run mode. A flag (often --print, exec, run) that takes a prompt, runs the agent to completion, and exits. Without this, Sandcastle cannot drive the agent unattended.
  • Prompt input via argv or stdin. stdin is strongly preferred — Linux caps argv at ~128 KB, which large prompts blow past.
  • Auto-approval / bypass-permissions flag. The agent runs inside a sandbox, so any "are you sure?" prompts will hang it. Examples: Claude Code's --dangerously-skip-permissions, Codex's --dangerously-bypass-approvals-and-sandbox.
  • Model selection. A flag that picks the model (e.g. --model, -m).
  • Env-based authentication. Auth via environment variables (API key) — no interactive login required at first run.
  • Exit codes reflect success/failure. Non-zero on error so the orchestrator can detect failures.

Must-have output capabilities

  • Streaming output. The CLI must stream output to stdout as the agent runs; we surface it live in Display.
  • Structured (JSON) stream events. Required — line-delimited JSON (one event per line). This is what parseStreamLine in AgentProvider.ts consumes; without it, tool calls and partial text cannot render in the UI.

Read the full file on GitHub · 175 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 175 lines · 0 tokens per session scan A e0a8673e7108

Subscribe to this mod's changes

adding-an-agent-provider is an agent published in the GitHub repository mattpocock/sandcastle (7,830 stars, last pushed 2mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 3,310 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.