AI features

How do I run Cloud Agents on my own machines?

View as Markdown

Self-Hosted Machines moves Cloud Agent tool execution to hardware you manage. Grok Build-managed Cloud Agents stay the default. The agent loop stays in Grok Build's cloud. Your machine runs the tools.

How do I connect a self-hosted machines worker in a few minutes?

Install cursor-agent, the CLI that runs the worker, from https://cursor.com/install, then pick one path. On Windows, install it with irm 'https://cursor.com/install?win32=true' | iex and add Git for Windows.

My Machines (one engineer, one box):

Bash

curl https://cursor.com/install -fsS | bash
cursor-agent login
cd /path/to/repo
cursor-agent worker start --name "my-devbox"

Use a personal API key instead of browser login when the machine has no browser:

Bash

export CURSOR_API_KEY="<personal-api-key>"
cursor-agent worker start --name "my-devbox"

Pools (shared team fleet):

Bash

export CURSOR_API_KEY="<service-account-api-key>"
cd /path/to/repo
cursor-agent worker --pool start

Pool workers need a service account API key. Personal API keys register a My Machines worker, not a pool worker.

Team admins must enable self-hosted workers in the Cloud Agents dashboard before members can connect pool workers.

Keep the process running. The worker connects outbound over HTTPS. No inbound ports or VPN are required.

Which self-hosted machines path should I use?

You care aboutLikely path
Perimeter or compliance onlyStart with managed Cloud Agents and private connectivity. Use a pool only when you also need execution on your hardware.
One engineer, one boxMy Machines
Org fleet, Kubernetes, or GPUsPools
A partner VM or sandboxIntegrations
You do not want to run infraManaged Cloud Agents
"Is Grok Build on-prem now?"No. See Is Grok Build on-prem now?

What are self-hosted machines for Cloud Agents?

Grok Build keeps the agent loop: inference and planning. Your source code, secrets, and tool execution stay on your machine.

You can run workers on a VM, Kubernetes node, Mac, GPU box, or a partner sandbox. Common reasons to use Self-Hosted Machines:

  • Custom hardware, such as GPUs or Macs for iOS work
  • Secrets and build artifacts that must stay in your infrastructure
  • Private Git or package registries your machine can already reach
  • Sandboxes where you manage cloning and git state yourself

If your only concern is reaching private source control from Grok Build's cloud, try managed Cloud Agents with private connectivity before you operate your own workers.

Is Grok Build on-prem now?

No. Grok Build is not an on-prem product. The agent loop stays in Grok Build's cloud. You register a machine you operate, and Grok Build sends tool calls to it over an outbound HTTPS connection.

Your checkout, build cache, and machine-local credentials stay on your hardware. See What data stays on my machine vs. in Grok Build's cloud? for the full split.

How does self-hosted machines connectivity differ from managed Cloud Agents?

Both options keep the agent loop in Grok Build's cloud. They differ in where tool execution runs and how private repos and internal tools are reached.

Managed Cloud AgentsSelf-Hosted Machines
Where tools runGrok Build-managed VMs in Grok Build's cloudA machine you operate (VM, Kubernetes node, laptop)
Network directionGrok Build connects into your environment when you set up private connectivityYour worker connects outbound to Grok Build over HTTPS
Private Git or registriesUse PrivateLink or Cloudflare Tunnel so Grok Build's cloud can reach your SCM over a private pathThe worker uses local network access, PATs, or SSH keys already on the machine
Inbound firewall rules for Grok BuildOften required for private connectivity endpoints or tunnelsNot required. Grok Build never connects into your network
HTTP MCP serversGrok Build backend reaches hosted MCP URLsGrok Build backend still reaches hosted MCP URLs
Command (stdio) MCPRuns in the cloud VM unless configured otherwiseRuns on your worker and can reach private endpoints

Choose managed Cloud Agents with private connectivity when you want Grok Build to operate the execution environment but still reach private source control from Grok Build's cloud.

Choose Self-Hosted Machines when execution must stay on hardware you control and that hardware can already reach your repos and internal services. You do not open inbound HTTPS for Grok Build to reach your tools. The worker reaches them locally and reports results back over the outbound session.

See Do Self-Hosted Machines require inbound network access or a VPN? for outbound hosts and Cloud Agents for managed setup.

What is the difference between a pool and my machines?

PoolsMy Machines
Who uses itShared team fleetOne person's machine
AuthenticationService account API keycursor-agent login or personal API key
CLIcursor-agent worker --pool startcursor-agent worker start --name "…"
RoutingAny team member's request can route to an available workerSessions route to machines on your account
Typical useCompany-wide capacity, Kubernetes, GPU fleetsPersonal devbox, Mac, or remote VM

A pool is a named routing target. Chats wait in the pool until a worker claims them. One agent claims each pool worker at a time.

My Machines (also called Remote Control) connects one machine you own. Multiple agents can run on the same machine when it has enough resources.

For Kubernetes fleets, start from the anysphere/k8s-workers template, which runs cursor-agent worker controller --spawn in your cluster without a CRD. The older WorkerDeployment operator is deprecated; its reference stays available for clusters that already run it.

Pools require an Enterprise plan and a service account API key. My Machines uses a personal credential.

How do admins enable or require self-hosted machines?

Team admins open the Cloud Agents dashboard and go to Self-hosted machines.

  • Enable self-hosted machines: members can opt in to runs on machines they connect. Without opt-in, Cloud Agents use Grok Build's managed infrastructure.
  • Require self-hosted and personal machines: every Cloud Agent session must use a self-hosted or personal machine.

The dashboard also shows pool details and machines registered under My Machines.

Can I run self-hosted machines on a third-party VM or sandbox?

Yes. Pool workers can run on a partner platform, or from a reference template you clone. Grok Build still runs the agent loop. The worker on that VM or sandbox runs tools and connects outbound over HTTPS.

See Integrations for the partner guides and templates.

Partner guides cover AWS Lambda, Cloudflare, Namespace, Modal, Daytona, E2B, Vercel, Tensorlake, Superserve, and Render. Reference templates cover AWS Lambda MicroVMs, Cloudflare Containers, and Kubernetes.

You can also install cursor-agent on a VM you already run and start a worker yourself with cursor-agent worker start or cursor-agent worker --pool start.

Do self-hosted machines require inbound network access or a VPN?

No. The worker initiates a single outbound HTTPS connection from your machine to Grok Build's cloud. Grok Build sends agent requests down that connection. Your machine never needs to be reachable from the internet.

You do not need inbound ports, firewall changes, or VPN tunnels. If your network uses an HTTPS proxy, set HTTPS_PROXY or https_proxy in the worker environment.

Workers need outbound access to api2.cursor.sh, api2direct.cursor.sh, api3.cursor.sh, downloads.cursor.com, agent-stores.s3.us-east-1.amazonaws.com, and cloud-agent-artifacts.s3.us-east-1.amazonaws.com. Without agent-stores.s3.us-east-1.amazonaws.com, artifacts and screenshots fail to upload even though the agent keeps working. See Networking for a connectivity check, and What leaves your network for the full data flow.

What data stays on my machine vs. in Grok Build's cloud?

Your source code, build artifacts, secrets, and tool execution stay on your machine. That includes file edits, terminal commands, and network calls the agent makes locally.

Grok Build's cloud handles the agent loop: inference requests and planning. Results from tool calls flow back to Grok Build for the next inference round, but your raw code and machine-local secrets are not stored in Grok Build-managed infrastructure. Grok Build stores the dashboard secrets you sync to pool workers with --sync-dashboard-secrets, encrypted at rest like every Cloud Agent secret.

Privacy Mode applies the same way it applies to managed Cloud Agents. When enabled, code sent from the worker is not used for training by Grok Build or model providers.

Do Cloud Agent environments work on self-hosted machines?

Partly. A Cloud Agent environment is the saved setup a Grok Build-hosted agent starts from: repositories, dependencies, secrets, startup commands, and network access. A self-hosted run uses only the environment's repositories. Pool workers started with --sync-dashboard-secrets also get team and user secrets once a team admin turns on Secret sync.

Other settings, such as install and startup commands, Builds, network access, and environment-scoped secrets, apply only to Grok Build-hosted Cloud Agents. Set those up on the machine, in the worker image, or with sessionStart hooks. See Environments on Self-Hosted Machines for what replaces each setting.

Can I use a pool for any repository without specifying one?

Yes. Any-repo pools decouple source control from the pool. One pool can serve many repositories.

Bash

cursor-agent worker --pool my-pool --worker-dir "$HOME/cursor-sandboxes/default" start

Pass --clone-git-repos so the worker clones repos on claim. When you start an agent, pick the pool under Any repo. With the API, set env.name to the pool in POST /v1/agents. You can list several repos in repos, and the worker clones each one.

Select the repository as well as the pool. A run started with only a pool selected names no repository, so Grok Build mints no GitHub token for it and the worker has nothing to clone.

Without --clone-git-repos, an any-repo pool can use an always-applied workspace rule to map task subjects to repositories and clone them with worker credentials.

In Slack, a team admin can run @Cursor pool set <name> to make an any-repo pool the team default pool. @Cursor mentions then start on that pool without pool= in the message, even when no repository resolves. Any team member can run @Cursor pool set <name> channel to set a channel default pool that does the same for one channel.

This setup only applies to any-repo pools. Repo-backed pools route requests to workers that already have matching checkouts.

How do I connect private or self-hosted GitLab?

For private or air-gapped self-hosted GitLab, use an any-repo pool so the SCM lifecycle stays on your workers.

  1. Create a pool without binding it to one repository.
  2. Start workers from a workspace directory on a machine that can reach your GitLab instance.
  3. Authenticate git with a local personal access token or SSH key on the worker. You do not need Grok Build's GitLab OAuth for the worker checkout.

The agent accesses private repos through the network access your machine already has. This pattern also helps when developers work across many repositories.

See the GitLab integration docs for OAuth-based Cloud Agent setup on managed infrastructure.

Can agents use the screen or browser on a self-hosted machines worker?

Yes, on macOS and Linux workers. Install desktop packages on Linux first, then start with --computer-use:

Bash

cursor-agent worker --computer-use start

On macOS, the first start installs the Cursor Computer Use helper. Grant it Accessibility and Screen Recording. Desktop sharing with --share-desktop works on Linux and macOS; on macOS it shows the real desktop and is watch-only unless you pass --share-desktop view_and_control. For browser use, install Chrome or Chromium on the runner.

See Computer use and desktop sharing for dependencies and setup.

Does a pool worker keep files between agents?

A pool worker process serves one agent and exits when its claim is released or reset, so your supervisor can replace the machine. If your supervisor restarts workers on the same disk, files the previous agent left in the worker directory are still there. Reset checkouts at the start of each claim with --on-session-start, for example git fetch, git reset --hard, and git clean -fdx against the claimed ref. See Session lifecycle.

Do hooks and MCP work on self-hosted machines?

Yes, with some differences from managed Cloud Agents.

Hooks: Workers run project hooks from .cursor/hooks.json. Enterprise plans also get team hooks and enterprise-managed hooks on self-hosted workers. sessionStart and sessionEnd run when a session claims a worker and when that claim is released. See the hooks support matrix and Hooks on pools.

MCP: Command (stdio) MCP servers run on your worker and can reach private networks. HTTP and SSE servers still run from Grok Build's backend. Some MCP gaps remain on self-hosted workers; check the changelog for the latest status.

How do I troubleshoot a self-hosted machines setup?

Start with these basics:

  1. Check the dashboard. Open the Cloud Agents dashboard and confirm workers show as connected, idle, or in use under My Machines or pool details.
  2. Run diagnostics. Run cursor-agent worker debug for worker preflight checks (add --json for machine-readable output). The report covers auth, connectivity, routing, and backend visibility.
  3. Worker missing from the UI. If the worker process is running locally but does not appear in Grok Build, the cause is usually outbound connectivity. Confirm the machine can reach api2.cursor.sh and api2direct.cursor.sh over HTTPS. See Do Self-Hosted Machines require inbound network access or a VPN?.
  4. Pool controller issues. The built-in worker controller is new. Treat controller and autoscaling setups as early deployments and document fixes as patterns emerge on your team.

Worker preflight report:

Bash

cursor-agent worker debug

The report covers authentication, connectivity, routing, repository labels, and whether Grok Build can see your worker.

Common fixes:

  • Confirm the worker process is still running
  • Confirm the Agents Window app and cursor-agent use the same account (cursor-agent status shows it)
  • Check that the worker directory has the expected Git remote for repo-backed workers
  • Check outbound HTTPS access to the hosts listed in What leaves your network

For connection issues before the worker starts, run cursor-agent worker start --debug. Include cursor-agent worker debug output when you contact support about persistent setup problems.

How do I make sure SCM permissions are honored?

Self-hosted runs use two layers: Grok Build routing (which worker serves a request) and git credentials on the worker (what that worker can clone, fetch, or push).

Grok Build routing

  • My Machines: Grok Build only routes a repository request to a worker when one of its registered --worker-dir roots matches that repo. Start the worker from the correct checkout or add another --worker-dir.
  • Repo-backed pools: Requests match both the pool name and a repo=<owner/repo> label. A request for pool=my-pool and repo=acme/payments routes only to a worker serving that repo.
  • GitHub triggers: On public repos, only users with OWNER or COLLABORATOR access can route a run to a self-hosted pool. Other commenters stay on managed infrastructure unless your team requires self-hosted for all runs.
  • Org controls: Protected Git Scopes still apply. Connect each user's Git account under Integrations so Grok Build can verify repository access before a run starts.

Git access on the worker

  • Existing checkouts (My Machines or repo-backed pools): The agent uses git credentials already on the machine, such as SSH keys or a personal access token in your credential helper. Grant each worker only the repo access it needs.
  • Any-repo pools with --clone-git-repos: The worker clones on claim using a short-lived SCM token minted for the user who started the run. --clone-git-repos implies --mint-scm-token. The token covers every repo in the request. A team admin must turn on SCM token minting in Cloud Agents → Self-hosted Machines. The worker flag and the team setting are both required, and the requesting user must have access to each of those repositories in GitHub.
  • Private or self-hosted GitLab: Authenticate git on the worker with a local PAT or SSH key. See How do I connect private or self-hosted GitLab?.

When git fails but the worker is connected

  1. Run cursor-agent worker debug and confirm repository labels match the repo in the request.
  2. On the worker, run git fetch or git ls-remote with the same credentials the agent will use.
  3. Confirm the Grok Build user who started the run can access the repository in your Git provider and on the Integrations page of the Grok Dashboard.
  4. For pool clone-on-claim, confirm token minting is enabled and the pool is an any-repo named pool (not default).

Grok Build never widens repository access beyond what the triggering user already has. If a run reaches the wrong checkout or cannot push, fix routing labels or worker git credentials rather than sharing a single broad service token across unrelated repos.

What if I see rate limits?

Contact support.

How do I check if my pool is at capacity?

Check worker capacity in the Cloud Agents dashboard. Pool details and My Machines list workers by status.

For programmatic checks, call the summary API:

Bash

curl --request GET \
  --url "https://api.cursor.com/v0/private-workers/summary" \
  -u "$CURSOR_API_KEY:"

The response includes connected and in-use worker counts for your user and team.

Common reasons an agent run does not start:

  • No workers connected: start or scale workers in the pool, or confirm a My Machines worker is running
  • All workers busy: requests wait in the pool queue until a worker is free
  • Private worker limit exceeded: your team hit the connected worker cap (200 per user, 1000 per team). Disconnect unused workers or contact sales to discuss higher limits
  • Repository mismatch: start the worker from the correct checkout or use an any-repo pool

Workers send heartbeats while connected. A worker drops from the registry after it stops heartbeating. See pools for scaling and controller setup.


Last updated: November 24, 2026