bots-garden/sidekickspublic Fork
⑂ main
Commits
⬇ Clone ▾
git clone https://git.rickub.com/bots-garden/sidekicks.git
git clone ssh://git@rickub.com/bots-garden/sidekicks.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP
add-a-claude-agent-in-a-sandbox.md · 117 lines · 6.9 KBmarkdown
Blame HistoryOpen raw

How to add a Claude agent in an sbx sandbox

This guide shows how to add Claude (Claude Code, through its ACP adapter claude-agent-acp) as a Sidekicks agent that runs inside a Docker sandbox (sbx). Claude then works in its own folder, isolated from the rest of your computer, and Sidekicks shows its files and a terminal like for any other agent. It assumes sbx is installed and that you have an Anthropic API key.

A ready-made example is in the repository: agents/snippets/claude-acp.

A kit provided by a third party

The sandbox is built from the docker.io/sbx/claude-acp kit. This kit is provided by a third party, not by Sidekicks: what it contains (Claude Code, claude-agent-acp), its updates (the sandbox pulls latest each time it is created) and whether it stays available depend on that third party. Sidekicks only creates the sandbox from the sbxenv.yaml that names it and starts claude-agent-acp inside it. If the kit changes or disappears, the sandbox may no longer be created, or Claude may no longer start: the Log tab then shows what sbx said.

What you need

Role
A folder for the agent, e.g. /Users/me/agents/claude-acp holds the sandbox's sbxenv.yaml and the workspace/ folder Claude works in.
The docker.io/sbx/claude-acp kit the sandbox's image, with Claude Code and claude-agent-acp installed.
Your Anthropic API key, stored in sbx sbx adds it to Claude's requests to Anthropic: it is written neither in the sandbox nor in Sidekicks' configuration.

The simplest way: with the assistant

  1. Prepare the folder: copy agents/snippets/claude-acp (its sbxenv.yaml and workspace/) to where the agent will live, e.g. /Users/me/agents/claude-acp, or write them as in steps 1 and 2 below. Change name: in the sbxenv.yaml if you want another sandbox name.
  2. Give your Anthropic API key to sbx (step 3 below).
  3. In the Agents panel, click + Add an agent. Fill in Name shown (Claude) and, if you like, an icon (📙).
  4. Where does it run? Choose In an sbx sandbox, then drop the sbxenv.yaml on Recreate the sandbox when it is gone (optional) (or click Choose an sbxenv.yaml…). The sandbox, the agent's folder (…/workspace) and the sbx env commands are filled in from it.
  5. Program: claude-agent-acp is chosen for you, from agent: claude in the sbxenv.yaml (otherwise choose it in the list; it is offered in an sbx sandbox only). Leave Arguments empty.
  6. Click Add the agent, then start Claude (step 5 below).

By hand

The same result, step by step — or to adapt an existing sandbox.

  1. Create the agent's folder with an empty workspace/ inside:

    mkdir -p /Users/me/agents/claude-acp/workspace
    
  2. Write the sandbox's sbxenv.yaml in /Users/me/agents/claude-acp:

    schemaVersion: "1"
    
    name: claude-acp
    agent: claude
    
    # The folder Claude works in, relative to this file.
    workspace: ./workspace
    
    kits:
      - docker.io/sbx/claude-acp:latest
    
    # sbx injects the Anthropic key into the requests to these domains.
    bindings:
      anthropic:
        apiKey:
          domains:
            - api.anthropic.com
            - console.anthropic.com
    
    sandboxOptions:
      pullPolicy: always
    

    name is the name of the sandbox: Sidekicks uses the same one.

  3. Give your Anthropic API key to sbx, so that it can inject it (the bindings above). The key is kept by sbx, on this computer, never in a file of the folder. See sbx secret --help for the exact command of your sbx version.

  4. Add the agent with the assistant: in the Agents panel, click + Add an agent, then:

    1. Title Claude, an icon if you like (📙).
    2. Where does it run? In an sbx sandbox.
    3. Drop /Users/me/agents/claude-acp/sbxenv.yaml on the Recreate the sandbox when it is gone (optional) area (or click Choose an sbxenv.yaml…). The sandbox (claude-acp), the agent's folder (/Users/me/agents/claude-acp/workspace) and the sbx env commands are filled in.
    4. Program: type claude-agent-acp. Leave Arguments empty.
    5. Click Add the agent.

    Or in Settings, add this entry under agents: and save:

      - name: claude
        title: Claude
        icon: "📙"
        command: sbx
        args: [exec, -i, claude-acp, claude-agent-acp]
        workspace: /Users/me/agents/claude-acp/workspace
        runtime:
          type: sbx
          sandbox: claude-acp
          lifecycle:
            folder: /Users/me/agents/claude-acp
            create: [sbx, env, create, --force]
            stop: [sbx, stop, claude-acp]
            remove: [sbx, env, rm, --force]
    

    workspace is the folder Claude works in, on this computer; sbx shares it with the sandbox at the same path. lifecycle.folder is the folder of the sbxenv.yaml, where the sbx env commands run.

  5. Start Claude from the Agents panel (▶), or write to it. The first time, the sandbox does not exist yet: the Log tab shows sandbox claude-acp not found: creating it, then the kit being pulled — this can take a minute or two. Then Claude answers.

Check that it works

  • Ask Claude to write a file, e.g. "Write notes/hello.md with a greeting". The file appears in the agent's Files tab (📂) and in /Users/me/agents/claude-acp/workspace on this computer.
  • In the Terminal tab, ls shows the same folder, from inside the sandbox.
  • When Claude asks for permission to change a file or run a command, Sidekicks shows the request and waits for your answer.

Variants

  • Another name for the sandbox: change name: in the sbxenv.yaml and, in the agent's entry, the sandbox name in args, runtime.sandbox and lifecycle.stop. All of them must be the same.
  • Several Claude agents: one folder, one sbxenv.yaml and one sandbox name each, and a different name for each agent (claude, claude-docs…).
  • Claude answers with an authentication error (see the Log tab): the key is not stored in sbx, or not where the bindings expect it. Store it again, then 🗑 Remove the sandbox and start the agent: the sandbox is created again with the key.
  • Sidekicks opened from the Finder does not find sbx: write its full path in command (see which sbx), as in How to run an agent in an sbx sandbox.
  • Start from scratch: 🗑 Remove the sandbox in the agent's header removes it; the files of workspace/ stay on this computer.

See also

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# How to add a Claude agent in an sbx sandbox

This guide shows how to add Claude (Claude Code, through its ACP adapter `claude-agent-acp`) as a Sidekicks agent that runs inside a Docker sandbox (`sbx`). Claude then works in its own folder, isolated from the rest of your computer, and Sidekicks shows its files and a terminal like for any other agent. It assumes `sbx` is installed and that you have an Anthropic API key.

A ready-made example is in the repository: [`agents/snippets/claude-acp`](../../../agents/snippets/claude-acp/README.md).

## A kit provided by a third party

The sandbox is built from the `docker.io/sbx/claude-acp` kit. This kit is provided by a third party, **not by Sidekicks**: what it contains (Claude Code, `claude-agent-acp`), its updates (the sandbox pulls `latest` each time it is created) and whether it stays available depend on that third party. Sidekicks only creates the sandbox from the `sbxenv.yaml` that names it and starts `claude-agent-acp` inside it. If the kit changes or disappears, the sandbox may no longer be created, or Claude may no longer start: the **Log** tab then shows what sbx said.

## What you need

| | Role |
| --- | --- |
| A folder for the agent, e.g. `/Users/me/agents/claude-acp` | holds the sandbox's `sbxenv.yaml` and the `workspace/` folder Claude works in. |
| The `docker.io/sbx/claude-acp` kit | the sandbox's image, with Claude Code and `claude-agent-acp` installed. |
| Your Anthropic API key, stored in sbx | sbx adds it to Claude's requests to Anthropic: it is written neither in the sandbox nor in Sidekicks' configuration. |

## The simplest way: with the assistant

1. **Prepare the folder**: copy [`agents/snippets/claude-acp`](../../../agents/snippets/claude-acp/) (its `sbxenv.yaml` and `workspace/`) to where the agent will live, e.g. `/Users/me/agents/claude-acp`, or write them as in steps 1 and 2 below. Change `name:` in the `sbxenv.yaml` if you want another sandbox name.
2. **Give your Anthropic API key to sbx** (step 3 below).
3. In the **Agents** panel, click **+ Add an agent**. Fill in **Name shown** (`Claude`) and, if you like, an icon (📙).
4. **Where does it run?** Choose **In an sbx sandbox**, then drop the `sbxenv.yaml` on **Recreate the sandbox when it is gone (optional)** (or click **Choose an sbxenv.yaml…**). The sandbox, the agent's folder (`…/workspace`) and the `sbx env` commands are filled in from it.
5. **Program**: `claude-agent-acp` is chosen for you, from `agent: claude` in the `sbxenv.yaml` (otherwise choose it in the list; it is offered in an sbx sandbox only). Leave **Arguments** empty.
6. Click **Add the agent**, then start Claude (step 5 below).

## By hand

The same result, step by step — or to adapt an existing sandbox.

1. **Create the agent's folder** with an empty `workspace/` inside:

   ```bash
   mkdir -p /Users/me/agents/claude-acp/workspace
   ```

2. **Write the sandbox's `sbxenv.yaml`** in `/Users/me/agents/claude-acp`:

   ```yaml
   schemaVersion: "1"

   name: claude-acp
   agent: claude

   # The folder Claude works in, relative to this file.
   workspace: ./workspace

   kits:
     - docker.io/sbx/claude-acp:latest

   # sbx injects the Anthropic key into the requests to these domains.
   bindings:
     anthropic:
       apiKey:
         domains:
           - api.anthropic.com
           - console.anthropic.com

   sandboxOptions:
     pullPolicy: always
   ```

   `name` is the name of the sandbox: Sidekicks uses the same one.

3. **Give your Anthropic API key to sbx**, so that it can inject it (the `bindings` above). The key is kept by sbx, on this computer, never in a file of the folder. See `sbx secret --help` for the exact command of your sbx version.

4. **Add the agent with the assistant**: in the **Agents** panel, click **+ Add an agent**, then:
   1. Title `Claude`, an icon if you like (📙).
   2. **Where does it run?** **In an sbx sandbox**.
   3. Drop `/Users/me/agents/claude-acp/sbxenv.yaml` on the **Recreate the sandbox when it is gone (optional)** area (or click **Choose an sbxenv.yaml…**). The sandbox (`claude-acp`), the agent's folder (`/Users/me/agents/claude-acp/workspace`) and the `sbx env` commands are filled in.
   4. **Program**: type `claude-agent-acp`. Leave **Arguments** empty.
   5. Click **Add the agent**.

   Or **in Settings**, add this entry under `agents:` and save:

   ```yaml
     - name: claude
       title: Claude
       icon: "📙"
       command: sbx
       args: [exec, -i, claude-acp, claude-agent-acp]
       workspace: /Users/me/agents/claude-acp/workspace
       runtime:
         type: sbx
         sandbox: claude-acp
         lifecycle:
           folder: /Users/me/agents/claude-acp
           create: [sbx, env, create, --force]
           stop: [sbx, stop, claude-acp]
           remove: [sbx, env, rm, --force]
   ```

   `workspace` is the folder Claude works in, on this computer; sbx shares it with the sandbox at the same path. `lifecycle.folder` is the folder of the `sbxenv.yaml`, where the `sbx env` commands run.

5. **Start Claude** from the **Agents** panel (▶), or write to it. The first time, the sandbox does not exist yet: the **Log** tab shows `sandbox claude-acp not found: creating it`, then the kit being pulled — this can take a minute or two. Then Claude answers.

## Check that it works

- Ask Claude to write a file, e.g. "Write `notes/hello.md` with a greeting". The file appears in the agent's **Files** tab (📂) and in `/Users/me/agents/claude-acp/workspace` on this computer.
- In the **Terminal** tab, `ls` shows the same folder, from inside the sandbox.
- When Claude asks for permission to change a file or run a command, Sidekicks shows the request and waits for your answer.

## Variants

- **Another name for the sandbox**: change `name:` in the `sbxenv.yaml` and, in the agent's entry, the sandbox name in `args`, `runtime.sandbox` and `lifecycle.stop`. All of them must be the same.
- **Several Claude agents**: one folder, one `sbxenv.yaml` and one sandbox name each, and a different `name` for each agent (`claude`, `claude-docs`…).
- **Claude answers with an authentication error** (see the **Log** tab): the key is not stored in sbx, or not where the `bindings` expect it. Store it again, then **🗑 Remove the sandbox** and start the agent: the sandbox is created again with the key.
- **Sidekicks opened from the Finder does not find `sbx`**: write its full path in `command` (see `which sbx`), as in [How to run an agent in an sbx sandbox](run-an-agent-in-a-sandbox.md#variants).
- **Start from scratch**: **🗑 Remove the sandbox** in the agent's header removes it; the files of `workspace/` stay on this computer.

## See also

- [How to run an agent in an sbx sandbox](run-an-agent-in-a-sandbox.md)
- [How to add an agent](add-an-agent.md)
- [How to work with an agent's files and terminal](work-with-an-agents-files.md)
- [Reference: `runtime.lifecycle`](../reference/configuration.md#runtimelifecycle-container-and-sbx)