Cloud Agents

Worker command reference

View as Markdown

A self-hosted worker runs Cloud Agent tool calls on a machine you control. The worker is the worker command of cursor-agent, the CLI that runs self-hosted workers: cursor-agent worker opens one outbound connection to Grok Build's cloud and executes tool calls locally, so no inbound port is needed. Self-Hosted Machines explains when to run one; this page is the command surface.

Already using agent worker

The installer creates two names for the same program, cursor-agent and agent, so an existing agent worker … command line keeps working unchanged. These pages use cursor-agent, the program's own name, which no other tool on your PATH is likely to claim. See Moving from agent worker.

Install cursor-agent

curl https://cursor.com/install -fsS | bash

The installer puts cursor-agent and agent in ~/.local/bin on macOS and Linux, and cursor-agent.exe and agent.exe in its install directory on Windows. It downloads from downloads.cursor.com. A Windows worker also needs Git for Windows, including Git Bash. Then check the install:

Bash

cursor-agent --version

Sign in

A worker has to be signed in before it can register. Use the browser flow on a machine with a desktop, and a key everywhere else.

Bash

cursor-agent login     # opens a browser
cursor-agent status    # the account this machine signs in as
cursor-agent logout    # clears the stored credential

On a headless machine, set NO_OPEN_BROWSER=1 to print the login URL instead of opening a browser, or authenticate with an API key:

Bash

export CURSOR_API_KEY=your_api_key_here
cursor-agent worker start

--api-key <key> passes a key on the command line instead, though another local user can read it from the process list. --auth-token-file <path> reads the token from a file, which suits operator-managed Secret mounts and short-lived session tokens.

A pool worker cannot use a personal login. Pools authenticate with a team service account key—see pools.

Subcommands

SubcommandDescriptionUsage
startRun a worker in this terminal until Ctrl+Ccursor-agent worker start
debugCheck what start would register, without starting a workercursor-agent worker debug
controllerClaim pending pool requests and run a hook for each, or keep warm workerscursor-agent worker controller --spawn <path>
Stopping a worker

There is no status or stop subcommand. To stop a worker, signal the cursor-agent worker start process (Ctrl+C, SIGTERM, or your process manager's stop). grok worker in the Grok Build TUI doesn't always start this worker; see Moving from agent worker. Use cursor-agent worker for everything on these pages.

Options

These belong to cursor-agent worker, so they go before or after start.

Identity and workspace

OptionDescription
--name <name>Display name for the worker. Defaults to the hostname.
--worker-dir <path>Workspace root offered to Cloud Agents. Repeatable; the first one is the worker's identity and defaults to the current directory.
--data-dir <path>Directory for logs, artifacts, and recordings. Defaults to /opt/cursor when writable, otherwise ~/.local/share/cursor-agent.

Credentials

OptionDescription
--api-key <key>API key the worker registers with. Prefer CURSOR_API_KEY.
--auth-token-file <path>File holding the worker's auth token, for operator-managed Secret mounts.

Pools and routing

OptionDescription
--pool [name]Join a team Self-Hosted Pool instead of registering a personal worker. One Cloud Agent claims the worker at a time, and the name defaults to default.
--single-useLegacy alias for --pool.
--pool-name <name>Deprecated alias for --pool <name>; needs --pool or --single-use.
--label <key=value>Routing label. Repeatable, and cannot be combined with --labels-file.
--labels-file <path>JSON or TOML file of worker labels.
--idle-release-timeout <seconds>Seconds the worker stays connected after it goes idle before it is released. 0 turns this off. Defaults to 3600. Every release exits the worker with code 0, so run it under a supervisor.
--mint-scm-tokenReceive short-lived source control tokens during a claimed run. Needs --pool, and a team admin must turn on SCM token minting. --mint-github-token is a legacy alias.
--sync-dashboard-secretsReceive the team's dashboard secrets as environment variables during a claimed run. Needs --pool and an admin opt-in.
--clone-git-reposCheck out the claimed run's repositories in the worker's workspace, reusing a clean checkout of the same repository. Any-repo pool workers only.
--on-session-start <command>Command run on this host once a pool claim lands. hooks.json remains the primary configuration.
--on-session-end <command>Command run before a pool claim is torn down.

MCP servers

OptionDescription
--mcp-tool-timeout <server[/tool]=seconds>How long a tool call to a stdio MCP server may take. Repeatable; server/tool wins over server, and 0 fails each call without waiting.

Identity tokens and health

OptionDescription
--identity-socketGive each Cloud Agent its own OIDC identity socket, at CURSOR_AGENT_SOCKET. Off by default. See OIDC tokens.
--management-addr <address>Serve worker health over HTTP for Kubernetes probes and scraping: GET /healthz, GET /readyz, and GET /metrics, for example on :8080.
--wait [seconds]Wait for another worker using the same data directory to stop, then start. Without seconds, waits as long as it takes.
--verboseVerbose startup logs, including debug output. Goes after start.
--debugPrint the debug report before the worker starts.

Subcommand options

SubcommandOptionDescription
debug--jsonEmit the debug report as JSON.
controller--pool <name>Pool to watch. Repeatable.
controller--spawn <path>Hook run once per claimed request, or per missing warm worker. It must exit 0 within 60 seconds, so start the worker in the background; a hook that fails or runs longer is killed and the claim goes back to the queue.
controller--all-poolsWatch every pool on the team, without registering any. Cannot be combined with --pool.
controller--repository <url>Only take requests for this repository. Required for repository-scoped keys.
controller--session-tokenGive the hook a token that serves only its claim, as CURSOR_AUTH_TOKEN, in place of the API key. Write it to a file and start the worker with --auth-token-file.
controller--warm-idle <count>Keep this many idle workers connected in each --pool without claiming, and let the server assign queued requests to them. At most 100; run one warm controller per pool.
controller--identity-audience <aud>Give the hook a short-lived identity token for each claim, bound to this audience, so it can verify the user before provisioning.

Environment variables

VariableEffect
CURSOR_API_KEYAPI key used for authentication, instead of --api-key.
CURSOR_WORKER_NAMEWorker display name, instead of --name.
CURSOR_WORKER_LABELS_FILELabels file path, instead of --labels-file.
CURSOR_WORKER_IDLE_RELEASE_TIMEOUTIdle release timeout, instead of --idle-release-timeout.
CURSOR_WORKER_POOL_NAMEPool name, instead of --pool-name.
CURSOR_DATA_DIRData directory, instead of --data-dir.
NO_OPEN_BROWSERSet to 1 so cursor-agent login prints the URL rather than opening a browser.
HTTPS_PROXY, https_proxyProxy for the worker's outbound connection.

These keep the CURSOR_ prefix because cursor-agent reads them on disk and in CI today; renaming them would break every existing deployment.

Moving from agent worker

Nothing changes. agent and cursor-agent are two names for the same installed program, so agent worker start … and cursor-agent worker start … take the same flags and register the same worker. Switch scripts to cursor-agent when you next touch them.

A machine moved to the Grok Build TUI with cursor-agent update --channel grok points agent, cursor-agent, and grok at the new build, and cursor-agent worker there still runs the same worker. To move back, run cursor-agent update --channel cursor.

Don't swap in grok worker. Which worker it starts depends on your grok build: some builds hand it to this same worker, and others run a separate worker that signs in differently, renames --mint-scm-token to --mint-github-token, has no --computer-use, --display, --share-desktop, or --verbose, and doesn't read CURSOR_DATA_DIR. Nothing tells you which one you got, so run cursor-agent worker.

Check a worker before you rely on it

cursor-agent worker debug reports what start would register without starting anything: the account the credential belongs to, the privacy mode, each registration's labels, and the workers that session can already see.

Bash

cursor-agent worker debug --json

Run it first whenever a worker registers but never receives a run. Pools covers pool-side causes, and My Machines covers single-machine ones.


Last updated: November 23, 2026