
# agentcloud.toml reference

`agentcloud.toml` at the app's root describes the app to Agent Cloud: its services, database, checks and what it needs from the organization. agc finds it by walking up from the working directory, the way git finds `.git`. A valid file makes `agc doctor` report `manifest … parses`.

```toml
[app]
name = "camp-bookings"

[service.web]
build   = "."
port    = 8080
command = "node server.js"
dev     = "npm run dev"
health  = "/healthz"

[data.db]
env        = "DATABASE_URL"
migrations = "migrations/"
mask = [
  "bookings.parent_email:email",
]

[[check.invariant]]
name = "no overbooked camp"
sql  = "SELECT c.id FROM camps c JOIN bookings b ON b.camp_id = c.id GROUP BY c.id HAVING count(*) > max(c.capacity)"

[[check.smoke]]
name  = "book under contention"
steps = [
  "POST /api/camps {name: 'Race {run}', capacity: 1} -> 201 as camp",
  "POST /api/camps/{camp.id}/bookings {child: 'Sam'} -> 201|409 x20",
]
```

This illustrative flow requires your app to implement both routes and the camps/bookings schema; creating a camp must return its `id`. It is not a complete starter app.

## Reference

### Every key

Generated from the readers. "agc (Schema)" is the reader in `manifest-schemas.ts`. "control, from the snapshot" means Agent Cloud reads it from the shipped snapshot's own copy, so no agc version can drop it. "As written (judged later)" means agc passes the value through and the command or Agent Cloud that uses it validates it.

<!-- generated: keys -->
| Table | Key | agc reads it as | Read by | `agc init` writes it |
|---|---|---|---|---|
| `[data.analytics]` | `branches` | as written | agc (DataAnalytics) | – |
| `[production]` | `egress_allow` | a string or a list of strings | agc (Production) | – |
| `[outside]` | `fake` | a string or a list of strings | agc (Outside) | – |
| `[features]` | `map` | as written | agc (Features) | – |
| `[storage]` | `max_object_mb` | as written | agc (Storage) | – |
| `[[check.browser]]` | `name` | as written | agc (Proves) | – |
| `[[check.browser]]` | `proves` | as written | agc (Proves) | – |
| `[data.analytics]` | `required` | as written | agc (DataAnalytics) | – |
| `[release]` | `start_within` | as written | agc (Release) | – |
| `[storage]` | `uploads` | as written | agc (Storage) | – |
| `[app]` | `control` | a string | config.ts | – |
| `[app]` | `description` | as written | agc (App), control, from the snapshot | – |
| `[app]` | `listed` | as written | agc (App), control, from the snapshot | – |
| `[app]` | `name` | a string | agc (AppConfig), agc (Name), agc (AppName), config.ts | yes |
| `[app]` | `org` | a string | config.ts | – |
| `[app]` | `started` | as written | agc (App) | – |
| `[app]` | `starter` | as written | agc (App) | – |
| `[app]` | `title` | as written | agc (App), control, from the snapshot | – |
| `[auth]` | `provider` | as written | agc (Auth), control, from the snapshot | – |
| `[auth]` | `public` | as written | agc (Auth) | – |
| `[auth]` | `theme` | as written | agc (Auth) | – |
| `[service.web]` | `build` | a quoted path | control, from the snapshot | yes |
| `[service.web]` | `command` | as written | agc (AppConfig), agc (Web) | yes |
| `[service.web]` | `cpu` | as written | agc (AppConfig) | – |
| `[service.web]` | `cross_origin` | as written | agc (AppConfig), agc (Web) | – |
| `[service.web]` | `dev` | as written | agc (AppConfig), agc (Web) | yes |
| `[service.web]` | `env` | as written | agc (Env) | yes |
| `[service.web]` | `health` | as written | agc (AppConfig) | yes |
| `[service.web]` | `memory` | as written | agc (AppConfig) | – |
| `[service.web]` | `port` | a number | agc (AppConfig) | yes |
| `[service.worker]` | `build` | a quoted path | control, from the snapshot | – |
| `[service.worker]` | `command` | as written | agc (AppConfig) | – |
| `[service.worker]` | `cpu` | as written | agc (AppConfig) | – |
| `[service.worker]` | `dev` | as written | agc (AppConfig) | – |
| `[service.worker]` | `env` | as written | agc (Env) | – |
| `[service.worker]` | `instances` | as written | agc (AppConfig) | – |
| `[service.worker]` | `memory` | as written | agc (AppConfig) | – |
| `[data.db]` | `env` | a string (default "DATABASE_URL") | agc (AppConfig) | yes |
| `[data.db]` | `mask` | as written | agc (AppConfig) | yes |
| `[data.db]` | `migrations` | a string (default "migrations/") | agc (AppConfig) | yes |
| `[data.db]` | `seed` | as written | agc (AppConfig) | – |
| `[secrets]` | `required` | as written | agc (Secrets) | yes |
| `[connection.<name>]` | `access` | "read" or "write"; other values are ignored | manifest.ts appConfig | – |
| `[[asset]]` | `path` | a string | agc (AppConfig) | – |
| `[mirror]` | `egress_allow` | as written | agc (Mirror) | – |
| `[mirror]` | `expire_idle` | a number of days, like "3d" | agc (AppConfig) | yes |
| `[[check.smoke]]` | `after` | a string | lint only: `agc check` and `agc ship` warn that it isn't read | – |
| `[[check.smoke]]` | `headers` | a table of strings | agc (Checks) | – |
| `[[check.smoke]]` | `hold` | a string | lint only: `agc check` and `agc ship` warn that it isn't read | – |
| `[[check.smoke]]` | `name` | as written | agc (Checks), agc (Proves) | – |
| `[[check.smoke]]` | `proves` | as written | agc (Proves) | – |
| `[[check.smoke]]` | `steps` | a list of strings | agc (Checks) | – |
| `[[check.smoke]]` | `until` | a string | lint only: `agc check` and `agc ship` warn that it isn't read | – |
| `[[check.invariant]]` | `after` | a string | agc (Checks) | – |
| `[[check.invariant]]` | `hold` | a string | agc (Checks) | – |
| `[[check.invariant]]` | `name` | as written | agc (Checks), agc (Proves) | – |
| `[[check.invariant]]` | `proves` | as written | agc (Proves) | – |
| `[[check.invariant]]` | `sql` | a string (default "") | agc (Checks) | – |
| `[[check.invariant]]` | `until` | a string | agc (Checks) | – |
| `[[verify]]` | `expect` | as written | agc (Verify) | – |
| `[[verify]]` | `goal` | a string (default "") | agc (Verify) | – |
| `[[verify]]` | `name` | as written | agc (Verify), agc (Proves) | – |
| `[[verify]]` | `path` | as written | agc (Verify) | – |
| `[[verify]]` | `proves` | as written | agc (Proves) | – |
<!-- /generated: keys -->

### What the keys do

| Key | Rules |
|---|---|
| `[app] name` | 3 to 40 lowercase letters, digits and hyphens, starting with a letter. It's the app's address (`<name>.agent.cloud`) and can't change; `agc init` refuses placeholder names like `demo-app`. |
| `[app] org` | The organization this folder builds in. agc uses this machine's agent for that organization; without one, commands fail with `auth.no_identity_for_org`. Written by `agc init`. |
| `[app] control` | The Agent Cloud origin the app lives on, written by `agc-staging init` as `"https://staging-agent.cloud"`. Omitted means production. An https origin (http only for localhost), no path, query or credentials, or `manifest.invalid`. |
| `[app] starter` | `"<stack>@<version>"`, recorded by `agc init` when the app began from a starter. |
| `[app] title`, `description`, `listed` | The app's card in its organization's launcher. agc sends at most 80 characters of `title` and 300 of `description`; `listed` is a boolean. |
| `[auth] provider` | `"agent.cloud"` (default), `"edge"` (the target's gate signs people in; the app reads `x-agc-user-email` and `x-agc-user-name`, and on Agent Cloud's own gate `x-agc-user-role` for members of its organization) or `"none"` (public). Anything else: `manifest.bad_auth` at ship. |
| `[auth] theme` | The sign-in pages' look: `"dark"` (default), `"light"` or `"system"` (the browser's choice). Anything else: `manifest.bad_auth_theme` (exit 2) before anything is sent. Applies once the release is live. |
| `[auth] public` | Up to 20 paths that reach the app without the target's sign-in, for webhook senders: exact (`"/hooks/github"`) or a prefix (`"/api/slack/*"`), never `/__agc` or `/auth/sign-out`. Only with `provider = "edge"` (`ship.public_needs_edge`); a bad path: `ship.bad_public`. No identity header arrives on them, so the app checks each sender's own signature. A release that adds a path asks a person. |
| `[service.web] build` | `"."` (or absent): the root Dockerfile, or Agent Cloud's detected Node or Python image. A Dockerfile path (`Dockerfile`, `Dockerfile.<x>`, `<x>.Dockerfile`, `Containerfile`) builds it with the repo root as context; a folder builds its own Dockerfile with the folder as context. Not a quoted plain path: `ship.bad_build`; nothing there: `ship.build_missing`. |
| `[service.web] port` | The port the app listens on in production. Default 8080. On a mirror the app gets `PORT` instead; listen on `PORT`. |
| `[service.web] command` | The start command in production. On a mirror, used only when `dev` is absent. A Python app must set it (`ship.no_command`). |
| `[service.web] dev` | What `agc up` runs, through the shell. Absent: `command`, split on whitespace; with neither key, `npm run dev` when `package.json` has a `dev` script, else `npm start`. |
| `[service.web] health` | A path like `/healthz`. A mirror waits up to 60 s for a 2xx there (or for anything under 500 on `/` without one); a release switches traffic only once it answers. |
| `[release] start_within` | How long the web and private services may take to answer ready in a rehearsal or release: whole minutes from `"3m"` (the default) to `"10m"`, like `start_within = "6m"`. Set it when the app needs longer to boot (loading a model, warming a cache); past the limit the step fails with `not ready within N minutes`. Any other value is refused with `manifest.invalid`. |
| `[service.web] cpu`, `memory` | What each instance asks for: `cpu` 0.1 to 64, `memory` like `"512Mi"` or `"2Gi"` (64Mi to 256Gi). Setting either on any service gives unset ones 0.5 CPU and `"1Gi"`. Over the cap: `ship.over_cap`. |
| `[service.web] cross_origin` | Up to 20 paths that accept changes from other sites (webhooks): exact (`"/api/public/signup"`) or a prefix (`"/api/webhooks/*"`). Everything else gets 403 `cross_origin` from the edge and from a mirror's proxy. |
| `[service.web] env`, `[service.worker] env` | Plain settings that aren't secret, as a table of text: `env = { ALLOW_SIGNUP = "false" }`. Names are `[A-Z][A-Z0-9_]*`, at most 50 a service, values at most 4,096 characters, arriving exactly as written. Production and rehearsals get them from the next `agc ship`, a mirror at `agc up` (the worker gets only its own). A value that looks like a secret is refused (`ship.env_secret`, `mirror.env_secret`), and so is `PORT`, an `AGC_`/`AGENTCLOUD_` name, the `[data.db] env` name or a `[secrets] required` name (`ship.env_reserved`, `mirror.env_reserved`). A set secret of the same name wins; on a mirror, `.env.mirror` does. |
| `[service.worker] command` | A second process from the same image. Without a non-empty `command` there's no worker. Up to 300 characters. |
| `[service.worker] dev`, `instances`, `cpu`, `memory` | `dev` replaces `command` on a mirror; `instances` is clamped to 1 to 4 (default 1). |
| `[service.worker] build` | Must be absent or equal to `[service.web] build` (`ship.worker_build`): a worker runs from the web image. |
| `[data.db] env` | The variable your code reads the database URL from. Default `DATABASE_URL`. `agc doctor` warns when no source file mentions it. |
| `[data.db] migrations` | The migrations folder. Default `migrations/`. Files are `<digits>_<slug>.sql` or `<digits>_<slug>/migration.sql`. |
| `[data.db] mask` | Extra mask rules, `"table.column:type"` (`email`, `phone`, `address`, `person`, `text`, `keep`). Agent Cloud masks by inference anyway; a `:keep` on a column the platform masks is ignored (only the app's owner can make a column visible, in the console). |
| `[data.db] seed` | `"seed.sql"` (run once, in one transaction, on a mirror that starts empty) or `{ command = "…" }` (run like `dev`, with the mirror's environment). Never runs in production. A missing file: `seed.missing`. |
| `[secrets] required` | A list of secret names (`[A-Z][A-Z0-9_]*`). `agc ship` refuses while one isn't set (`ship.secret_missing`). |
| `[connection.<name>] access` | `"read"` or `"write"`: what the organization's connection `<name>` must grant this app. Not granted: `connection.not_granted` (exit 12). Other values are ignored. |
| `[[asset]] path` | A file or folder too big for the snapshot, uploaded separately and unpacked at the same path before the build. Up to 8. |
| `[mirror] expire_idle` | `"<N>d"`. Default `"3d"`. Sent when the mirror is created. |
| `[mirror] egress_allow` | `["host:port", …]` the mirror's app may reach besides Agent Cloud. `*.example.com:443` works and warns. Malformed entries are ignored with a warning. |
| `[production] egress_allow` | `["host:443", …]`, the public hosts a release calls when the app runs on its organization's own target: one exact DNS name on 443 per entry (no wildcard, IP or other port), at most 20, else `egress.bad_entry`. Each is approved by an owner for that app in the console; until then the ship stops with `egress.not_approved`. On Agent Cloud itself entries are checked but need no approval. |
| `[mcp] server`, `reason` | Whether people's agents can use the app. `server = "app"` serves them through the app's own `/mcp`, which the starters build and declare. An app that doesn't says why: `server = "none"` with `reason`, 10 to 200 characters (`reason = "a webhook receiver; no people use it"`), shown on its ship receipt and console page; `server = "none"` takes no `[mcp.scopes]`. A new app with neither is refused at ship with `ship.mcp_required`, and signed in, `agc doctor`'s manifest check fails with the same words. `agc help mcp` covers the table. |
| `[storage] uploads`, `max_object_mb` | Preview: built, but not switched on where Agent Cloud runs apps, so a ship that declares `[storage]` is refused with `storage.not_available`. `uploads` takes only `true`; `max_object_mb` is 1 to 100 (default 25). |
| `[[check.invariant]]` | `name`, `sql` (must return no rows), `hold` (`"empty"` default, `"unchanged"`, `"equal:<check>"`), `after` and `until` (migration stems). See [Invariants](/docs/checks/invariants.md). |
| `[[check.smoke]]` | `name`, `steps` (strings), `headers` (a table of strings). See [Smoke step grammar](/docs/checks/smoke-flows.md#step-grammar). |
| `[[verify]]` | `name`, `goal` (required; an entry without one is skipped), `path` (must start with `/`, default `/`), `expect` (SQL that returns a row once the goal is done). |
| `proves` | On `[[check.smoke]]`, `[[check.invariant]]` and `[[verify]]`: a list of the feature map's part ids this check proves. Anything but a list of text is refused, naming the key. |
| `[features] map` | `true` (the default) or `false`. `false` turns the app's feature map off, so `agc check` and `agc ship` don't read `features.toml`. Any other value is refused, naming the key. |

### Keys `agc init` writes that nothing reads

<!-- generated: unread -->
| Table | Key | Written by |
|---|---|---|
| `[data]` | `store` | `agc init` (`manifestToml` in commands/init.ts) |
| `[data.db]` | `engine` | `agc init` (`manifestToml` in commands/init.ts) |
| `[data.db]` | `tool` | `agc init` (`manifestToml` in commands/init.ts) |
| `[data.db]` | `access` | `agc init` (`manifestToml` in commands/init.ts) |
| `[mcp]` | `server` | `agc init` (`manifestToml` in commands/init.ts) |
| `[mcp]` | `reason` | `agc init` (`manifestToml` in commands/init.ts) |
| `[release]` | `watch` | `agc init` (`manifestToml` in commands/init.ts) |
<!-- /generated: unread -->

They're harmless; `agc check` doesn't warn about them because it lints only `[[check.*]]`. Leave them or delete them.

## Errors

A broken file makes every command that reads it fail with `manifest.invalid` (exit 2), naming the file, line and column or the key and what it takes.

| Code | Exit | Cause | Fix |
|---|---|---|---|
| `manifest.invalid` | 2 | Not valid TOML, a key of the wrong type (a table where a string goes), or a refused `[app] control`. | Fix the line or key the message names. |
| `manifest.bad_auth` | 2 | `[auth] provider` isn't one of the three values. | Use `agent.cloud`, `edge` or `none`. |
| `manifest.bad_auth_theme` | 2 | `[auth] theme` isn't `light`, `dark` or `system`. | Use one of the three, or remove it. |
| `ship.bad_env`, `ship.env_secret`, `ship.env_reserved` | 1 | A plain `env` name or value Agent Cloud refuses; `agc up` refuses the same as `mirror.bad_env`, `mirror.env_secret`, `mirror.env_reserved` (exit 2). | Move a secret to `[secrets] required` and `agc secret set`; rename a reserved name. |
| `ship.bad_public`, `ship.public_needs_edge` | 1 | `[auth] public` isn't a list of at most 20 plain paths, or the app isn't behind the edge. | Fix the paths, or set `[auth] provider = "edge"`. |
| `egress.bad_entry` | 1 | A `[production] egress_allow` entry isn't one public host on 443, or there are more than 20. | Name each host exactly, like `"api.example.com:443"`. |
| `egress.not_approved` | 1 | A host isn't approved for this app on its target yet. | Relay the link; ship again once an owner approves. |
| `storage.not_available` | 1 | The manifest declares `[storage]`, and storage isn't offered where the app runs. | Remove `[storage]` to ship without it. |
| `ship.bad_build`, `ship.build_missing`, `ship.worker_build` | 1 | `build` isn't a usable path. | Point it at a committed Dockerfile or folder. |
| `ship.mcp_required` | 2 | A new app's manifest has no `[mcp] server`, or `server = "none"` without a valid `reason`. | Keep the starters' `/mcp` and `[mcp] server = "app"`, or set `server = "none"` with `reason = "<why, 10 to 200 characters>"`, then ship again. |
| `ship.bad_cross_origin` | 1 | `cross_origin` isn't a list of at most 20 plain paths. | Plain paths, optionally ending `/*`. |
| `ship.bad_resources`, `ship.over_cap` | 1 | `cpu`/`memory` out of range, or more than the app may ask for. | Lower them. |
| `ship.agc_outdated` | 1 | The manifest sets `[auth] provider`, `[app] title`, `description` or `listed`, and this agc didn't send it. | `npm install -g https://agent.cloud/agc.tgz`. |
| `check.unknown_migration` | 1 | An `after` or `until` names no migration. | Use the stem `agc migration new` printed. |

```json
{"ok":false,"product":"agent.cloud","command":"ship","error":{"retryable":false,"code":"manifest.invalid","message":"/work/camp-bookings/agentcloud.toml line 4, column 1 is not valid TOML: …","fix":"Fix the TOML syntax at that line of agentcloud.toml (an unclosed [table], a missing quote or =), then run the command again.","docs":"agc help manifest"},"next":[{"cmd":"agc help manifest","why":"what agentcloud.toml takes"},{"cmd":"agc doctor","why":"check the manifest with the rest of the setup"}]}
```

## Agent notes

- `agc check` and `agc ship` warn about an unknown check kind, a key a check doesn't read, an `after`/`until` that names no migration, and invariants with no racing smoke flow (a write step with `xN`). Read `data.warnings`.
- Changing `[auth] provider` on a live app needs a person's approval; the mode changes when that release goes live.
- Keep secret values out of this file and out of `.env*` files you ship: snapshots never include `.env*`, but a value in `agentcloud.toml` would ship.
- `hold = "unchanged"` and `"equal:<check>"` are proven around migrations by `agc migrate`, not by `agc check`.
- `after`, `until` and `hold` belong on `[[check.invariant]]`; on a `[[check.smoke]]` they only draw a lint warning.
- For a feature tested end to end in a browser, write a `[[verify]]` entry; a `[[check.browser]]` table is ignored with a warning pointing at `agc help verify`.
- Agent Cloud applies the plain SQL files in `migrations/`. A `[data.db] tool = "command"` makes `agc check`, `agc migrate`, `agc up` and `agc ship` refuse with `cli.not_available` before running anything: convert the app's migrations to `<digits>_<slug>.sql` files (`agc migration new <slug>`), then remove `tool`, `apply` and `ledger` or set `tool = "sql"`.

## Related

- [Smoke step grammar](/docs/checks/smoke-flows.md#step-grammar)
- [Invariants](/docs/checks/invariants.md)
- [Migrations](/docs/data/migrations.md)
- [Secrets](/docs/build/secrets.md)
- [The mirror sandbox and egress](/docs/build/the-mirror-sandbox-and-egress.md)

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