Coding agents are most useful when you let them work without stopping to ask for approval at every step. But on your laptop, that same freedom means the agent can read your SSH keys, touch any folder, and call any host on the internet.
The new antigravity-kit solves this by moving the agent into a microVM. Inside the sandbox, the agy agent has its permissions pre-approved, so it can work at full speed. Outside the sandbox, your machine stays out of reach. You can sign in with your Google account or use a Gemini API key, and in both cases the kit controls where traffic is allowed to go.
This post walks through what the kit is, how it works under the hood, and how to use it.
What is Google Antigravity?
Antigravity is Google’s agent-first development platform. Its terminal agent is the Antigravity CLI, which you run as agy. It replaced Gemini CLI, which Google retired in June 2026, and it still reads its configuration from ~/.gemini/ (Real Python).
A few things about agy matter for this post:
- It ships as one binary. No Node.js runtime is needed. You install it with
curl -fsSL https://antigravity.google/cli/install.sh | bash. - It has two ways to sign in. Google OAuth opens a browser so you can pick your Google account. API-key mode reads
GEMINI_API_KEY, but only whenmodelProvideris set to"gemini"insettings.json(cheat sheet). - It asks before it acts. By default,
agyasks for approval before running shell commands. The--dangerously-skip-permissionsflag approves every tool request for the session. - It speaks MCP. It loads MCP servers from
~/.gemini/config/mcp_config.json(user level) or.agents/mcp_config.json(workspace level).
That third point is the core tension. Approval prompts keep you safe, but they also keep you at the keyboard. Skipping them on your host machine is a real risk. Docker Sandboxes removes the need to choose.
What are Docker Sandboxes and kits?
Docker Sandboxes run AI coding agents in isolated microVMs, either on your machine or on Docker-managed cloud infrastructure. You drive them with sbx, a standalone CLI (reference).
Each sandbox gives the agent three things:
- Its own VM. The agent sees your project folder and nothing else from your host. Its home directory persists between runs.
- A network proxy. Outbound traffic goes through a proxy that only allows the hosts the policy lists.
- Proxy-managed credentials. You store secrets on the host with
sbx secret set. Inside the sandbox, the agent sees a placeholder value. The proxy swaps in the real secret only on requests to the domains you approve.
A kit is a package that teaches a sandbox how to run a specific agent or tool. It is a folder with a spec.yaml (and often a Dockerfile) that declares the image, the start command, the credentials, the network allow list and any setup scripts. Kits can be loaded from a local folder, a Git repo or an OCI registry such as Docker Hub. Community kits live in docker/sbx-kits-contrib, which is where the antigravity-kit comes from.
Inside the kit: how it works
The whole kit is four files: spec.yaml, a Dockerfile, a README and a small test file. Let’s walk through what each part does. All snippets below come from the kit source.

Your project folder is mounted into the VM and the real key stays on the host. Every request from agy passes through the proxy, which only lets allow-listed Google hosts through.
1. The image
The image starts from Docker’s shell-docker sandbox template and installs agy with Google’s official script. The installer picks the current release and checks its published checksum.
ARG BASE_IMAGE=docker/sandbox-templates:shell-docker
FROM ${BASE_IMAGE}
USER agent
RUN curl -fsSL https://antigravity.google/cli/install.sh -o /tmp/install-antigravity.sh && \
bash /tmp/install-antigravity.sh --dir /home/agent/.local/bin && \
rm -f /tmp/install-antigravity.sh && \
agy --help >/dev/null
LABEL com.docker.sandboxes.start-docker="true"
CMD ["agy", "--dangerously-skip-permissions"]
Two details are worth noting. The binary installs as the non-root agent user. The start-docker label means the agent also gets its own Docker daemon inside the VM, so it can build and run containers without touching your host Docker.
2. Permissions pre-approved, on purpose
sandbox:
image: docker.io/sbx/antigravity-image:latest
entrypoint:
- agy
command:
default:
- --dangerously-skip-permissions
On a laptop, --dangerously-skip-permissions is a flag you think twice about. Inside a sandbox, it is the right default. The VM boundary and the network proxy now do the job the approval prompts used to do. So agy can edit files, run tests and install packages without stopping to ask.
3. A tight network allow list
The kit lists every host agy needs, and nothing more. Everything else is blocked by the sandbox proxy.
| Purpose | Hosts |
|---|---|
| Google sign-in | accounts.google.com, oauth2.googleapis.com, www.googleapis.com, lh3.googleusercontent.com |
| Models and agent backend | generativelanguage.googleapis.com, aicode.googleapis.com, cloudcode-pa.googleapis.com, daily-cloudcode-pa.googleapis.com |
| Antigravity services | antigravity.google, antigravity.google.com, antigravity-unleash.goog, the CLI auto-updater on run.app |
| Supporting Google services | play.googleapis.com, safebrowsing.googleapis.com, www.gstatic.com, storage.googleapis.com |
| Install script assets | raw.githubusercontent.com |
If your project needs more (npm, PyPI, your own API), you add those with sbx policy. The kit does not open them for you.
4. The Gemini API key never enters the VM
credentials:
- service: google
apiKey:
name: GEMINI_API_KEY
proxyManaged: true
inject:
- domain: generativelanguage.googleapis.com
header: x-goog-api-key
format: "%s"
Inside the sandbox, GEMINI_API_KEY holds a placeholder. When agy calls generativelanguage.googleapis.com, the proxy adds the real key as the x-goog-api-key header. A prompt-injected agent that dumps its environment or sends the variable to another host leaks only the placeholder.
5. Picking the sign-in mode at startup
agy reads GEMINI_API_KEY only when modelProvider is "gemini". The first startup script sets this for you, based on whether a Google credential exists:
cfg="$HOME/.gemini/antigravity-cli/settings.json"
if [ "${SBX_CRED_GOOGLE_MODE:-none}" = apikey ]; then
jq '.modelProvider = "gemini"' "$cfg" > "$cfg.tmp"
else
jq 'del(.modelProvider)' "$cfg" > "$cfg.tmp"
fi
mv "$cfg.tmp" "$cfg"
With a stored key, you get API-key mode. Without one, the setting is removed and agy falls back to its normal Google OAuth flow. It uses jq to edit the file, so any other settings you have are kept.
6. MCP gateway, wired in automatically
When the sandbox provides an MCP gateway, the second startup script merges it into ~/.gemini/config/mcp_config.json:
{
"mcpServers": {
"mcp-gateway": {
"serverUrl": "$MCP_GATEWAY_URL",
"headers": { "Authorization": "Bearer $MCP_SENTINEL_TOKEN_NAME" }
}
}
}
The bearer token is again a proxy-managed placeholder, and existing MCP servers in the file are preserved. The kit’s test file checks that the entry uses serverUrl, which is the key Antigravity expects, rather than url or httpUrl.
The kit also sets BROWSER=xdg-open and tells the sandbox to use AGENTS.md as the agent instruction file.
Hands-on: run Antigravity in a sandbox
You need the sbx CLI installed and signed in (setup guide). Then pick one of the two sign-in paths.
Option A: Sign in with your Google account (OAuth)
- From your project folder, start the kit:
cd ~/my-project sbx run --kit "docker.io/sbx/antigravity-kit:latest" antigravity - When
sbxoffers to configure the optionalgooglecredential, choose skip. agystarts its normal Google sign-in. Open the URL it prints in your browser and sign in.- Copy the authorization code and paste it back into the terminal.
The session is saved in the sandbox’s persistent home directory, so you only do this once per sandbox.
Option B: Use a Gemini API key
- Store the key on your host. It stays in the sbx secret store, not in the VM:
sbx secret set google - Start the kit as before:
sbx run --kit "docker.io/sbx/antigravity-kit:latest" antigravity
The startup script sees the credential, sets modelProvider to gemini, and agy begins in API-key mode. You can also paste the key when sbx prompts for it on first run.
To switch back to OAuth later, remove the stored credential and recreate the sandbox.
Other ways to load the kit
The Docker Hub image is the easiest path. If you want to read or change the kit first, load it from Git or a local clone:
# Straight from the contrib repo
sbx run --kit "git+https://github.com/docker/sbx-kits-contrib.git#dir=antigravity" antigravity
# From a local clone, after your own edits
sbx run --kit ./antigravity/ antigravity
Give it a real task
Once agy is running, give it something that needs several steps. For example:
Add a /health endpoint to this service, write a test for it, build the
Docker image and run the test suite inside a container.
Because permissions are pre-approved and the sandbox has its own Docker daemon, agy can write the code, run docker build and run the tests in one go. You review the result in your project folder when it is done.
The security model: what changes, and what does not
The sandbox moves the risk boundary from “every command the agent runs” to “what the VM is allowed to reach”. Here is how common risks compare:
| Risk | agy on your host with skip-permissions | agy in the antigravity-kit |
|---|---|---|
Agent runs rm -rf in the wrong place | Can hit any folder your user can write | Limited to the VM and your mounted project folder |
Agent reads ~/.ssh or cloud credentials | Can read them | Host home folder is not mounted |
| Gemini API key leaked by a prompt injection | Real key is in the environment | Only a placeholder; real key added by the proxy for one domain |
| Agent sends data to an unknown host | Allowed | Blocked unless the host is on the allow list |
| Agent runs or deletes containers | Uses your host Docker | Uses its own Docker daemon inside the VM |
A few limits are worth being honest about:
- Your project folder is still writable. The agent can change or delete files in it. Use Git and review the diff before you commit.
- Allowed hosts are still reachable. Data could be sent to an allowed Google endpoint. The allow list narrows the exit points; it does not close them.
- OAuth tokens live inside the sandbox. In OAuth mode, your Google session is stored in the sandbox home directory. Treat that sandbox as signed in to your Google account, and remove it when you no longer need it.
- Extra hosts are your call. Every domain you add with
sbx policywidens what the agent can reach. Usesbx policy logto see what it is actually calling.
Tips and troubleshooting
- A package install fails with a network error. The host is not on the allow list. Check
sbx policy log, then allow only what you need, for examplesbx policy allow network registry.npmjs.org. agyignores your API key. Make sure the secret is stored under thegoogleservice and recreate the sandbox. The startup script only setsmodelProviderwhen the credential is present at start.- You want OAuth but get API-key mode. A
googlesecret is still stored. Remove it and recreate the sandbox. - Your own MCP servers disappeared. They should not; the kit merges the gateway entry with
jq. If something looks wrong, check~/.gemini/config/mcp_config.jsoninside the sandbox. - You want to customise the kit. Clone
docker/sbx-kits-contrib, editantigravity/spec.yaml, and run it withsbx run --kit ./antigravity/ antigravity.
Wrapping up
The antigravity-kit is a small kit that does one job well. It installs agy from Google’s official script, turns off approval prompts because the VM now does that job, keeps your Gemini API key outside the sandbox, limits network access to Google’s own services, and plugs in the sandbox MCP gateway on its own.
The result is an agent you can leave running without watching every command.
sbx run --kit "docker.io/sbx/antigravity-kit:latest" antigravity