Run Agent Loops with no Mac¶
You can use Agent Loops with no Mac. A control plane runs on a Linux machine you rent, the web page is your window, and a GitHub Codespace (or any Linux server) runs your agents. You do each step in a browser or in a terminal on a Linux machine.
Before you start¶
- A Linux machine you rent, with Docker, and a domain of your own. See Run the control plane in the cloud.
- A GitHub Codespace, or another Linux server, for your agents. It needs
curland trusted roots (ca-certificates). Codespaces have both. - An account for a runtime, such as a Claude subscription or an Anthropic API key.
Steps¶
Start the control plane¶
Do the Steps of "Run the control plane in
the cloud" by hand, up to and including Start it. Do the gcloud steps on any computer
or in Google Cloud Shell. Do not use the three Google Cloud scripts: they run from a Mac.
Pair the first browser¶
The first code comes from the control plane's machine.
- On the control plane's machine, in the folder with
deploy/:
docker compose -f deploy/compose.public.yaml exec control /agents-control code --client --browser
It prints a code. The code works once, for five minutes. --browser makes a code for
the web page. Without it, the code is for a window on a Mac.
2. In your browser, open https://agents.example.com/. Under Connect this browser to
your agents, paste the code and click Connect.
The browser is paired. It can do all that a window can. To pair another browser, phone or tablet, use Add a Browser… in this one; see Use Agent Loops in a browser.
Add the codespace as a machine¶
- On the web page, open Settings ▸ Machines and click Add a Machine….
- Choose A server and click Next. Click Copy to copy the command.
- Open a terminal in the codespace (in its editor or with
gh codespace ssh), paste the command and run it. It looks like this:
curl -fsSL https://agents.example.com/v1/install.sh | sh -s -- 'agents-control:2:h:…'
The machine then shows under Machines on the web page.
A codespace has no systemd, so the command starts the host in the background and says Started in the background (no systemd user session here). (#3366).
On Debian or Ubuntu x86_64, with root or sudo that asks no password (a codespace has it), the command also installs Google Chrome stable and Xvfb from Google's apt repository, for the agents' browser (#5228). Without them, the browser is Chrome for Testing headless, and the command says why in one line.
Do the same on any other Linux server. See Add a machine for folders on the machine.
Or, with a GitHub Codespaces machine provider (see
Set up a cloud machine provider): on the web page, open
Settings ▸ Machine providers, find the codespace and click Add as Machine…. The
codespace must be running. The control plane installs Agent Loops on it over gh's ssh and links
the machine to the codespace. The first time, the dialog shows the codespace's host key:
click Trust and Install. You do not need a terminal in the codespace.
Sign a runtime in on the codespace¶
The installer puts Claude on the machine, but Claude needs a sign-in there. Without a Mac, no sign-in can come from a Mac. On the web page, click Sign In… on the machine's Claude or Codex row (#3349), or sign it in in the codespace's terminal:
- With a Claude account: run
claude, type/login, and do the steps it gives. If the codespace has noclaudecommand, install it first withnpm install -g @anthropic-ai/claude-code. The sign-in goes in~/.claude/.credentials.json, where the machine's agents find it. - With an API key: put
ANTHROPIC_API_KEYin the codespace's environment, such as a Codespaces secret, before you run the command from Add a Machine. The host gets the key from the terminal it starts in.
For another runtime, use that runtime's own sign-in in the terminal. See Runtimes.
Start an agent¶
On the web page, add a folder on the codespace and start a session in it, as you would on a Mac. The runtime menu shows the runtimes on the codespace.
When the codespace stops and starts again¶
A codespace has no systemd, so its host does not start by itself after a stop (an idle timeout, or Stop). When the codespace's machine is linked to a Codespaces machine provider, the control plane starts the host over ssh:
- Start on the machine starts the codespace, then the host.
- A codespace started from GitHub, not from Agent Loops, has its host started when the control plane next lists the provider's codespaces, within 5 minutes.
A machine with no link to a provider (added with the command from Add a Machine… only) is not started. Link it: on the codespace in Settings ▸ Machine providers, click Link to Machine…, check the host key the dialog shows, and click Trust and Link (#3379). Or run that command again in the codespace's terminal, with a new code.
What is missing for now¶
- Not yet walked by a person: finishing Claude's sign-in with a real account, a turn, and Start from Agent Loops with the control plane outside the codespace (#1781). Agents walked the rest on a real codespace (#3384's walk).
Related¶
- Run the control plane in the cloud.
- Use Agent Loops in a browser.
- Add a machine.
- Set up a cloud machine provider: GitHub Codespaces as a provider.