bots-garden/sidekickspublic Fork
⑂ feature/m4-agents-workspace
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
🛟 Updated. d580a32 · on feature/m4-agents-workspace · k33g · 3d ago
run-an-agent-in-docker.md · 60 lines · 3.0 KBmarkdown
Blame HistoryOpen raw

How to run an agent in a Docker container

This guide shows how to declare an agent that runs inside a Docker container, so that Sidekicks talks with it, shows its files and opens a terminal in it. It assumes Docker is installed and that you have an image containing the agent's program (for instance mm, built for Linux).

What Sidekicks needs

Three settings work together:

Setting Role
command and args how the agent is started: docker exec -i <container> <program> <arguments>. Sidekicks talks with it over stdin and stdout (ACP), so -i is required and -t must not be used.
workspace the agent's folder on this computer. The command is started there, and the agent receives this same path as the working folder of its sessions — so it must also exist at the same path inside the container.
runtime where its files and terminal are: {type: container, container: <container>}.

Steps

  1. Start the container with the agent's folder mounted at the same path, and an init process (it cleans up the programs the terminal ends):

    AGENT_DIR=/Users/me/agents/scout        # the agent's folder on this computer
    docker run -d --init --name scout-box \
      -v "$AGENT_DIR:$AGENT_DIR" -w "$AGENT_DIR" \
      my-agent-image sleep infinity
    
  2. Check that the program runs and sees the folder:

    docker exec scout-box sh -c 'command -v mm; pwd; ls'
    
  3. In Settings, add the agent and save:

    agents:
      - name: scout
        title: Scout (Docker)
        icon: "🐳"
        command: docker
        args: [exec, -i, scout-box, mm, -acp]
        workspace: /Users/me/agents/scout
        runtime:
          type: container
          container: scout-box
    
  4. Start the agent from the Agents panel (▶), or write to it: it answers from the container. 📂 shows container scout-box · /Users/me/agents/scout, its files and a terminal.

Variants

  • Sidekicks opened from the Finder: such an application gets a short PATH and may not find docker. Write its full path (command: /usr/local/bin/docker, see which docker), or add env: {PATH: "…"} to the agent. The files and the terminal find Docker by themselves.
  • The model server runs on this computer (llmman, Ollama…): inside the container, localhost is the container itself; use host.docker.internal in the agent's own configuration.
  • The folder is mounted elsewhere in the container: set runtime.workspacePath to that path for the files and the terminal. The agent's sessions still receive workspace as their working folder, so prefer the same path.
  • An existing container: any running container works, as long as it has the program and the folder; docker ps gives its name.

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
# How to run an agent in a Docker container

This guide shows how to declare an agent that runs inside a Docker container, so that Sidekicks talks with it, shows its files and opens a terminal in it. It assumes Docker is installed and that you have an image containing the agent's program (for instance `mm`, built for Linux).

## What Sidekicks needs

Three settings work together:

| Setting | Role |
| --- | --- |
| `command` and `args` | how the agent is started: `docker exec -i <container> <program> <arguments>`. Sidekicks talks with it over stdin and stdout (ACP), so `-i` is required and `-t` must not be used. |
| `workspace` | the agent's folder **on this computer**. The command is started there, and the agent receives this same path as the working folder of its sessions — so it must also exist **at the same path inside the container**. |
| `runtime` | where its files and terminal are: `{type: container, container: <container>}`. |

## Steps

1. Start the container with the agent's folder mounted at the same path, and an init process (it cleans up the programs the terminal ends):

   ```bash
   AGENT_DIR=/Users/me/agents/scout        # the agent's folder on this computer
   docker run -d --init --name scout-box \
     -v "$AGENT_DIR:$AGENT_DIR" -w "$AGENT_DIR" \
     my-agent-image sleep infinity
   ```

2. Check that the program runs and sees the folder:

   ```bash
   docker exec scout-box sh -c 'command -v mm; pwd; ls'
   ```

3. In **Settings**, add the agent and save:

   ```yaml
   agents:
     - name: scout
       title: Scout (Docker)
       icon: "🐳"
       command: docker
       args: [exec, -i, scout-box, mm, -acp]
       workspace: /Users/me/agents/scout
       runtime:
         type: container
         container: scout-box
   ```

4. Start the agent from the **Agents** panel (▶), or write to it: it answers from the container. **📂** shows `container scout-box · /Users/me/agents/scout`, its files and a terminal.

## Variants

- **Sidekicks opened from the Finder**: such an application gets a short `PATH` and may not find `docker`. Write its full path (`command: /usr/local/bin/docker`, see `which docker`), or add `env: {PATH: "…"}` to the agent. The files and the terminal find Docker by themselves.
- **The model server runs on this computer** (llmman, Ollama…): inside the container, `localhost` is the container itself; use `host.docker.internal` in the agent's own configuration.
- **The folder is mounted elsewhere in the container**: set `runtime.workspacePath` to that path for the files and the terminal. The agent's sessions still receive `workspace` as their working folder, so prefer the same path.
- **An existing container**: any running container works, as long as it has the program and the folder; `docker ps` gives its name.

## See also

- [How to work with an agent's files and terminal](work-with-an-agents-files.md)
- [How to run an agent in an sbx sandbox](run-an-agent-in-a-sandbox.md)
- [Reference: the configuration file](../reference/configuration.md) · [workspaces](../reference/agents-and-events.md#workspaces-milestone-m4)