Skip to content

Commit fb04f81

Browse files
dvdksnclaudecodex
authored
docs: document extending a built-in agent kit (#25748)
## Summary Keep the mixin and sandbox-kit overview sections conceptual and link them to canonical runnable examples. Update the built-in agent fork example to use `extends: claude`, inheriting Docker's full Claude integration while overriding only the entrypoint to use manual permission mode. @netlify /ai/sandboxes/customize/kits/ - [Preview the kits page](https://deploy-preview-25748--docsdocker.netlify.app/ai/sandboxes/customize/kits/) - [Preview the kit examples](https://deploy-preview-25748--docsdocker.netlify.app/ai/sandboxes/customize/kit-examples/) Closes docker/sbx-releases#150 Generated by Codex --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Codex <noreply@openai.com>
1 parent b8570c0 commit fb04f81

2 files changed

Lines changed: 23 additions & 130 deletions

File tree

content/manuals/ai/sandboxes/customize/kit-examples.md

Lines changed: 12 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -346,45 +346,28 @@ idempotent. The heredoc pattern overwrites cleanly each time.
346346
## Fork an existing agent
347347
348348
Sandbox kits (`kind: sandbox`) define a full agent from scratch. The most
349-
common variant is a fork of a built-in agent — same image and
350-
credentials, but a different entrypoint. This example reproduces the
351-
built-in `claude` agent but drops `--dangerously-skip-permissions` so
352-
every tool call prompts for approval:
349+
common variant is a fork of a built-in agent. Use `extends:` to inherit the
350+
parent's complete configuration and declare only the fields you want to change.
351+
This example replaces the built-in `claude` entrypoint so Claude Code uses
352+
manual permission mode instead of bypassing approval prompts:
353353

354354
```yaml {title="claude-safe/spec.yaml"}
355355
schemaVersion: "2"
356356
kind: sandbox
357357
name: claude-safe
358358
displayName: Claude Code (with approval prompts)
359-
description: Claude Code without --dangerously-skip-permissions
359+
description: Claude Code in manual permission mode
360+
361+
extends: claude
360362
361363
sandbox:
362-
image: "docker/sandbox-templates:claude-code-docker"
363-
entrypoint: [claude]
364-
365-
agentInstructions:
366-
filename: CLAUDE.md
367-
368-
permissions:
369-
network:
370-
allow:
371-
- "claude.com:443"
372-
- "api.anthropic.com:443"
373-
- "console.anthropic.com:443"
374-
375-
credentials:
376-
- service: anthropic
377-
apiKey:
378-
name: ANTHROPIC_API_KEY
379-
inject:
380-
- domain: api.anthropic.com
381-
header: x-api-key
382-
format: "%s"
383-
- domain: console.anthropic.com
384-
header: x-api-key
385-
format: "%s"
364+
entrypoint: [claude, "--permission-mode", "manual"]
386365
```
387366

367+
The child inherits the built-in image, credentials, network permissions,
368+
persistent volumes, settings, MCP integration, and agent instructions. Its
369+
`sandbox.entrypoint` replaces the inherited entrypoint.
370+
388371
Launch with the kit's `name:` as the agent argument to `sbx run`:
389372

390373
```console

content/manuals/ai/sandboxes/customize/kits.md

Lines changed: 11 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -264,62 +264,9 @@ cases:
264264
vendor API)
265265
- Inject shared team config (linter rules, editor settings, dotfiles)
266266
267-
### Example: Python linting kit
268-
269-
This kit installs [Ruff](https://docs.astral.sh/ruff/) and injects a shared
270-
configuration file, so every sandbox starts with the same linting setup.
271-
272-
```text
273-
ruff-lint/
274-
├── spec.yaml
275-
└── files/
276-
└── workspace/
277-
└── ruff.toml
278-
```
279-
280-
```yaml {title="ruff-lint/spec.yaml"}
281-
schemaVersion: "2"
282-
kind: mixin
283-
name: ruff-lint
284-
displayName: Ruff Linter
285-
description: Python linting with shared team config
286-
287-
permissions:
288-
network:
289-
allow:
290-
- pypi.org
291-
- files.pythonhosted.org
292-
293-
setup:
294-
install:
295-
- command: "uv tool install ruff@latest"
296-
user: "1000"
297-
description: Install Ruff
298-
```
299-
300-
```toml {title="ruff-lint/files/workspace/ruff.toml"}
301-
line-length = 100
302-
303-
[lint]
304-
select = ["E", "F", "I"]
305-
```
306-
307-
> [!TIP]
308-
> The templates for the built-in agents (`claude`, `codex`, and so on)
309-
> already include `uv`, so this mixin can use it without installing it
310-
> separately.
311-
312-
To start a new sandbox with this mixin:
313-
314-
```console
315-
$ sbx run claude --kit /path/to/ruff-lint/
316-
```
317-
318-
To apply the mixin to a sandbox that's already running, use
319-
[`sbx kit add`](#local) instead. The `--kit` flag only takes effect when a
320-
sandbox is created. `sbx kit add` restarts the sandbox to apply the kit, but VM
321-
state — installed packages, Docker images, volumes, and agent history — is
322-
preserved.
267+
See [Drop a shared config file](kit-examples.md#drop-a-shared-config-file) and
268+
[Install a tool at sandbox creation](kit-examples.md#install-a-tool-at-sandbox-creation)
269+
for complete mixin examples.
323270
324271
## Sandbox kits
325272
@@ -336,52 +283,15 @@ Sandbox kits declare everything a mixin kit can, plus an
336283
agent. For a step-by-step walkthrough, see
337284
[Build your own agent kit](build-an-agent.md).
338285

339-
### Example: the built-in `claude` agent
340-
341-
The `claude` agent you get from `sbx run claude` is defined as a kit. Here
342-
is an abbreviated version of its spec, showing how the sandbox block combines
343-
with network, credentials, environment, and setup:
344-
345-
```yaml {title="claude/spec.yaml"}
346-
schemaVersion: "2"
347-
kind: sandbox
348-
name: claude
349-
sandbox:
350-
image: "docker/sandbox-templates:claude-code-docker"
351-
entrypoint: [claude, "--dangerously-skip-permissions"]
352-
353-
agentInstructions:
354-
filename: CLAUDE.md
355-
356-
permissions:
357-
network:
358-
allow:
359-
- "claude.com:443"
360-
- "api.anthropic.com:443"
361-
- "console.anthropic.com:443"
362-
363-
credentials:
364-
- service: anthropic
365-
apiKey:
366-
name: ANTHROPIC_API_KEY
367-
inject:
368-
- domain: api.anthropic.com
369-
header: x-api-key
370-
format: "%s"
371-
- domain: console.anthropic.com
372-
header: x-api-key
373-
format: "%s"
286+
### Extend a built-in agent
374287

375-
environment:
376-
variables:
377-
IS_SANDBOX: "1"
378-
379-
setup:
380-
install:
381-
- command: "curl -fsSL https://claude.ai/install.sh | bash"
382-
user: "1000"
383-
description: Install Claude Code
384-
```
288+
Use `extends:` to create a variant of a built-in agent without reproducing its
289+
configuration. The child kit inherits the parent's image, credentials, network
290+
permissions, persistent volumes, settings, MCP integration, and agent
291+
instructions. Use `extends:` for a single parent agent; use a mixin to add an
292+
independent capability that can work with one or more agents. See
293+
[Fork an existing agent](kit-examples.md#fork-an-existing-agent) for an example
294+
that changes Claude Code's permission mode.
385295

386296
## Using kits
387297

0 commit comments

Comments
 (0)