Prepare a reproducible environment for Cursor Cloud Agents
Cover authorization, setup, credentials, egress and pull-request handoff for a Cloud Agent run, with a checklist to verify afterward. Docs only.
Prerequisites and input · Engineering checks · 1. 1. Fix the authorization scope
At a glance
A Cloud Agent is a coding agent that runs in a virtual machine in Cursor's cloud, where the VM holds the cloned repository, installed dependencies, configured secrets and network access. The official page splits one run into six stages: Start, Provision, Run, Persist, Hand off and Recycle. This guide follows that chain to build a checkable preparation list: who may hand the repository over, what goes into the environment, how credentials are injected, how egress is closed down, and in what form the result comes back to a person. The page also states that Cloud Agents run terminal commands automatically and never ask you to approve an action, so reproducibility comes from repository-side preparation and reading logs afterward, not from a runtime prompt.
Runtime and applicability
- Article type
- Engineering practice
- Verified
- Applies to
- Cursor Prepare a reproducible environment for Cursor Cloud Agents
Execution locations and responsibilities
- Cursor Agent execution environment and host Use the workflow below to distinguish responsibilities of the caller, runtime, and external actions.
Arrows show the order of checks in the guide. Follow each step’s prerequisites, branches and stop conditions; unexecuted steps are not completed work.
When to use
- Cloud Agents reach code through the Cursor GitHub or GitLab app, not through any single person's credentials. An admin installs the app on the Git organization and grants access only to selected repositories; each user then connects their own account as a second layer. Access is inherited, never widened. Enterprise teams can add Protected Git Scopes so only their own teams can start Cloud Agents on those repositories.
When not to use
- Cloud Agents do not use Run Modes: they run in their own dedicated machine and never ask you to approve an action, so local approval settings are not a cloud safeguard.
- Snapshots cannot be deleted on demand; they expire after 30 days of inactivity. What can be removed on demand is the conversation transcript and artifacts, through the Delete Agent API.
- Legacy Privacy Mode is not supported for Cloud Agents, because code and environment data must be stored in the cloud while the run is active; standard Privacy Mode is what carries the zero-data-retention terms into each run.
- Hooks do not run during the read-only exploratory turns a cloud agent may start with, so command hooks are not a per-turn checkpoint in that phase.
- Official Setup provides an install script and environment configuration such as .cursor/environment.json. Repository instructions alone do not establish that an environment loads them; confirm actual selection across personal, team and repository-file sources.
Prerequisites and input
- An admin has installed the Cursor app on both sides, in Cursor and at the Git provider, and granted it access only to the repositories you choose; each member who wants to start a task connects their own Git account.
- You have confirmed the target repository is inside the authorized set and that the triggering person can reach it: the page says an agent can only reach repositories the triggering user could already reach, and starting a task never widens access.
- Classify visible non-sensitive configuration, redacted runtime credentials and Docker-build-only credentials as Environment Variables, Runtime Secrets and Build Secrets. Build Secrets do not enter the running agent environment. Assess OIDC short-lived credentials when applicable.
Engineering checks
Who hands over the repository — Cloud Agents reach code through the Cursor GitHub or GitLab app, not through any single person's credentials. An admin installs the app on the Git organization and grants access only to selected repositories; each user then connects their own account as a second layer. Access is inherited, never widened. Enterprise teams can add Protected Git Scopes so only their own teams can start Cloud Agents on those repositories.
What the environment holds — Each agent runs in its own VM boundary rather than a shared process sandbox, on Firecracker-based microVM infrastructure, in a separate cloud account from the rest of Cursor's production infrastructure. The repository, dependencies, secrets and network access all live inside that boundary. Traffic uses TLS 1.2 or higher, data at rest uses AES-256 with per-agent keys, and Enterprise teams can map a customer-managed KMS key.
How the result reaches a person — The agent pushes its branch and opens a pull request for human review, so nothing merges without a person looking at it; pull requests open ready for review unless you ask for a draft. Commits are signed with an HSM-backed Ed25519 key and show a Verified badge. Sessions, transcripts, run events and setup logs are visible from the Cloud Agents dashboard and through the Cursor Cloud MCP, and Enterprise audit logs can stream to a SIEM, webhook or S3.
1. 1. Fix the authorization scope
Where: the app installation and repository grants at your Git provider. Input: the list of repositories this work needs. Action: check that the app is granted only those repositories and that each one has a person who can reach it; Enterprise teams can add Protected Git Scopes on top. Completion check: every repository on the list maps to one authorized installation and one named triggering role. Stop condition: if a repository is reachable only by an admin, stop and have someone with access start the task rather than widening the grant to fit the workflow.
2. 3. Draw the credential boundary
Where: Cloud Agent Secrets and environment configuration. Input: credentials for installation, Docker builds and runtime dependencies. Distinguish Environment Variables (agent-visible non-sensitive configuration), Runtime Secrets (runtime environment values redacted from results/transcripts/commits) and Build Secrets (secret mounts only for a configured Docker build, never injected into the running agent). Configure necessary credentials and permitted networking before installation and Build; assess OIDC where applicable. Completion: each value has a phase, type and owner, without real credentials in the repository. Stop installation for unknown types or missing required credentials; rotate leaked values first.
3. 4. Close down network egress
Where: the network access policy. Input: the domains that build and test need. Action: choose between the default set plus your allowlist and allowlist only, and let an Enterprise admin lock the policy org-wide if needed. Completion check: every external domain maps to an allowlist entry or a documented default. Stop condition: when the domain list cannot be enumerated, do not open all access; narrow the task or switch to a mirror instead.
4. 2. Write the setup steps and their observable points
Where: environment configuration in the Cloud Agents dashboard. Input: the demo repository, its existing installation/check commands and dependencies. Create an environment and select the repository; the setup agent can install dependencies, verify the environment and create its first Build. Advanced cases can use the documented Dockerfile route. A single-repo run may use committed .cursor/environment.json, but automatic selection prefers a personal saved environment, then a team environment, then the repository file. Saved environments initially use None (skip environment.json); explicitly set the file location if it should be read, rather than assuming a commit selects it. Completion: correlate the chosen environment, repo revision, installation script and active Build. Stop before work starts if the configuration source or revision is unclear.install runs when a Build is created and must be idempotent. A Build preserves disk state, not running processes or exported shell variables. Configure persistent services through start or terminals; runtime starts start before terminals. Record build/install versus startup responsibility and inspect service state after startup.Start installation and Build only after required credentials and networking from the preceding steps are ready. Start the work task after Build succeeds and inspect services after start followed by terminals.
5. 5. Define the handoff contract
Where: the branch and the pull request. Input: the completion criteria for the task. Action: state the branch naming and what the pull request description must contain, and name who reviews it; ask for a draft explicitly if you need one, since pull requests otherwise open ready for review. Completion check: the deliverable is a branch plus a pull request, not a change landing on the default branch. Stop condition: if the task cannot be expressed as one pull request, because it spans repositories or needs a human decision midway, split it into several tasks before running.
6. 6. Record retention and deletion paths
Where: the data retention rules and deletion entry points. Input: the kinds of artifact this run produces. Action: separate the four kinds the page lists. The runtime workspace is recycled after the run goes idle; VM snapshots are deleted after 30 days of inactivity and cannot be deleted on demand; conversation state is kept indefinitely by default but removable through the Delete Agent API; secrets are kept until you delete them. Enterprise teams can also cap conversation retention with a policy. Completion check: every artifact kind has one retention rule and one deletion path. Stop condition: if you need a snapshot gone immediately, stop, because the page says snapshots cannot be deleted on demand and follow the inactivity window.
7. 7. Verify against the logs after the run
Where: Cloud Agents dashboard and Cursor Cloud MCP records. Input: the actual configuration, Build and run records. Inspect evidence in the phase where a command actually ran: setup/Build records for environment installation, run events or transcripts for task checks. Do not require all tests to appear in setup logs. Verify the repository revision and environment source, then PR and signing information. Completion: each required step has phase-appropriate evidence and missing observations are explicit. Stop without declaring reproducibility if installation, revision or check evidence is missing.
Task example
Unexecuted synthetic walkthrough: demo-api uses public dependencies and existing repository checks, without real tokens. Create a single-repo environment in the dashboard, supply dependency/install requirements and confirm whether a personal environment, team environment or repository file is selected; set environment.json location when using the file. Once its Build is ready, launch a bounded file task and record active Build plus repo revision. Installation evidence belongs to its environment phase and task checks to their actual run phase; submit the PR for human review. Stop and retain unknowns when source, revision or result is unclear. No fixed two-line log format or usable real environment is claimed.
Completion checks
- Authorization scope, triggering person and repository map one to one, with a recorded decision on Protected Git Scopes.
- No secret exists as plaintext in the repository; Runtime Secrets marking is decided per item and OIDC applicability is written down.
- Every egress domain has a source, and the chosen network mode is recorded.
- All four data kinds have both a retention rule and a deletion path, including that snapshots cannot be deleted on demand.
- The environment source, repository revision and active Build correspond. Installation and task checks have actual phase-appropriate records; unsupported observations remain
unconfirmed.Recordinstall idempotency, the disk-only Build scope and service checks after start followed by terminals.
Verification scope
This guide reads five official sources: Cloud Agent security overview, Setup, Security network, Run Modes security configuration and Hooks. No installation, sign-in, product call or cloud task was executed; no real Build, service startup, artifact or log was observed. Walkthroughs are illustrative.
Sources
All links are official pages; verification dates are listed per source, and links point to the version checked.