Paste this into your coding agent
How it works
- Cursor runs the agent loop and the model. You start agents from cursor.com/agents, the desktop app, Slack, GitHub, Linear, or the Cloud Agents API.
- Your Agent37 instance runs
agent worker, the worker from Cursor’s CLI. It executes each tool call in your checkout and sends the results back. - The worker only makes outbound HTTPS connections to Cursor (
api2.cursor.sh,api2direct.cursor.sh, and an artifact bucket). The instance needs no public URL or open port.
Before you begin
- An Agent37 API key in
AGENT37_API_KEYand a funded workspace wallet. Create a key in the dashboard. - A Cursor user API key from Cursor Dashboard > API Keys, exported as
CURSOR_API_KEY. It connects the instance as one of your My Machines, which needs no Enterprise plan. For a team fleet, see Team Pools. - The repository the agent works on, exported as
REPO_URL(for examplehttps://github.com/your-org/your-repo). - Node.js,
curl, andjqon your computer. The cloud build needs no local Docker.
1. Build the worker image
Put thisDockerfile in an empty folder:
Dockerfile
/opt and puts agent on the PATH, since /home/node is the instance’s persistent home and is mounted over the image at runtime. Add the toolchain your repository needs in the same way, outside /home/node. The main process keeps the instance available; you start the worker after cloning.
Build it as a workspace template:
--default-port: the worker needs no listening port.
2. Create the instance
CURSOR_API_KEY from its environment, where commands the agent runs can read it too, so use a key dedicated to this instance.
3. Clone the repository
exit_code is 0. For a private repository, use a URL that carries a token with read access, or SSH into the instance and clone it with your own credentials. The checkout’s origin remote tells Cursor which repository this machine serves.
4. Start the worker
stdout contains Worker is now running with the name agent37. If it does not, run agent worker --worker-dir /home/node/repo debug through exec: it checks the key, the repository, and whether Cursor can see the worker.
5. Run an agent and read its file
Open cursor.com/agents, pick agent37 in the environment menu, and send a task. Or start one through the Cloud Agents API:status is FINISHED:
stdout is the instance id, which is its hostname. That verifies the Cursor agent ran its command on your Agent37 instance.
Team Pools
On a Cursor Enterprise plan, the same image serves a Team Pool. Create the instance with a service account API key asCURSOR_API_KEY, then start the worker with a pool name:
--idle-release-timeout 0 keeps an always-on worker connected; by default a pool worker exits after an hour idle. Start pool agents with env: { type: "pool", name: "agent37" }, or pick the pool on cursor.com/agents.
Lifecycle and cleanup
The worker stops with its instance. If you stop, restart, or update the instance, start the worker again with step 4. The checkout in/home/node/repo, with its dependencies and build output, survives all of those.
When you no longer need the machine, delete the instance and revoke its Cursor key in the Cursor dashboard:
Provider listing
Cursor lists infrastructure partners on its Self-Hosted Machines integrations page, each linking to the partner’s own guide. Everything needed to add Agent37 is below.Provider description
Partner guide entry