Agents
anycloud's CLI is designed so AI coding agents can drive deployments end-to-end — submit, monitor, terminate, attribute cost.
Session tagging
Every anycloud submit (CLI or Python SDK) is stamped with the session of the agent that invoked it. Tagged deployments show up in anycloud list and anycloud status with the agent name and session id, and can be filtered by either.
Auto-detected agents:
| Agent | Marker env | Native session id env |
|---|---|---|
| Claude Code | CLAUDECODE | CLAUDE_CODE_SESSION_ID |
| Codex | CODEX_BIN_PATH | — (uses <agent>-<ppid>) |
| Cursor | CURSOR_TRACE_ID | CURSOR_TRACE_ID |
| Aider | AIDER_MODEL | — (uses <agent>-<ppid>) |
Detection is TTY-guarded: when the CLI is running in an interactive shell (you typed the command), auto-tagging is suppressed — even if the shell was opened from inside an agent.
Filter deployments by agent or session:
anycloud list --agent claude # all deployments from Claude Code
anycloud list --session abc-123-def # exact session match
anycloud list --agent claude --status Failed --json
Machine-readable output
Every command that prints a table also accepts --json for compact, parseable output:
anycloud list --json # one-line JSON array
anycloud status <id> --json
anycloud cost --json # aggregate report
anycloud cost <id> --json # per-deployment fields
anycloud regions aws --vm-type p4d.24xlarge --json
anycloud list also supports two output modes optimized for piping:
anycloud list --csv # header + one row per deployment
anycloud list --only-ids --status running # one ID per line; pairs with xargs
Combine with filters for batch operations:
anycloud list --only-ids --status Failed | xargs anycloud terminate
Self-documenting CLI
anycloud --help lists every command; for full product context an agent can fetch the docs directly:
anycloud docs # short index — titles + descriptions
anycloud docs --all # full markdown corpus (every concept, guide, reference)
anycloud docs --url # print the URL only — for piping or caching
anycloud docs is a thin wrapper over https://anycloud.sh/llms.txt and https://anycloud.sh/llms-full.txt, so an agent without the CLI installed can curl the same URLs.
Per-session spend controls
Cap an agent's burn rate or daily spend so a runaway loop can't drain your account. The --agent-session flag on throttle and budget applies the cap per session — each agent run is capped independently, so one agent hitting its cap doesn't block other work.
anycloud throttle set 20 --agent-session # each session: $20/hr
anycloud budget set 100 --per day --agent-session
Account-wide caps (the default, no --agent-session) coexist with per-session caps. Both are checked before dispatch; whichever is tighter wins. See Spend Controls for the full surface.
Read-only DB query
anycloud db query runs a SELECT, WITH, EXPLAIN, or PRAGMA against the local API database. Writes are refused. Useful when an agent (or you) needs to answer a question the CLI doesn't have a flag for.
anycloud db query "SELECT id, state, agent, session FROM deployments WHERE state='Failed' ORDER BY started_at DESC LIMIT 20" --json
anycloud db query "SELECT d.session, SUM(COALESCE(v.cost, 0)) AS spent FROM deployments d JOIN vms v ON v.deployment_id = d.id WHERE d.agent='claude' GROUP BY d.session ORDER BY spent DESC" --json
Discover tables and columns with anycloud db schema:
anycloud db schema # all tables
anycloud db schema deployments # columns, FKs, indexes for one table
anycloud db schema --json # parseable