How to add a Gemini agent in an sbx sandbox
This guide shows how to add Gemini (Google's Gemini CLI, which speaks ACP itself with gemini --acp) as a Sidekicks agent that runs inside a Docker sandbox (sbx). Gemini 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 a Gemini API key. It follows the same steps as How to add a Claude agent in an sbx sandbox.
A ready-made example is in the repository: agents/snippets/gemini-acp.
A kit provided by a third party
The sandbox is built from the docker.io/sbx/gemini-kit kit. This kit is provided by a third party, not by Sidekicks: what it contains (Gemini CLI, at its latest version), 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 gemini --acp inside it. If the kit changes or disappears, the sandbox may no longer be created, or Gemini 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/gemini-acp |
holds the sandbox's sbxenv.yaml and the workspace/ folder Gemini works in. |
The docker.io/sbx/gemini-kit kit |
the sandbox's image, with the latest Gemini CLI. Docker marks this kit as deprecated in favour of its antigravity kit: it may disappear one day. |
| Your Gemini API key, stored in sbx | sbx adds it to Gemini's requests to Google: it is written neither in the sandbox nor in Sidekicks' configuration. |
With the assistant
-
Prepare the folder: copy
agents/snippets/gemini-acp(itssbxenv.yamlandworkspace/) to where the agent will live, e.g./Users/me/agents/gemini-acp. Changename:in thesbxenv.yamlif you want another sandbox name. -
Give your Gemini API key to sbx, under the name
google(thebindingsof thesbxenv.yaml):sbx secret set googleThe key is kept by sbx, on this computer, never in a file of the folder.
-
In the Agents panel, click + Add an agent. Fill in Name shown (
Gemini) and, if you like, an icon (📘). -
Where does it run? Choose In an sbx sandbox, then drop the
sbxenv.yamlon Recreate the sandbox when it is gone (optional) (or click Choose an sbxenv.yaml…). The sandbox, the agent's folder (…/workspace) and thesbx envcommands are filled in from it. -
Program:
geminiis chosen for you, fromagent: geminiin thesbxenv.yaml(otherwise choose it in the list; it is offered in an sbx sandbox only). Arguments is filled with--acp; with an older Gemini CLI, write--experimental-acpinstead. -
Click Add the agent, then start Gemini from the Agents panel (▶), or write to it. The first time, the Log tab shows
sandbox gemini-acp not found: creating it, then the kit being pulled — this can take a minute or two.
By hand
The sbxenv.yaml of the example:
schemaVersion: "1"
name: gemini-acp
agent: gemini
# Répertoire du projet, relatif à ce fichier.
workspace: ./workspace
# Gemini CLI parle ACP lui-même (gemini --acp) : pas d'adaptateur.
kits:
- docker.io/sbx/gemini-kit:latest
# Autorise l’injection de la clé Gemini (sbx secret set google) pour ces domaines.
bindings:
google:
apiKey:
domains:
- generativelanguage.googleapis.com
- aiplatform.googleapis.com
- vertexai.googleapis.com
oauth:
domains:
- accounts.google.com
- oauth2.googleapis.com
sandboxOptions:
pullPolicy: always
And the agent's entry, under agents: in Settings:
- name: gemini
title: Gemini
icon: "📘"
command: sbx
args: [exec, -i, gemini-acp, gemini, --acp]
workspace: /Users/me/agents/gemini-acp/workspace
runtime:
type: sbx
sandbox: gemini-acp
lifecycle:
folder: /Users/me/agents/gemini-acp
create: [sbx, env, create, --force]
stop: [sbx, stop, gemini-acp]
remove: [sbx, env, rm, --force]
workspace is the folder Gemini 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. The sandbox name must be the same in name:, args, runtime.sandbox and lifecycle.stop.
Check that it works
- Ask Gemini to write a file, e.g. "Write
notes/hello.mdwith a greeting". The file appears in the agent's Files tab (📂) and in/Users/me/agents/gemini-acp/workspaceon this computer. - When Gemini asks for permission to change a file or run a command, Sidekicks shows the request and waits for your answer.
- An authentication error in the Log tab: the key is not stored in sbx under the name
google. Store it again, then 🗑 Remove the sandbox and start the agent.
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 |
|