Table of Contents
- What Cursor self-hosted agents change
- When a self-hosted machine is worth it
- My Machines or Team Pools
- What Cursor self-hosted agents cost
- Run a Cursor worker on Agent37
- One always-on machine
- Sleep between sessions on a Team Pool
- Five problems to avoid
- FAQ
- Do Cursor self-hosted agents need an Enterprise plan?
- Does self-hosting lower the Cursor bill?
- Does my code leave my machine?
- Can several agents share one machine?
- Which providers does Cursor list?
- Can the agent run Docker?
- Run your first self-hosted Cursor agent
What Cursor self-hosted agents change
ã…¤ | Cursor-hosted | My Machines | Team Pools |
Where tool calls run | A VM Cursor manages | Your machine | Your worker fleet |
How the worker signs in | Nothing to sign in | Your login or a user API key | A service account key (Enterprise plan) |
Agents per machine | One VM per agent | Several can share one machine | One agent per worker |
Dashboard secrets | Team, user, and environment | None, the machine's own credentials | Team and user, with Secret sync |
Who keeps it running | Cursor | You | Your team |
api2.cursor.sh, api2direct.cursor.sh, and two artifact buckets, so the machine needs no open port and no public address.When a self-hosted machine is worth it
- Your code or services can't be reached from outside. Commands run inside your network, next to private registries and internal APIs.
- You need different hardware. More memory, a GPU, a Mac for iOS builds, or arm64. Cursor's hosted VMs are x86_64 only.
- Your environment is hard to rebuild. An existing image or build pipeline that would be painful to recreate as a Cursor environment.
- The work should persist. A checkout with installed dependencies and a warm build cache is still there for the next agent, so it skips the setup minutes.
sessionStart hook.My Machines or Team Pools
agent login or a user API key, and run agent worker start in a checkout. The machine then shows up under My Machines in the environment menu at cursor.com/agents, and in the Cloud Agents API as env: { type: "machine" }. Several agents can run on it at once. The worker uses the checkouts it already has, so it never clones or switches branches on its own.--clone-git-repos, and a worker controller can start machines as requests arrive. Pool workers exit after an hour idle by default.What Cursor self-hosted agents cost
Setup | What it does | Agent37 cost |
One always-on worker | 2 vCPU, 4 GB RAM, 4 GB disk, connected around the clock | $4.76 a month |
A larger worker | 4 vCPU, 8 GB RAM, 6 GB disk, for heavier builds | $9.34 a month |
One instance per pool agent | Runs about an hour a day, stopped the rest | About $0.54 a month each |
A stopped instance | Keeps the checkout, uses no compute | $0.36 a month for 4 GB |
Full VM, always on | Its own kernel, runs Docker | $11.36 a month |
Run a Cursor worker on Agent37
One always-on machine
Read https://www.agent37.com/docs/agents-api/cursor and follow the setup.
Build the worker image, create an Agent37 instance with my Cursor API key, clone my repository into /home/node/repo, and start the Cursor worker on it.
My keys are in AGENT37_API_KEY and CURSOR_API_KEY, and the repository is in REPO_URL.
Done when a Cursor agent started on the machine named agent37 writes hello.txt in the repository and Agent37 exec reads it back./opt:FROM node:22-bookworm-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates curl git python3 ripgrep tini \
&& rm -rf /var/lib/apt/lists/*
RUN curl https://cursor.com/install -fsS | HOME=/opt/cursor-cli bash \
&& ln -s /opt/cursor-cli/.local/bin/agent /usr/local/bin/agent
USER node
WORKDIR /home/node
ENTRYPOINT ["tini", "--"]
CMD ["sleep", "infinity"]npx agent37 templates build . --name cursor-worker, which builds in the cloud with no local Docker. Create an instance from it with your Cursor key in its environment and auto-sleep off, then clone your repository into /home/node/repo through Agent37's exec API. Last, start the worker inside the instance:agent worker --worker-dir /home/node/repo --name agent37 starthostname and saved the output to hello.txt. Reading that file back through exec returned the instance's own id, so the command had run on our machine. The setup guide has every request in full.Sleep between sessions on a Team Pool
Five problems to avoid
- Install the CLI outside the home directory. An Agent37 instance mounts its persistent disk over
/home/node, so anything the image puts there disappears at runtime. Install under/optand linkagentonto thePATH.
- Leave auto-sleep off for an always-on worker. The worker's outbound connection doesn't count as activity, so a sleeping instance stops taking agents.
- Read the worker's log after you start it. A background launch returns at once, even when the worker fails. Look for
Worker is now running, or runagent worker debugto check the key, the repository, and whether Cursor can see the machine.
- Give each machine its own Cursor key. The worker reads
CURSOR_API_KEYfrom its environment, where commands the agent runs can read it too. Revoke the key when you delete the machine.
- Clone before you start a My Machines worker. It serves the checkouts it already has, and the checkout's
originremote tells Cursor which repository the machine serves.
