Enterprise
Set Up Cursor Cloud Agents: Environment, Repo, First Run
To set up a Cursor Cloud Agent, give its environment the repositories, dependencies, secrets and network access a developer would have. Cursor prepares environments in the background with Builds: it clones the repositories and runs install ahead of time, then runs start and terminals when an agent begins. Agents start from the latest successful Build.

On this page
What is a cloud agent environment?
A cloud agent environment is the machine the agent works on: cloned repos, installed dependencies, secrets, startup commands and network access. Cursor compares it to the setup on your laptop. An agent that can write code but can't run tests, query services or reach APIs can't close the loop on its work. Cursor calls environment setup the most important step for making cloud agents effective.
The clip below follows one run from prompt to pull request.
Cloud Agent opens the PR
0:40 · narratedRead this demo as text
- This prompt asks for a pull request when the work is ready. Not a merge. Send it on a Cloud Agent so it runs in an isolated VM, on its own branch, while you keep moving.
- And boom, the remote build lands. Three files in the file components/search, Changes panel open. Your machine stayed free the whole time. That is the point of shipping the work to the cloud.
- Green checks on the PR tab. Read the diff, then merge it yourself. Cloud Agents hand you proof. They do not deploy.
Practice next: Practice this yourself in the hands-on module.
Simulated Cursor 3.12 (macOS, light) — beta educational reconstruction, not the real product.
What happens without environment setup?
An unconfigured agent still produces work. It reads the repo and hands you a plausible diff that nobody has run. Verifying it falls to whoever opens the pull request: they check out the branch and run the suite by hand, which is the work the agent was supposed to save.
Configured environments make agent sessions faster because the tools are already installed instead of being set up from scratch every time. Cloud Agent BuildsPrepared Cloud Agent environments built in the background, with the last successful build kept active when a newer build fails. Press Enter for the full definition. prepare repositories, tools and dependencies in the background, so agents start from a ready-to-use machine.
Check yourself · one question
Where should each API environment command run?
From the Lesson Know what a Build preserves — about 1 minute, free to read.
Rather do it than read about it? Run 11 interactive Cursor walkthroughs in a simulated editor. Free, no account needed.
How do I configure the environment?
Cursor documents two main ways to configure an environment, plus a private-beta option for Enterprise teams. Both main ways let you specify an install script, which Cursor runs while it creates a Build, so dependencies are ready before an agent starts.
- Option
- Agent-driven setup (recommended)
- How it works
- Cursor's agent installs dependencies, verifies the environment and creates its first Build in under 10 minutes, while you watch in a shared terminal
- When to use it
- Most repos; fastest path to a reusable environment
- Option
- Manual setup with Dockerfile (advanced)
- How it works
- You write a Dockerfile for system-level dependencies, compiler versions or a different base OS and reference it from
.cursor/environment.json - When to use it
- Advanced cases needing specific system packages
- Option
- Cursor-configured Dockerfiles (private beta)
- How it works
- Cursor inspects your repos and produces a Dockerfile-based config you edit and version
- When to use it
- Enterprise teams who don't want to write a Dockerfile from scratch
| Option | How it works | When to use it |
|---|---|---|
| Agent-driven setup (recommended) | Cursor's agent installs dependencies, verifies the environment and creates its first Build in under 10 minutes, while you watch in a shared terminal | Most repos; fastest path to a reusable environment |
| Manual setup with Dockerfile (advanced) | You write a Dockerfile for system-level dependencies, compiler versions or a different base OS and reference it from .cursor/environment.json | Advanced cases needing specific system packages |
| Cursor-configured Dockerfiles (private beta) | Cursor inspects your repos and produces a Dockerfile-based config you edit and version | Enterprise teams who don't want to write a Dockerfile from scratch |
Cursor-configured Dockerfiles are in private beta for Enterprise; request access via your account representative or hi@cursor.com.
Agent-driven setup is the fastest path and the one Cursor recommends. A Dockerfile takes longer to write, but it is text you can diff line by line, and editing one rebuilds only the changed layers. The private-beta option splits the difference: Cursor writes the Dockerfile and you keep its version history.
Team size decides this more reliably than repo complexity. When thirty people depend on one environment, a change to the machine should arrive as a diff that someone reviews. So on a large team, we'd write the Dockerfile even where agent-driven setup would work, and accept the slower setup.
What does agent-driven setup involve?
Start guided setup from the Cloud AgentsAgents that run in a Cursor-managed virtual machine, check out the repo, do the work and open a pull request, then shut down, with no load on your laptop. Press Enter for the full definition. dashboard. You connect a GitHub, GitLab, Azure DevOps or Bitbucket account, select one or more repositories, and provide the environment variables and secrets needed to install dependencies and run the code. You can watch the agent's progress in a shared terminal. Cursor saves the environment once it verifies the code and completes a successful Build, and future agents start from the active Build. Commit the configuration to .cursor/environment.json so the whole team benefits.
Cursor resolves environment configuration by repository or repo group and uses the first match: a personal saved environment, then a team saved environment, then .cursor/environment.json in the repository (single-repo runs only). Teams get predictable defaults, and individuals can override them to test a new configuration before rollout.
A saved environment reads .cursor/environment.json only when its environment.json location points at that file. Environments you create start with the location set to None (skip environment.json), so pick the file's repository when you create the environment if you want it used.
For work that spans more than one repo, select multiple repositories when you create the environment. Cursor clones each into the agent machine and reuses the environment for future runs and automations that use the same repo group.
How do Cloud Agent Builds change environment setup?
Builds move repository cloning and dependency setup out of the agent's startup path. Cursor prepares a bootable environment in the background, records the environment version and the exact commit of each repository, and keeps the latest successful Build active for future agents, automations and code reviews.
Environment builds can no longer be turned off. Cursor's release notes for the week of September 28, 2026 say every environment that isn't a draft now gets automatic Builds. Teams that require Self-Hosted Machines are the exception: Builds run on Cursor-hosted machines, so Cursor doesn't build those teams' environments or their members' personal environments.
- Phase
- Build
- When it runs
- Ahead of agent runs
- What belongs there
- Clone repositories, run
install, generate code, compile artifacts, warm disk caches
- Phase
- Agent start
- When it runs
- When the first prompt starts a run
- What belongs there
- Run
startfor Docker, databases, tunnels, and other fresh services
- Phase
- Shared terminals
- When it runs
- At agent start
- What belongs there
- Launch app processes from
terminalsin sharedtmuxsessions
| Phase | When it runs | What belongs there |
|---|---|---|
| Build | Ahead of agent runs | Clone repositories, run install, generate code, compile artifacts, warm disk caches |
| Agent start | When the first prompt starts a run | Run start for Docker, databases, tunnels, and other fresh services |
| Shared terminals | At agent start | Launch app processes from terminals in shared tmux sessions |
Builds preserve disk state. Running processes, shell exports, and in-memory caches do not survive the snapshot.
A failed Build never replaces the working one. Agents keep starting from the last successful Build while you inspect logs, commit SHAs and the Build each run used. Fix the failure anyway, before the active Build drifts too far from the repository state you expect.
- 1Save the environment. Saving its configuration or changing its secrets starts a new Build.
- 2Confirm the Build succeeds and becomes active. Until an environment has a successful Build, agents start on Cursor's default image without the environment's setup.
- 3Start an agent and confirm which Build it used: ask it to call the Cursor Cloud MCPModel Context Protocol. A standard that lets an AI agent pull in context from outside the repo, like Jira tickets or internal docs. Press Enter for the full definition.
environment-infotool, whosebuildfield has the Build ID. Then check that Build's logs and commits in the Builds tab. - 4If a Build fails, open it to inspect its logs, or start an agent from the failed Build to reproduce the problem.
The Cloud Agent BuildsPrepared Cloud Agent environments built in the background, with the last successful build kept active when a newer build fails. Press Enter for the full definition. guide covers activation, failed-Build debugging, staleness settings and Build provenance in detail.
What do the install and startup commands do?
Cursor runs the install script, install in environment.json, while it prepares a Build. The dashboard and docs used to call it the update script. start and any configured terminals run only when an agent starts, and each phase has its own job.
- install
- Runs during each Build. Put dependency installation, generated code, compilation and disk-cache warming here. Keep it complete and idempotent, because Cursor may run it repeatedly on prepared disk state.
- start
- Runs at the start of each agent session. Put Docker, databases, tunnels and other services that must be fresh here.
- terminals
- Starts app processes for the agent run in a
tmuxsession shared by you and the agent.
A successful Build captures disk state after install completes and becomes active. Later agents start from that prepared disk, so they don't clone the repository or install the same dependencies again. The environment.json reference covers the exact command fields and the idempotency contract.
Put durable preparation in install and live processes in start. A database server started during a Build is gone after Cursor snapshots the machine, while installed packages and generated files remain. Commands for services an agent needs only on some tasks belong in AGENTS.md, so the agent can run them when the work calls for them. Write that section for someone who has never seen the repo.
Cloud agents read AGENTS.md files. Cursor recommends a dedicated section for cloud-only setup and testing instructions, titled something like "Cursor Cloud specific instructions." If it gets large, reference other files with detailed instructions for specific tasks.
How do I provide secrets and AWS access?
Cursor recommends the Secrets tab on cursor.com, which exposes each value to the agent as an environment variable. Cloud agents often need secrets such as API keys and database credentials to run and test code like a developer. Cursor's docs add guidance for three situations.
- Environment-scoped secrets
- Use these when a credential should be available only to agents that use one environment. They apply to every repo in that environment and aren't available to other environments.
- Sign-in credentials and 2FA
- Add the same login credentials you use locally as secrets. For TOTP-based 2FA, add the TOTP shared secret too; the agent generates the current 6-digit code with
oathtool --totp -b "$TOTP_SECRET". - Monorepos with multiple .env.local files
- Add values from all of them to the same Secrets tab, use unique variable names when keys overlap (such as
NEXTJS_*andCONVEX_*), and reference them from each app.
Cursor also documents a shortcut that it stops short of recommending. Any .env.local files present when you take a snapshot can be saved into it, so later agents find the values without a Secrets entry. Rotating a key then means taking a new snapshot instead of editing a field. The docs still call the Secrets tab the recommended approach for security and management.
Saving environment configuration or changing its secrets triggers a new Build. Team and environment secrets can be used during Builds. User secrets are added only when an agent starts, so they never enter the shared snapshot. If a credential is missing, check whether the new Build succeeded and whether the secret belongs to the Build or the run. The secrets troubleshooting page covers the full ladder.
For AWS, Cursor can assume an IAM role you provide, so you grant permissions without sharing long-lived credentials.
- 1Create the IAM role in your AWS account and note its ARN.
- 2Add a user or team secret named
CURSOR_AWS_ASSUME_IAM_ROLE_ARNset to that ARN. - 3Have a team admin generate an external ID in the Advanced section of team settings.
- 4Update the role's trust policy to trust Cursor's role assumer, with your team's external ID as the condition.
Cursor then sets AWS_CONFIG_FILE, AWS_PROFILE=cursor-cloud-agent and AWS_SDK_LOAD_CONFIG=1, so the AWS CLI and SDKs pick up the profile automatically.
Cursor assumes the role with STS credentials that expire after 1 hour. When the agent wakes, Cursor refreshes credentials that are missing, invalid or within 15 minutes of expiration. You don't export AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY or AWS_SESSION_TOKEN yourself.
Can cloud agents reach private services and Docker?
Yes, with some VM-specific configuration. Cloud agents support Docker workflows and can reach private services through Tailscale or Cloudflare Tunnel. Each card gives the pattern Cursor documents.
For simple setups, installing Docker is often enough. Because Docker runs inside another container layer, more complex setups should start from the fuse-overlayfs and iptables-legacy configuration, and make sure your cloud agent user can run Docker.
Tailscale's default networking mode does not work in cloud agent VMs; use userspace networking instead. Start tailscaled with --tun=userspace-networking plus the proxy flags, export the proxy variables, then run your usual tailscale up. The VM cannot act as a tailnet exit node.
cloudflared runs in userspace, so it works. Run a connector inside your private network, route an authenticated hostname through the tunnel, add it to the network allowlist if you use restricted egress, and store Access service tokens (CF_ACCESS_CLIENT_ID, CF_ACCESS_CLIENT_SECRET) as Cursor Secrets.
Two of the cards come down to userspace networking. Tailscale needs it because its default mode doesn't work in these VMs, and cloudflared works as shipped because it already runs in userspace. Docker is the awkward one, because it runs inside another container layer. If a private service is unreachable, check the egress allowlist first: on a restricted-egress environment, a missing hostname looks much like a tunnel that never came up.
The Cloudflare card covers HTTP services. For private databases, the docs use a Cloudflare TCP Access app with cloudflared access tcp in your startup command, and point your test command at the local listener it opens. That command belongs in start, not install, because it has to keep running while the agent works.
Keep tunnel tokens and Access service token secrets in Cursor Secrets, not in your repository, and rotate them after testing if they were created for a proof of concept.
Frequently asked questions
Do Cloud Agent environments always use Builds?
Almost always. Cursor's release notes say environment builds can no longer be turned off, so every environment that isn't a draft gets automatic Builds and agents start from the latest successful one. Teams that require Self-Hosted Machines are the exception, because Builds run on Cursor-hosted machines. A failed Build never replaces the last successful active Build.
What does an agent start from before the first successful Build?
Until an environment has a successful Build, agents start on Cursor's default image without the environment's setup, such as its snapshot, Dockerfile or install command. After that, they start from the latest successful Build, and a failed Build never replaces it.
Where do I keep environment configuration in code?
Commit a .cursor/environment.json to your repository. A saved environment reads it only when its environment.json location points at that file. Builds use the configuration from the environment's default branch. For a change on a feature branch, commit and push it, then start an agent on that branch. Cursor checks out the branch on top of the active Build, and the agent can rerun the install command if the branch changes dependencies. The file can reference a snapshot ID or a .cursor/Dockerfile. In build, the dockerfile and context paths are relative to .cursor, while the install command runs from your project root.
Can I increase the memory and CPU for a cloud agent?
Each cloud agent runs on a default VM profile with limited memory and CPU. On an Enterprise plan, if your repo needs more resources you can contact support to increase limits for your workspace. Cursor notes that self-serve custom resource configuration is coming soon.
Sources & last verified
- Cursor - Cloud Agent Setup
- Cursor - Cloud Agent Builds
- Cursor Changelog - Cloud Agents Start 3x Faster with Builds
- Cursor - Cloud Agents Settings (dashboard)
- Cursor - Agents Window
- Cursor - AGENTS.md
- Cursor Docs: Release notes
Cursor ships frequently. Facts verified against primary sources on October 28, 2026.