Install, upgrade and operate an agentlab cluster (private AI coding agents per person, with sign-in, hub and companions) on a Linux server over SSH. Use when asked to set up agentlab, add or remove people or agents, change access or storage, debug a cluster, or upgrade it.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Agentlab?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/radwan-albahrani-agentlab)
---
name: agentlab
description: Install, upgrade and operate an agentlab cluster (private AI coding agents per person, with sign-in, hub and companions) on a Linux server over SSH. Use when asked to set up agentlab, add or remove people or agents, change access or storage, debug a cluster, or upgrade it.
---
# agentlab
You're setting up or looking after an agentlab cluster on a server you can reach over SSH. `agentctl` on the server
does the work. Your job is to pick the order, read what it reports, and bring in the person you're working for only
when something genuinely needs them: a token they create, a link they open, a yes to something that can't be
undone. If you want the full picture of how the parts fit, `docs/architecture.md` in the repo has it.
## How to drive agentctl
Add `--json` to every command and act on the result rather than the prose. The exit code tells you what happened: `0`
means done, `1` means it failed (the error says why; fix it and try again), and `2` means it stopped for a person or
a confirmation, with the exact ask in the error.
Don't put `sudo` in front of it. Commands that change the server re-run themselves through `sudo -n`, and read-only
ones (`doctor`, `status`, `config`, `agent list`) run as you. If sudo wants a password you'll get exit 2 with
`result.needs = "sudo"` and the command to run: ask the person to run it, or to allow passwordless sudo for agentctl
(the error includes the sudoers line).
A few rules keep people's work safe:
- `--yes` is theirs to give. Anything that deletes (an agent's data, a restore over current chats) prints its plan and
stops; show them the plan and only re-run with `--yes` once they agree.
- On a cluster people already use, run `apply --dry-run` and `cloudflare setup --dry-run` first, and mention it if
the plan restarts someone's agent.
- Secrets never pass through you, a chat or a command line. When one is needed, ask the person to run
`agentctl secret set <name>` in a terminal on the server: it prompts without echoing and saves it in the right
place. `agentctl secret list --json` tells you which are saved.
- On a live cluster, make one change at a time and check `agentctl status --json` before the next.
## Setting it up
The quickest route is the guided setup, which takes every answer as a flag when you drive it:
```sh
git clone https://github.com/Radwan-Albahrani/agentlab.git /opt/agentlab
/opt/agentlab/cli/agentctl setup --json --reach <me|tailnet|cloudflare|tinyauth> --admin <email> [...]
```
Ask the person first; these choices shape everything and aren't yours to guess:
- **How people will reach it.** For one person, `--reach me`: plain ports on their own tailnet or LAN, nothing to
set up. For a group on one tailnet, `tailnet`. For a company on Cloudflare, `cloudflare`, and ask which network:
`--network private` (the default: only devices on the company's Cloudflare One client reach it, no public address)
or `--network public` (a public Cloudflare sign-in page). Without either, `tinyauth` (a Google sign-in page on the
server). [access.md](references/access.md)
explains each.
- **The address** (`--domain`, and `--hub-domain` for the dashboard). On Cloudflare keep both one level under the zone
(`agents.example.com`, `agents-hub.example.com`). For `me` and `tailnet` the machine's own name is the default.
- **Who gets agents** (`--people "sara@example.com=2, omar@example.com"`; for `me`, `--agents "work, personal"`). The
admin is a person too: ask how many agents they want for themselves, since being admin only adds the right to open
everyone else's.
- Optionally: `--storage per-person` (a capped disk per person, the default when several people share it),
`--android` / `--no-android`, `--allow-domains example.com` (anyone at that domain may sign in, only owners get an
agent), `--deploy coolify` (if they want Coolify's UI; plain Docker Compose is the default).
- **A host agent** (`me` and `tailnet` only). Ask the admin, in about these words: "Do you want a host agent? It's an
agent that runs as root on this machine itself, outside the containers, so it can fix and run the cluster for you.
The trade-off: it's convenient (one chat that can do anything here), but it has full control of the machine, so
only admins can open it and only on devices they pair; your agents stay in their containers either way. It comes
back by itself after reboots." On a yes, ask which folders it should open as projects (repositories it works on;
never one inside an agent's or companion's folder) and whether it should read a file of standing instructions,
then add `[host_agent]` with `enabled = true`, a free `port`, `model`, `context` and `[[host_agent.projects]]` (see
`cluster.example.toml`). Show the admin `agentctl host-agent setup --dry-run --json`'s changes, then run
`agentctl apply`. The admin then signs it in and pairs a device on the hub (Agents → host), like any agent.
**On a Windows PC (WSL)** the cluster must come back on its own after a reboot and when WSL freezes, so agentlab
installs two Windows tasks (`\agentlab\agentlab-boot`: start WSL at boot and keep it up; `\agentlab\agentlab-watchdog`:
`wsl --shutdown` after about 6 minutes without an answer, so the boot task restarts it). Before setup, ask the person:
- whether WSL needs disks attached first (`[wsl] vhds`, e.g. `'E:\WSL\media.vhd'`) and folders mounted once it is up
(`[wsl] mounts`, the fstab mount points on those disks);
- whether they already have their own Windows tasks or scripts that start or watch WSL (check with
`powershell.exe -NoProfile -Command "Get-ScheduledTask | ? TaskName -match 'wsl|boot|watchdog' | fl TaskPath,TaskName,Actions"`):
list those in `[wsl] retire_tasks` (and leftover scripts in `retire_files`), which agentlab replaces once its own
boot task holds WSL up, keeping their scripts as `.retired`. Their maintenance scripts that stop the old boot task
must then disable and stop `\agentlab\agentlab-boot` instead (and enable and start it after).
Registering the tasks to run at boot needs Windows admin: the first `apply` must run from a WSL terminal opened as
administrator (ask them to open one if `wsl setup --dry-run` warns about admin). Show them `agentctl wsl setup
--dry-run --json` first; `doctor` then checks the tasks, their last results and the watchdog's last firing
([operate.md](references/operate.md#after-a-crash-or-reboot)).
Setup writes `/etc/agentlab/cluster.toml`, then installs everything, sets up Cloudflare when chosen, and starts the
agents. When it stops with exit 2 it's waiting on a person: a Cloudflare API token to save (`agentctl secret set
cloudflare-api`), a Tailscale login link to open, a Coolify token to create. Pass the ask on word for word, wait for
them, and run `agentctl setup --json` again; it picks up where it stopped and keeps the config it already wrote.
Setup fetches the latest agentlab itself each time, so there's nothing to pull first. If an exit-2 message only asks
for an `agentctl` command, that's an agentlab bug: run it yourself, carry on, and open an issue.
Setup and every `apply` also install the reliability safeguards ("Reliability" in `docs/architecture.md`): earlyoom,
the autoheal timer, the host services' memory reservation, zram swap for the host, capped jobs and checks,
self-restarting units, the watchdog (systemd's on Linux and VMs; on a WSL host the Windows boot task and freeze
watchdog, plus the cache trim that hands file cache back to Windows), nightly backups and safe updates. They replace
hand-made `homelab-autoheal`, `homelab-zram` and `homelab-cache-trim` units. `agentctl doctor --json` must show
`earlyoom`, `autoheal`, `services-reserve`, `zram`, `backups`, and `watchdog` (not on WSL) or `cache-trim` (on WSL)
ok before you call the cluster done; a failing one says what it saw and its fix (usually `agentctl apply`). Ask the admin
to link their iPhone on the hub's Notifications page: memory pressure, auto-restarts, services down and the watchdog
firing reach admins there. Heavy checks (full test suites) belong on CI, never on the server people use.
When it's done, check it the way people will use it: the admin opens the address, sees the agents on the menu, the
dashboard loads, and a new person lands on onboarding. Then tell everyone their address, and that the admin can see
their agent.
If someone prefers to edit the config by hand, the long way still works: `agentctl init`, edit
`/etc/agentlab/cluster.toml` (every key is explained in `cluster.example.toml`), `agentctl doctor`, `agentctl
install`, `agentctl cloudflare setup` when using Cloudflare, `agentctl apply`.
## Day to day
| They ask for | You run |
|---|---|
| A new person or agent | `agentctl agent add <id> <email> [--memory 12g] [--cpus 4] --json`: it applies, and with Cloudflare set up it also updates the names and who may sign in. The admin can do the same from the hub's **Manage agents** page, with live progress |
| More or less memory or CPUs | `agentctl agent set <id> --memory 16g --cpus 6` (`default` drops the override; `auto` = all of `limits.total_memory`), or Resize on the Manage agents page |
| Removing an agent | `agentctl agent remove <id> --keep-data` is safe; deleting the data needs their yes on the plan |
| Lost chats | `agentctl backup list --json`, show the dates, then `backup restore <date> <agent>` once they say yes |
| A full disk | `status` shows each disk; the janitor tidies twice a day; look at the biggest agents in the dashboard's Storage screen and ask before deleting anything |
| Room for one more person | With per-person disks, `person_size = "auto"` (or a lower size) and `apply`: the others shrink safely, never below their data; `apply --dry-run` first, since a shrink stops that person's agents for a few minutes ([operate.md](references/operate.md#disk-space)) |
| An upgrade | `agentctl update --json` (pull, rebuild, apply; busy agents are waited for). Companion code in agents' workspaces belongs to them; template changes reach it as merge commits on its own |
| A host agent (if the cluster has none, ask once whether they want one: root on the host, so convenient but full control of the machine; admins only, back after reboots) | `[host_agent] enabled = true` and a `port` in cluster.toml (plus `model`, `context`, `[[host_agent.projects]]`), `agentctl host-agent setup --dry-run --json` to show the changes, then `agentctl apply --json`; `status` and `doctor` report it; `[host_agent] enabled = false` and `apply` remove it (its files stay) |
| A different sign-in | Plan it with them first, since it changes how everyone gets in; [access.md](references/access.md) covers each way |
When something's off, [operate.md](references/operate.md) has the usual causes.
## Off limits
- Anything inside an agent's home or workspace, except through agentctl: it's that person's machine.
- People's chats, code or logins, unless the person you work for asks for that specific thing.
- Opening ports, disabling the `agentlab` firewall table, or switching `isolation` to `unconfined` to make something
work.
- Company secrets (vaults, production credentials) in agents or companions, unless you're told which and where.