Tested Templates & Toolstested before it ships

● Server & Claude Code

Run the Cursor agent worker as a systemd service

cursorsystemd

agent worker start is the long-running process for Cursor My Machines. Cursor's own guide says the agent loop runs in Cursor's cloud, tool calls run on your machine, and the worker opens an outbound connection rather than listening for one. The unit below is that process. It does not grant sudo.

What was checked

The flags below were read from agent --help and agent worker --help on Cursor agent CLI 2026.10.16-e3cb207. agent worker start --help only lists --verbose. The name, directory, token file, and idle-release flags belong to agent worker, and this version still accepts them after start. A start with those flags and a directory that was not there exited 1 and printed only Invalid worker directory: does not exist. On systemd 255, systemd-analyze verify of the unit below exits 1 until /home/agent/.local/bin/agent exists. The same text with that path pointed at an installed agent binary, and with User=agent left as written, exits 0. The worker was not started, so this page does not claim the process stayed up, registered a machine, or survived a reboot.

Cursor's My Machines guide says the worker stays connected until you stop it. The same CLI's help says --idle-release-timeout defaults to 3600 seconds, then the process exits 0 so a supervisor can start a clean one. Passing 0 disables that idle exit. The unit passes 0. An hour-long idle was not watched.

The unit

Create a normal user and group named agent, with a home directory, and install the CLI as that user. The unit below expects the binary at /home/agent/.local/bin/agent. Run command -v agent as that user and change ExecStart if the path differs. Then put this in /etc/systemd/system/cursor-agent-worker.service:

# /etc/systemd/system/cursor-agent-worker.service
[Unit]
Description=Cursor agent worker (My Machines)
After=network-online.target
Wants=network-online.target
StartLimitIntervalSec=0

[Service]
Type=simple
User=agent
Group=agent
WorkingDirectory=/home/agent
Environment=HOME=/home/agent
Environment=PATH=/home/agent/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ExecStart=/home/agent/.local/bin/agent worker start --name devbox --worker-dir /home/agent/src/app --auth-token-file /home/agent/.config/cursor-worker-token --idle-release-timeout 0
Restart=always
RestartSec=10
NoNewPrivileges=yes

[Install]
WantedBy=multi-user.target
sudo systemd-analyze verify /etc/systemd/system/cursor-agent-worker.service
sudo systemctl daemon-reload
sudo systemctl enable --now cursor-agent-worker
systemctl status cursor-agent-worker

You run those commands. Do not put them in this account's sudoers.

Why each line is there

LineReason
StartLimitIntervalSec=0 in [Unit]A missing directory makes agent worker start exit 1. In [Service] this key is silently ignored, and the unit then gives up after 5 fast failures. Create the directory before enable --now, or Restart=always will keep retrying.
User=agentNot root. The worker executes tool calls as this user.
--name devboxA label you choose. The default is the machine hostname. The docs use this flag so a chat request can name the machine.
--worker-dirThe checkout the worker exposes. The path has to exist. On this CLI a missing path exits 1 before a connection.
--auth-token-fileThe token is the contents of a mode-600 file owned by agent. It is not an argument, so it is not on the process command line.
--idle-release-timeout 0Turns off the 3600-second idle exit printed by this CLI's help. Other release reasons still apply.
NoNewPrivileges=yesThe service cannot gain privileges it does not already have.

The token file

Cursor's My Machines guide shows agent worker start --api-key with the key in the command. Do not put that line in a unit. The command line is visible to other users in the process list. Create the file as agent, mode 600, one line, and keep it out of the unit and out of the shell history:

install -d -m 700 /home/agent/.config
install -m 600 /dev/null /home/agent/.config/cursor-worker-token
# as the agent user, write the token into that file with an editor

A personal user API key or a user-scoped token is what My Machines accepts. A service-account key is for --pool, which this unit does not set. --pool is the enterprise shared worker. Leave it off unless that is the product you meant to run. There is a separate browser login, agent login, for a machine where you can open a browser. This unit uses the file so a VPS does not need one.

What this unit leaves off

These flags are real, and they are not in the unit: --computer-use, --share-desktop, --connect-workspace, and --pool. Computer use and desktop sharing let a cloud agent drive a desktop on the box. Connecting the workspace downloads a server onto the machine. The pool is a different auth mode. Do not add --force or --yolo either. Those are not worker flags, and they are not how you keep a restart policy.

Before you give that user sudo

Anything the worker can run, a cloud agent session can run, as agent. Do not give that account passwordless sudo, and do not let it edit SSH or the firewall. Paste a unit or a sudoers snippet into the lockout paste check first. It runs in the browser and does not upload the paste. A clean result is not a guarantee. The same checks run locally as the MCP server. The Claude Code version of a long-running agent is a different command: remote control as a systemd service.

The Agent Ops Kit ($19) does not include this Cursor worker. It is the Claude Code unit, the preflight checks, Telegram check-ins, and a ledger. The Multi-Vendor AI Council Ops Kit ($39) does not include this Cursor worker either. It is separate Linux accounts for Claude Code, Codex CLI, Gemini CLI, and Grok, with a review branch and scoped sudo.

Need a VPS to try this on? Everything here was tested on a DigitalOcean Ubuntu 24.04 droplet: get one on DigitalOcean. The DigitalOcean link pays the site owner account credit, not cash. Any other affiliate link may pay a commission. Your price is the same. Disclosure.