
# Installing agc

`agc` is the command-line tool your coding agent uses to work with Agent Cloud. Install it once per machine and it keeps itself current. It worked when `agc version` answers with `"product": "agent.cloud"`, a `version` and a `built` time.

```bash
npm install -g https://agent.cloud/agc.tgz
```

## Ask your agent

```text
Install Agent Cloud's agc CLI, check that the agc on my PATH is the right one, and tell me which version you're on.
```

The agent runs the install and `agc doctor`, and tells you if another program called `agc` is in the way.

## Steps

**With npm** (Node 24.22.1 or later). This puts `agc` and its long name, `agentcloud`, on PATH:

```bash
npm install -g https://agent.cloud/agc.tgz
agc version
```

```json
{
  "ok": true,
  "product": "agent.cloud",
  "command": "version",
  "data": { "version": "0.3.0", "built": "2026-10-20T09:12:44.000Z", "node": "v24.22.1", "environment": "production", "control_url": "https://agent.cloud" },
  "next": []
}
```

The tarball comes from Agent Cloud, not the npm registry, and is one bundled file with no dependencies. Older Node 24 also works, but `agc doctor`'s `runtime` check warns that it trusts certificates from a compromised authority.

**As one file, without Node** (macOS and Linux x64):

```bash
curl -fsSL https://agent.cloud/install | sh
```

| The installer | Does |
|---|---|
| Picks | The file for your machine: `darwin-arm64`, `darwin-x64` or `linux-x64` |
| Verifies | Refuses it unless its sha256 matches the one `https://agent.cloud/agc.json` publishes |
| Installs | `~/.agentcloud/bin/agc`, with no `agentcloud` alias; on macOS one marked line in `~/.zprofile` puts it on PATH for new terminals |
| Prints | The executable's absolute path last; call that path if your shell doesn't read `~/.zprofile` |
| Warns | On stderr, when the machine lacks Node 24 (with npm) or git: agc itself doesn't need them, but the TypeScript starter does, so install them before `agc init` |
| Reruns | Update in place |

**On Windows**, in PowerShell (x64, no Node needed):

```powershell
irm https://agent.cloud/install.ps1 | iex
```

It downloads `windows-x64`, refuses it unless its sha256 matches `https://agent.cloud/agc.json`, installs `%LOCALAPPDATA%\agent.cloud\bin\agc.exe`, adds that folder to your user PATH and prints the executable's path last. Open a new terminal to use it.

**Running `agc up` on Windows:** mirrors run only on macOS and Linux, so on native Windows `agc up` stops with `mirror.isolation_unavailable` and starts nothing. Run `agc up` under WSL2 with bubblewrap installed there (`sudo apt install bubblewrap`), or on a Linux or macOS machine. `agc ship` still works from Windows: Agent Cloud rehearses the release on a branch of production without a mirror.

**Check the install** with `agc doctor`. Its `path` check confirms the first `agc` on PATH is this CLI; the others are `runtime`, `updates`, `login`, `manifest`, `link`, `mirror secrets`, `node`, `python` (uv projects) and `data wiring`. `login` fails until `agc init` has run once.

**Update now, or turn updates off** (for CI, or to pin a build). `AGC_NO_UPDATE=1` stops only the automatic check; `agc update` still works.

```bash runnable
agc update
agc version
```

```bash
export AGC_NO_UPDATE=1
```

`agc update` answers `"updated": true`, or `false` with "This agc is current."

## How it works

Agent Cloud serves the CLI from its own running image, so the `agc` you install matches the Agent Cloud it talks to. It serves `/agc.tgz` for npm, `/agc-<target>` for each one-file build, and `/agc.json` (no token) with `version`, `built`, `sha256`, `url`, and optionally `minimum` and per-platform `binaries`. Builds between releases share a version; `built` orders them.

**PATH collisions.** Other tools also ship an `agc`. `agc doctor` checks the first one on PATH for Agent Cloud's marker:

| `path` check | Meaning | What to do |
|---|---|---|
| `pass` | `` `agc` resolves to <file> `` and it's Agent Cloud's | Nothing |
| `warn` | `agc` isn't on PATH | Reinstall, or use `agentcloud` |
| `fail` | `PATH finds <file> first, which is not agent.cloud.` | Use `agentcloud` instead of `agc`, or put npm's global bin directory earlier in PATH |

The quickest tell: run by an agent, every agc command answers a JSON envelope with `ok`.

`~/.agentcloud` (or `AGC_HOME`) holds the agent identity, mirrors' state and the update cache. Never edit its `config.json` by hand; `agc init --reset-identity` replaces an identity.

## Updates

Before a command, agc checks for a newer build, installs it, and reruns the command on it.

| Step | What agc does |
|---|---|
| Check | Before a command, compares its own `built` with `/agc.json`, at most once an hour (cached in `update.json` under `~/.agentcloud`). Every `/v1` response carries `x-agc-latest: <built>`; when that's newer, the next command checks at once |
| Download | Refuses the new build unless its sha256 is the published one |
| Install | The way it was installed: an npm global install with `npm install -g --prefix <the original prefix>`; another package install by replacing its folder in one rename; a one-file build by swapping its file in one rename |
| Rerun | Runs the same command again on the new version, with `data.agc_updated: {from, to}`, and brings the repo's AGENTS.md section and `CLAUDE.md` link up to date |
| Never | Downgrades, updates mid-command or inside a mirror's background supervisor, or updates an agc run from source (no build stamp) |
| Failure | Offline, no permission to write the install, or a checksum mismatch: the command runs on your version with `data.agc_update_failed` and a `next` of `agc update`, with no retry within the hour |
| Minimum | For changes that would break older agcs, Agent Cloud can set a minimum build (`AGC_MINIMUM` on control, published as `minimum`). An older agc that can't update refuses the command with `cli.outdated` |
| AGENTS.md | Agent Cloud's section, from its heading to its end line (`_End of agent.cloud's section. …_`), is replaced; your lines above or below and the "Your organization" part are kept, and the previous file is saved under `~/.agentcloud/agents-md/`. `agc status` also refreshes it, adding `agents_md: {updated: true, previous}` and a `next` of `cat AGENTS.md` when it changed |
| New manifest keys | An older agc drops keys it doesn't know, so a ship whose `agentcloud.toml` sets `[auth] provider` (other than `agent.cloud`), `[app] title`, `description` or `listed` that the request didn't carry is refused before anything builds with `ship.agc_outdated`, naming each key |

## Reference

| Field or setting | Where | Meaning |
|---|---|---|
| `data.agc_updated` | any envelope | `{from, to}`: this command ran on a build installed just now |
| `data.agc_update_failed` | any envelope | Why the automatic update failed; the command ran on the current build |
| `data.updated` | `agc update` | `true` after an update, `false` when current |
| `AGC_NO_UPDATE=1` | environment | No automatic check (exactly `1`) |
| `x-agc-latest` | `/v1` response header | The build Agent Cloud serves |

## Errors

| `code` | Exit | Cause | Fix |
|---|---|---|---|
| `doctor.checks_failed` | 1 | At least one doctor check failed; `message` names them | Apply each `fix` in `error.fix` |
| `cli.outdated` | 1 | Older than Agent Cloud's minimum, and the automatic update failed | `npm install -g https://agent.cloud/agc.tgz`, then the same command |
| `cli.update_failed` | 1 | `agc update` couldn't reach Agent Cloud, download, verify or install (retryable) | `npm install -g https://agent.cloud/agc.tgz` |
| `ship.agc_outdated` | 1 | The manifest sets keys this agc didn't send | Reinstall, then ship again |

A PATH collision, as `agentcloud doctor` reports it (other checks left out):

```json
{
  "ok": false,
  "product": "agent.cloud",
  "command": "doctor",
  "data": { "checks": [ { "name": "path", "state": "fail", "detail": "PATH finds /usr/local/bin/agc first, which is not agent.cloud.", "fix": "Use `agentcloud` instead of `agc`, or put the npm global bin directory earlier in PATH." } ] },
  "error": { "code": "doctor.checks_failed", "message": "1 check failed: path.", "fix": "Use `agentcloud` instead of `agc`, or put the npm global bin directory earlier in PATH.", "retryable": false },
  "next": [ { "cmd": "agentcloud doctor", "why": "the same CLI under its long name, unaffected by PATH order" } ]
}
```

## Limits

| What | Limit |
|---|---|
| Node (npm install) | 24.22.1 or later (older Node 24 gets a `runtime` warning) |
| One-file builds | darwin-arm64, darwin-x64, linux-x64, windows-x64 |
| Automatic update check | At most once an hour, unless `x-agc-latest` says agc is behind |
| `agc.json` fetch / download | 5 s / 180 s timeout |

## Agent notes

- Prefer the npm install: it is the fix `cli.outdated` names, and it gives you `agentcloud`. On plain text, run `agentcloud doctor`; `--json` forces the envelope.
- After the curl installer, call agc by the absolute path it printed last; a new shell may not have it on PATH yet.
- After `data.agc_updated`, reread AGENTS.md.
- In CI, or to pin a build, set `AGC_NO_UPDATE=1` and install the tarball you tested.

## Related

- [Quickstart: a new app from an empty folder](/docs/getting-started/quickstart-new-app.md)
- [agc environment variables](/docs/reference/agc-environment-variables.md)
- [Local state (`~/.agentcloud`)](/docs/reference/agc-environment-variables.md#local-state)
- [CI/CD with deploy keys](/docs/ship/ci-cd-with-deploy-keys.md)

<!-- feedback:start -->
---
Wrong, outdated or unclear? Run `agc feedback docs "getting-started/installing-agc: <what is wrong>" --body <file>` with the sentence quoted in the file. No code or app data is sent.
<!-- feedback:end -->
