Fix
Fix: Cursor Cloud Agent Can't Access Secrets
If a cloud agent can't see a secret, start a new agent: Cursor injects secrets when an agent starts, so a running agent never picks up one you add later. Agents that start from a Build get the change once a newer Build finishes. If a fresh agent still can't read it, check the secret's type and repository scope.

On this page
Why can't my cloud agent access secrets?
You added an API key on the dashboard and started a cloud agent, and the run fails anyway. The test suite wants DATABASE_URL, the agent says the variable is unset, or printenv in the shared terminal comes back empty. Cursor's docs and forum threads point to these causes:
- The agent started before the change reached it. Secrets are injected when an agent starts, so a running agent keeps its old values, and an agent that starts from a Build gets a change only once a newer Build finishes.
- The scope doesn't cover this run. Environment-scoped secrets apply only to agents using that environment, and a secret limited to other repositories skips the one you launched against. Cursor's docs also call secrets team-scoped, so check that you started the agent from the right account.
- The secret has the wrong type. A Build Secret is only available to the Docker build, so the running agent never sees it. A Runtime Secret still reaches the process as an environment variable, even though the transcript shows
[REDACTED]in its place. - The run is on a Self-Hosted Machine. My Machines workers get no dashboard secrets, and Team Pool workers get team and user secrets only through Secret sync.
- An automation launched the agent. In June 2026, automation runs in multi-repo environments got none of their environment's secrets, while manual and API launches did. Cursor staff said a fix was live in July, and in August they traced two later reports to a "Skip Install" option stored on older automations. On October 6, a user said the failure still affected every automation, new ones included, and no one from Cursor has replied in the thread.
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. were formerly called Background Agents, so older forum threads about missing secrets use the old name. Search for both when you look for your exact symptom.
This exact topic is a hands-on Lesson: Protect secrets and review cloud artifacts — about 7 minutes, free to read.
Where are cloud agent secrets configured?
Cloud Agent secrets live in the Secrets tab of 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 on cursor.com, and Cursor passes them to the agent as environment variables. None of them belong in .cursor/environment.json. Cursor's published schema for that file has no secrets field, so a key pasted there is a plaintext leak in your repo. The environment.json reference covers what the file holds.
What the agent can read depends on the type you give each secret. Cursor documents three:
- Type
- Environment Variable
- Who can read it
- The agent, in full. Fine for flags and public URLs.
- When it exists
- Loaded as an env var for the whole run.
- Type
- Runtime Secret
- Who can read it
- Processes can read it; the model can't. Values are replaced with
[REDACTED]in tool results, the transcript, commits and commit messages. Still visible to humans in the shared terminal. - When it exists
- Loaded as an env var for the whole run.
- Type
- Build Secret
- Who can read it
- Only the Docker build, via a secret mount. Never exposed to the running agent.
- When it exists
- Docker image build only.
| Type | Who can read it | When it exists |
|---|---|---|
| Environment Variable | The agent, in full. Fine for flags and public URLs. | Loaded as an env var for the whole run. |
| Runtime Secret | Processes can read it; the model can't. Values are replaced with [REDACTED] in tool results, the transcript, commits and commit messages. Still visible to humans in the shared terminal. | Loaded as an env var for the whole run. |
| Build Secret | Only the Docker build, via a secret mount. Never exposed to the running agent. | Docker image build only. |
All three are encrypted at rest and in transit, and are not visible to anyone other than the cloud agent user.
Scope is the second axis. The setup docs describe user, team and environment-scoped secrets, and any secret can also be limited to certain repositories.
- User secret
- Follows your account across your agent runs.
- Team secret
- Shared with the team's cloud agents.
- Environment-scoped
- Available only to agents using that one environment; applies to every repo in it and to no other environment. Never reaches Self-Hosted Machines.
- Repository setting
- A secret applies to all repositories or only some. On the forum, a Cursor support engineer asked about this 'Apply to' setting when a team secret didn't arrive. In another thread, the same engineer said an automation with no repository gets only secrets set to all repositories.
When can the agent read a secret?
An agent reads the secrets Cursor injected when it started, so start a new agent after you add or change one. When a secret is available also depends on its type and scope. Build Secrets exist only while the Docker image builds. Team and environment secrets can be available while Cursor prepares a Build, but user secrets arrive only when an agent starts, so they never become part of a Build's shared snapshot.
Treat an empty printenv during setup as a real symptom. In a February 2026 forum thread, a Cursor Ambassador called it normal. A Cursor support engineer then said cloud agents don't redact secrets in the terminal, suspected the secrets weren't reaching the environment, and asked whether the team secret was still set to all repositories. The user confirmed it was, and Cursor staff didn't reply again.
Changing an environment's secrets triggers a new Build, and agents that start from a Build get the change once a newer Build finishes. If the Build fails, agents keep starting from the last successful one. Check the Builds tab before you assume the change reached the run.
How do I fix it?
Work through these in order. Each step rules out one cause before you move to the next.
- 1Check the type. If the agent needs the credential at runtime, make it an Environment Variable or a Runtime Secret, because a Build Secret never reaches the agent.
- 2Check the scope. Confirm the secret's repository setting covers the repo you launched against, that an environment-scoped secret belongs to the environment this agent uses, and that you started the agent from the account that holds the secret.
- 3Check where the run executes. On My Machines, put the credential on the machine itself. On a Team Pool, a team admin has to turn on Secret sync and the worker has to start with
--sync-dashboard-secrets. - 4Check the Build. Saving environment configuration or changing the environment's secrets starts a new Build, so open the Builds tab and confirm it succeeded and became active, or read its logs if agents stayed on the last successful Build.
- 5Start a fresh agent once any Build from the previous step has finished, then test for the variable without printing its value, as the next section shows.
- 6If an automation launched the agent, open the automation, re-select its environment in the Environment section, and save. On August 24, 2026, a Cursor support engineer said this clears a stored "Skip Install" option that blocked Runtime Secrets and environment variables on older automations. If secrets still don't arrive, run the same task manually or through the API, the workaround staff gave in June.
How do I verify the agent can read a secret?
Prove the secret is present without printing its value. Ask the agent to run a shell test that reports whether the variable is set and non-empty. It works for every type the running agent can see.
test -n "$STRIPE_API_KEY" && echo "STRIPE_API_KEY: present" || echo "STRIPE_API_KEY: missing"
For a Runtime Secret, expect the transcript to show [REDACTED] wherever the raw value would appear, which means redaction is working. To see the value yourself, use the shared terminal: redaction applies to the model's view, not to people using the terminal.
A February 2026 forum report showed the redaction placeholder being written back into code. When a redacted value also appeared in the repo, the agent saw [REDACTED] in file contents and committed it. Cursor staff said in early March that it should be fixed, and the thread's advice matches Cursor's docs: reserve Runtime Secret for real credentials, and keep values like AWS_DEFAULT_REGION as plain Environment Variables.
Frequently asked questions
Can I put secrets in .cursor/environment.json?
No. The file's published schema has no secrets field, and anything you paste into it is committed plaintext. Secrets belong in the Secrets tab of the Cloud Agents dashboard, which encrypts them and exposes them to agents as environment variables.
Why does my cloud agent show [REDACTED] instead of a value?
The secret is typed as a Runtime Secret. The process reads the real value, but Cursor replaces it with [REDACTED] in tool results, the transcript, commits and commit messages so the model never sees it. It is not an error.
Are secrets available during the Docker build?
Build Secrets are, through a Docker secret mount, and the running agent never sees them. Environment Variables and Runtime Secrets work differently: team and environment secrets of those types can be read by install while Cursor prepares a Build, and user secrets arrive only when an agent starts.
I added a secret but the agent still can't see it. What should I check first?
Check when the agent started. Secrets are injected at agent start, so a running agent keeps its old values. Agents that start from a Build get a change once a newer Build of their environment finishes, and changing an environment's secrets triggers one. A user secret needs only a fresh agent.
Do dashboard secrets reach agents on My Machines or Team Pools?
Only to Team Pool workers that opt in. My Machines workers get no dashboard secrets and use the machine's own credentials. Team Pool workers get team and user secrets only when a team admin turns on Secret sync and the worker starts with the sync flag. Environment-scoped secrets and Build Secrets never reach a worker.
Sources & last verified
- Cursor Docs - Cloud Agent Setup: secrets
- Cursor Docs - Security & Network: secret protection
- Cursor Docs - Cloud Agent Settings
- Cursor Docs - Cloud Agent Builds
- Cursor Forum - Env vars not available in cloud agent's terminal
- Cursor Forum - Cloud is redacting env var values found in code
- Cursor Forum - Automation-launched agents get no secrets (multi-repo)
- Cursor Docs - Cloud Agents: troubleshooting secrets
- Cursor Docs - Self-Hosted Machines: environments and secrets
- Cursor Docs - Cloud Agents API: secrets
Cursor ships frequently. Last updated October 28, 2026.