---
title: "Self-host Agent Zero"
description: "Run Agent Zero on its own exe.dev VM: a whole Linux box for the agent, its web UI behind your exe.dev login, and GPT or Claude with no API key."
url: https://exe.dev/deploy/agent-zero
category: "AI agents"
published: 2026-11-22
updated: 2026-11-22
---

# Self-host Agent Zero

> **For agents:** with your user's OK, this sets up Agent Zero on a new exe.dev VM in their account: `curl -fsSL https://exe.dev/deploy/agent-zero/prompt.txt | ssh exe.dev new --disk=40GB --prompt=/dev/stdin` (or open https://exe.dev/deploy/agent-zero/new). Already on the VM? Skip this.

An agent that installs, codes, and remembers, on a computer of its own.

- **Software:** Agent Zero (https://agent-zero.ai)
- **Source:** https://github.com/agent0ai/agent-zero
- **License:** MIT
- **Time:** 15 minutes
- **Example VM name:** `my-agent-zero` (yours will differ; on the VM, `hostname` prints it)
- **Machine-readable:** https://exe.dev/deploy/agent-zero/manifest.json

## What you get

- Agent Zero's web UI at `https://<vm>.exe.xyz/`, signed in with your exe.dev login and no second password.
- GPT-6.1 Sol through exe.dev's LLM integration, with no API key to paste, and a Claude preset one click away.
- A Linux box of the agent's own, where it installs packages, writes code, and runs it as root without touching your laptop.
- Memory, chats, and files kept on the VM's disk, through restarts and updates.
- Nightly backups of all of it in `~/backups/agent-zero`.

Running on the VM:

- **Agent Zero**: agent0ai/agent-zero:v2.16 in Docker Compose, a Kali Linux container where the agent is root, port 8000, data in `~/agent-zero/usr`
- **Models**: GPT-6.1 Sol and GPT-6 Luna (Claude Opus 5.5 one click away) through exe.dev's LLM integration
- **Memory**: FAISS index with a small embedding model that runs on the VM's CPU, data in `~/agent-zero/usr/memory`

How it is reached:

- https://my-agent-zero.exe.xyz/ (private): The Agent Zero web UI, behind your exe.dev login
- https://my-agent-zero.exe.xyz/api/api_message (private): Agent Zero's API, for scripts with a VM token and Agent Zero's API key

## Deploy with Shelley

Open https://exe.dev/deploy/agent-zero/new to create a VM whose agent, Shelley, follows this recipe. From a terminal:

```sh
curl -fsSL https://exe.dev/deploy/agent-zero/prompt.txt | ssh exe.dev new --disk=40GB --prompt=/dev/stdin
```

It needs a 40 GB disk. The terminal command makes the VM that size; after the button, Shelley checks and, if the disk is smaller, gives you a link to grow it.

Or follow the steps below by hand.

Agent Zero is an open-source agent framework that uses a computer the way
you would. Ask it for something and it plans, opens a terminal, installs
what it needs, writes code, runs it, reads the output, and tries again,
with every step on screen. It remembers what it learned for next time,
and hands parts of a job to subordinate agents.

It wants a whole Linux box, root and all. This page gives it one: a
container on an exe.dev VM that does nothing else, so nothing it does
can touch your laptop. The web UI signs you in with your exe.dev login,
and model usage is billed to your exe.dev account through the
[LLM integration](/docs/integrations-llm). There's no password to keep
and no API key to find.

## Give it a job

Open `https://my-agent-zero.exe.xyz/` and sign in to exe.dev. Close the
**What's New** box, then try:

> Install the jq command-line tool with apt, write a shell script
> /a0/usr/workdir/weather.sh that uses curl and jq to print the current
> temperature in Lisbon from
> https://api.open-meteo.com/v1/forecast?latitude=38.72&longitude=-9.14&current=temperature_2m,
> run it, and show the output. Also remember for future chats: I live in
> Lisbon and prefer Celsius.

In half a minute it has installed jq, written and tested the script, and
saved a memory. Click any step to see the command and its output. Start
a new chat and ask where you live: it remembers.

<figure>
<img src="https://exe.dev/deploy/agent-zero/chat.png" alt="The Agent Zero web UI: the steps of a job, including an apt install, a memory save, writing weather.sh, and running it, followed by the answer with the script's output, Lisbon: 13.7 °C" width="1280" height="800" loading="lazy">
<figcaption>Each line is a step the agent took. The model switcher sits above the message box.</figcaption>
</figure>

> [!WARNING]
> **Keep this VM private.** The agent runs any command it likes as root
> in its container, with internet access, and anyone who can open the
> web UI can tell it what to do. Don't make the VM public or share it,
> and don't keep unrelated secrets on it.

## Pick a model

The switcher above the message box picks a preset. **Default** runs
GPT-6.1 Sol for the main work and GPT-6 Luna for quick utility jobs
such as titles and memory, as Agent Zero's own defaults do. **Claude**
swaps in Claude Opus 5.5. Both go through the LLM integration, and the
API keys in Agent Zero's settings are placeholders, not real keys.

Presets live in `~/agent-zero/usr/plugins/_model_config/presets.yaml`,
and **Settings → Agent Settings → Models** edits them. Any model the
integration offers works: the provider is **OpenAI** with API base
`https://llm.int.exe.xyz/v1`, or **Anthropic** with
`https://llm.int.exe.xyz`. Memory search uses a small embedding model
that runs on the VM, so it costs nothing.

## Work out what it can reach

Inside its container Agent Zero is root on a Kali Linux system. Outside
it, on the VM, it can reach only one folder, `~/agent-zero/usr`, which
it sees as `/a0/usr`:

| In `~/agent-zero/usr` | What it holds |
| --- | --- |
| `workdir/` | The files it makes for you. Ask it to keep things here. |
| `memory/` | What it remembers. Browse and edit it from **Memory**, under the arrow beside the settings gear. |
| `knowledge/` | Documents you give it to read and recall. |
| `chats/`, `projects/`, `scheduler/` | Conversations, projects, and scheduled tasks. |
| `.env`, `settings.json`, `plugins/` | Settings and keys. |

Packages it installs with `apt` or `pip` live in the container, not in
that folder, so they vanish when the container is recreated, as an
update does. That's handy for experiments: anything it breaks is gone
too. For a tool it needs every time, ask it to note that in memory, or
keep a setup script in `workdir/`.

For a risky job, copy the whole VM first. On your computer:

```bash
ssh exe.dev cp my-agent-zero my-agent-zero-try
```

The copy has the same chats, memory, and settings. Before you open its
web UI, point Agent Zero at the copy's address. On the copy:

```bash
cd ~/agent-zero &&
sudo sed -i "s|^ALLOWED_ORIGINS=https://[^,]*|ALLOWED_ORIGINS=https://$(hostname).exe.xyz|" usr/.env &&
docker compose restart
```

Delete whichever one you're done with with `ssh exe.dev rm`. For a job
that needs the models but nothing else on the internet, add
`--egress=integrations` to `cp`: see
[internet access](/docs/internet-access). Agent Zero can't install
packages that way.

## Send it work from scripts

Agent Zero has a small HTTP API. Through exe.dev, a request needs two
keys: a [VM token](/docs/https-tokens-for-vms) for exe.dev's proxy and
Agent Zero's API key for Agent Zero. Find the API key in **Settings →
External Services → External API**, or on the VM:

```bash
docker exec -w /a0 agent-zero /opt/venv-a0/bin/python -c \
  "from helpers import dotenv; dotenv.load_dotenv(); from helpers.settings import create_auth_token; print(create_auth_token())"
```

On your computer, make a VM token, then send a message:

```bash
VM_TOKEN=$(ssh exe.dev ssh-key generate-api-key --vm=my-agent-zero --label=agent-zero-api)
A0_KEY=paste-the-api-key
curl -s https://my-agent-zero.exe.xyz/api/api_message \
  -H "X-Exedev-Authorization: Bearer $VM_TOKEN" \
  -H "X-API-KEY: $A0_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"message": "Where do I live? One line."}'
```

The reply is JSON with a `response` and a `context_id`. Send the
`context_id` back to continue the same chat. The API holds the request
open until the job is done, so give long jobs a long timeout.

Agent Zero can also be an MCP server for other agents, and use other
MCP servers' tools: both are under **Settings → MCP/A2A**. See its
[MCP guide](https://github.com/agent0ai/agent-zero/blob/main/docs/guides/mcp-setup.md).
A client reaching it through exe.dev needs the VM token header too.

## Keep the memories

Everything that matters is in `~/agent-zero`: the Compose file and the
`usr` folder. A nightly backup at 03:30 UTC puts a copy in
`~/backups/agent-zero` and keeps the newest seven. It pauses the agent
for the few seconds it takes, so a running job carries on afterwards.
Copy the backups **off the VM**, too. On your computer:

```bash
rsync -av my-agent-zero.exe.xyz:backups/agent-zero/ ./agent-zero-backups/
```

Keep those copies private: they hold your chats, memory, and settings.
Agent Zero's own **Backup & Restore**, under **Settings → Check for
updates**, downloads a copy to your browser instead.

## Setup and upkeep

No need to read on unless you're curious—or doing it yourself.

<details id="create-the-vm" data-manual-setup class="dp-details">
<summary>Install by hand</summary>

### Create the VM

On your computer (pick another name if `my-agent-zero` is taken):

```bash
ssh exe.dev new --name=my-agent-zero --disk=40GB
ssh my-agent-zero.exe.xyz
```

All remaining installation commands run **on the VM**, as `exedev`.
Commands use `hostname`, so your VM can have any name.

### Room on the disk

The image takes 12 GB. Check the disk:

```bash
df -h /
```

If **Size** is under 36G, the VM was made with a smaller disk. Grow it with
[this link](https://exe.dev/suggest?command=resize%20my-agent-zero%20--disk%3D40GB)
(with your VM's name), or on your computer with
`ssh exe.dev resize my-agent-zero --disk=40GB`. Then, back on the VM, grow
the filesystem to match:

```bash
sudo resize2fs "$(findmnt -no SOURCE /)"
df -h /
```

### Get Docker ready

Enable Docker at boot, or exe.dev's on-demand Docker won't start Agent
Zero after a reboot:

```bash
sudo systemctl enable --now docker.service
systemctl is-enabled docker.service
```

### Write the settings

Agent Zero keeps its data in `~/agent-zero/usr`. Its `.env` names the
web address it accepts, since exe.dev's login stands in for Agent
Zero's own, and gives the model providers placeholder keys: the LLM
integration needs none.

```bash
mkdir -p ~/agent-zero/usr/plugins/_model_config
cd ~/agent-zero
(umask 077; cat > usr/.env <<EOF
ALLOWED_ORIGINS=https://$(hostname).exe.xyz,*://localhost:*,*://127.0.0.1:*
OPENAI_API_KEY=exe-llm-integration
ANTHROPIC_API_KEY=exe-llm-integration
EOF
)
```

The model presets: GPT for the main work and the utility jobs, a local
embedding model for memory, and a Claude preset to switch to:

```bash
cat > usr/plugins/_model_config/presets.yaml <<'EOF'
- name: Default
  chat:
    provider: openai
    name: gpt-6.1-sol
    api_base: https://llm.int.exe.xyz/v1
    ctx_length: 200000
    ctx_history: 0.7
    vision: true
  utility:
    provider: openai
    name: gpt-6-luna
    api_base: https://llm.int.exe.xyz/v1
    ctx_length: 128000
    ctx_input: 0.7
  embedding:
    provider: huggingface
    name: sentence-transformers/all-MiniLM-L6-v2
- name: Claude
  chat:
    provider: anthropic
    name: claude-opus-5-5
    api_base: https://llm.int.exe.xyz
    ctx_length: 200000
    ctx_history: 0.7
    vision: true
  utility:
    provider: openai
    name: gpt-6-luna
    api_base: https://llm.int.exe.xyz/v1
    ctx_length: 128000
    ctx_input: 0.7
EOF
```

### Start Agent Zero

The Compose file pins the tested release and publishes the web UI on
port 8000, where exe.dev's proxy sends `https://<vm>.exe.xyz/`:

```bash
cat > compose.yaml <<'EOF'
services:
  agent-zero:
    image: agent0ai/agent-zero:v2.16
    container_name: agent-zero
    restart: unless-stopped
    ports:
      - "8000:80"
    volumes:
      - ./usr:/a0/usr
    ulimits:
      nofile:
        soft: 65535
        hard: 65535
EOF
docker compose up -d
```

The pull takes a few minutes. Then wait for it to answer:

```bash
until curl -sf -o /dev/null localhost:8000/api/health; do sleep 3; done
curl -s localhost:8000/api/health; echo
```

Expect JSON with `"tag": "v2.16"`.

### Check it answers

Ask it something through its API. The first answer takes a little
longer while it loads the embedding model:

```bash
A0_KEY=$(docker exec -w /a0 agent-zero /opt/venv-a0/bin/python -c \
  "from helpers import dotenv; dotenv.load_dotenv(); from helpers.settings import create_auth_token; print(create_auth_token())")
curl -s -m 300 localhost:8000/api/api_message -H "X-API-KEY: $A0_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"message": "Run uname -n in the terminal and reply with its output only."}'
echo
```

Expect a `response` with a container ID: the agent's own hostname.

### Back it up every night

A small script pauses the agent, archives `~/agent-zero`, and keeps
the newest seven; a systemd timer runs it nightly:

```bash
sudo tee /usr/local/bin/agent-zero-backup >/dev/null <<'EOF'
#!/bin/sh
# Nightly copy of ~/agent-zero (settings, chats, memory, files), keeping 7.
set -eu
src=/home/exedev/agent-zero
dest=/home/exedev/backups/agent-zero
mkdir -p "$dest"
cd "$src"
docker compose pause            # freeze the agent so the copy is consistent
trap 'docker compose unpause' EXIT
tar -czf "$dest/agent-zero-$(date +%F).tar.gz" -C /home/exedev agent-zero
docker compose unpause
trap - EXIT
chown -R exedev:exedev "$dest"
chmod 600 "$dest"/*.tar.gz
ls -1t "$dest"/agent-zero-*.tar.gz | tail -n +8 | xargs -r rm --
EOF
sudo chmod 755 /usr/local/bin/agent-zero-backup
sudo tee /etc/systemd/system/agent-zero-backup.service >/dev/null <<'EOF'
[Unit]
Description=Back up Agent Zero
After=docker.service

[Service]
Type=oneshot
ExecStart=/usr/local/bin/agent-zero-backup
EOF
sudo tee /etc/systemd/system/agent-zero-backup.timer >/dev/null <<'EOF'
[Unit]
Description=Nightly Agent Zero backup

[Timer]
OnCalendar=*-*-* 03:30
RandomizedDelaySec=15m
Persistent=true

[Install]
WantedBy=timers.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable --now agent-zero-backup.timer
sudo systemctl start agent-zero-backup.service
ls -lh ~/backups/agent-zero/
tar -tzf ~/backups/agent-zero/agent-zero-*.tar.gz | grep -c memory/
```

Expect one archive and a count above zero.

### Open the web UI

Open `https://my-agent-zero.exe.xyz/`, sign in to exe.dev, close
**What's New**, and give it a job.

</details>

<details id="back-up-and-restore" class="dp-details">
<summary>Back up and restore</summary>

On the VM, take a fresh backup:

```bash
sudo systemctl start agent-zero-backup.service &&
ls -t ~/backups/agent-zero | head -1
```

To restore, replace `BACKUP.tar.gz` with your chosen archive's filename.
This sets the current folder aside as `~/agent-zero.old` (delete it,
with sudo, once you're happy):

```bash
cd ~/agent-zero && docker compose down &&
cd ~ && sudo rm -rf ~/agent-zero.old && mv ~/agent-zero ~/agent-zero.old &&
sudo tar -C ~ -xzf ~/backups/agent-zero/BACKUP.tar.gz &&
cd ~/agent-zero && docker compose up -d
```

Chats, memory, files, settings, and the API key come back. Packages the
agent installed in the container don't; it reinstalls them when it
needs them.

Moving to a new VM? Follow "Install by hand" up to Docker, copy the
archive over with `scp`, unpack it with the `tar` line above, set the
new address in `.env` as in
[Work out what it can reach](#work-out-what-it-can-reach), and run
`docker compose up -d`.

</details>

<details id="update" class="dp-details">
<summary>Update</summary>

Check Agent Zero's [releases](https://github.com/agent0ai/agent-zero/releases)
for what's new. On the VM, back up, set the new tag, and recreate the
container:

```bash
version=v2.16   # the release you want
cd ~/agent-zero &&
sudo systemctl start agent-zero-backup.service &&
sed -i "s|agent0ai/agent-zero:.*|agent0ai/agent-zero:$version|" compose.yaml &&
docker compose pull && docker compose up -d &&
until curl -sf -o /dev/null localhost:8000/api/health; do sleep 3; done &&
curl -s localhost:8000/api/health; echo
docker image prune -f
```

Expect the new tag. Your data stays in `usr`. Skip the web UI's **Self
Update**: it updates the code inside the container, which goes back to
the image's version the next time the container is recreated. The `v3`
tag is a preview of the next major version; wait for a stable release,
and read its notes, before moving to it.

</details>

<details id="troubleshooting" class="dp-details">
<summary>Something stuck?</summary>

Ask Shelley, or check on the VM:

```bash
cd ~/agent-zero
docker compose ps
curl -s localhost:8000/api/health; echo
docker compose logs --tail=60
```

- **502 in the browser?** The container takes about half a minute to
  start; reload. Still there? Look at the log.
- **`Origin ... not allowed` or a page that never connects?** The
  address in `ALLOWED_ORIGINS` in `~/agent-zero/usr/.env` doesn't match
  the VM's. Fix it as in
  [Work out what it can reach](#work-out-what-it-can-reach).
- **The agent repeats itself or prints broken tool calls?** Press
  **Pause Agent** below the message box, or switch presets and try again.
- **No model reply?** Check the presets in **Settings → Agent Settings →
  Models** and your [LLM integration](/docs/integrations-llm).
- **Disk full?** `df -h /` and `docker system df`. `docker image prune`
  clears old images after an update; `sudo du -sh ~/agent-zero/usr/*`
  shows what the agent has kept.

</details>

## Frequently asked questions

### What does it cost?

Your [VM plan](https://exe.dev/pricing) plus model usage, billed through the [LLM integration](/docs/integrations-llm). Agent Zero works in many small steps, each a model call, so a long job can spend more than a chat would. The disk needs 40 GB: the image alone takes 12 GB.

### How is it different from OpenClaw, Hermes Agent, and nanobot?

[OpenClaw](/deploy/openclaw), [Hermes Agent](/deploy/hermes-agent), and [nanobot](/deploy/nanobot) are personal assistants first: they live in chat apps, run on a schedule, and keep to your home folder. Agent Zero is a general agent that treats a whole Linux machine as its tool. It installs whatever it needs, writes and runs code, hands subtasks to subordinate agents, and shows every step in its web UI. Pick it for jobs that need a computer, not just a conversation.

### Why doesn't Agent Zero ask for a password?

exe.dev's [proxy](/docs/proxy) asks first: nobody reaches the VM's web port without your exe.dev login. Agent Zero runs with its own login off and accepts the UI only from your VM's address, set in `ALLOWED_ORIGINS`. Keep the VM private: anyone you [share](/docs/sharing) it with gets the whole agent. You can still set a login under **Settings → External Services → Authentication**; that changes the API key.

### Can it break the VM?

It is root inside its container, not on the VM. It sees only `~/agent-zero/usr` of the VM's files, has no Docker socket, and can't use sudo on the VM. What it breaks inside the container goes away when the container is recreated. Its own settings, keys, and memory are in that folder, though, and it can reach the internet, so keep other secrets off this VM.

### Can a script on my computer talk to it?

Yes, with two keys: an exe.dev [VM token](/docs/https-tokens-for-vms) gets you past the proxy, and Agent Zero's API key gets you past Agent Zero. See [Send it work from scripts](#send-it-work-from-scripts).

### Does it keep working when my laptop is closed?

Yes. A job runs on the VM until it finishes, and the chat shows the result when you return. The container starts again after a reboot. Its task scheduler, under **Tasks** in the sidebar, runs jobs on a timetable.


## Related

- [Self-host OpenClaw on an always-on server](https://exe.dev/deploy/openclaw.md): An AI sidekick with its own computer. Your laptop can take a nap.
- [Self-host Hermes Agent](https://exe.dev/deploy/hermes-agent.md): An agent that remembers you, on a computer that never sleeps.
- [Self-host nanobot](https://exe.dev/deploy/nanobot.md): A small personal agent with a WebUI, memory, and a schedule.
- [Run AI-generated code safely](https://exe.dev/deploy/code-interpreter.md): The model writes Python. A VM of its own runs it, keeps its variables, draws the charts.
- [Running Agents](https://exe.dev/deploy/agents.md): Use exe.dev VMs as a sandbox
- [Deploy a Docker Compose app from GitHub](https://exe.dev/deploy/docker-compose.md): Your compose.yaml on a VM of its own. git push to deploy.
