
Avoiding the secret zero problem is already difficult when you have one AI agent to secure. Now imagine a multi-agent system where that agent can create several sub-agents, and every new agent introduces another credential you need to issue, scope, track, and eventually retire.
Without a clear way to manage those credentials, sprawl can happen quickly. Agents can share the same token, sub-agents may inherit credentials from their parents, and credentials issued for short-lived tasks may remain valid long after the agents using them have stopped. As the agent tree grows, it becomes harder to know which agent can access which secrets and whether that access is still necessary.
This article shows you how to solve the secret zero problem in a multi-agent system, control which secrets each agent can access, and manage credentials as agents and sub-agents come and go.
When you store passwords, API keys, and other secrets in a secrets manager, your application no longer needs to store those secrets itself. Instead, it retrieves them when needed. However, the secrets manager still needs to verify that your application or agent is authorized to access them.
Before your agent can retrieve a secret, you need to give it an initial credential that the secrets manager already trusts. This credential is known as secret zero because it establishes the agent’s access to the secrets it needs.

With a single agent, you only need to manage this initial credential for one workload. Once you start running multiple agents, you have to solve the same bootstrap problem for every agent that needs direct access to the secrets manager, while accounting for the different secrets each agent needs.
When you run multiple agents, they rarely need access to the same secrets. An orchestrator might need credentials for several parts of a workflow, while a database-testing agent only needs access to a test database. If you give both agents the same secrets manager credential, the database-testing agent may be able to retrieve secrets it never needs for its task.
The problem becomes more complicated when agents create sub-agents. If you pass the parent agent’s credential to a sub-agent, you also pass along its permissions. Credentials and secrets can also reach child processes through inherited environment variables, giving them access you may not have intended to provide.
You also have to manage access for agents with different lifetimes. One agent might run for a few minutes while another runs for hours, and either could stop earlier than expected. For each agent, you need to control what it can access and how long its credential remains valid, then make sure that access does not outlive the work it was issued for.
You can reduce the risk of long-lived credentials by rotating them on a fixed schedule. That approach works for long-running services, but it does not match how ephemeral agents operate. If an agent runs for 15 minutes but its credential remains valid for 30 days, the credential can outlive the workload it was created for by weeks.
For ephemeral agents, the credential lifetime should more closely match the lifetime of the agent. Expiration or revocation can prevent the agent from using its bootstrap credential again, but neither removes secrets the agent has already retrieved. Any database passwords, API keys, or other credentials loaded into the running process remain available according to their own lifecycles.
You have several ways to provide credentials as you add agents to a system. You can share one credential across agents, provision a separate credential for each one ahead of time, or issue scoped credentials when agents start. Each approach gives you a different level of control over what an agent can access and how long that access lasts.
| Approach | How it works | Tradeoff |
|---|---|---|
Shared credential | Multiple agents authenticate with the same credential. | Simple to manage, but every agent can inherit the same permissions and credential lifetime. |
Manually provisioned per-agent credential | You create and assign a separate credential to each agent. | Gives you separate access boundaries, but becomes harder to manage as agents are created dynamically. |
Scoped, expiring credential at runtime | Each agent receives a credential limited to the secrets and lifetime required for its task. | Gives you tighter control over access, but requires a trusted component to provision credentials as agents start. |
For agents that start and stop dynamically, the third approach lets you match credentials more closely to the workloads using them. Each agent run gets its own read-only credential, scoped to the secrets required for its task and configured to expire after a limited period. You then provide that credential when you launch the agent rather than letting it inherit another agent’s access.
With Doppler, you can implement this pattern by creating a separate config for each agent and issuing a read-only service token scoped to that config. You can set the token's Time to Live (TTL) to match the agent's expected runtime, limiting how long the credential remains valid.
For a step-by-step example of configuring a single agent, see the Doppler Cursor setup guide, which covers creating an agent-specific config, issuing an expiring service token, and injecting secrets at runtime.
Directory-scoped configuration works for an isolated local session. If you run multiple agents concurrently, give each agent its token through its own runtime environment instead. This prevents workers that share a directory from depending on the same directory-scoped authentication.
You can handle such a workflow with a trusted launcher. This can be a shell script, backend service, or orchestrator that runs outside the agents and has permission to create Doppler service tokens. When starting a worker, the launcher creates a scoped, short-lived token and passes it to that worker without exposing its own provisioning credentials.
For example, the launcher can supply each worker's token as AGENT_TOKEN:
That way, each worker uses its assigned token to authenticate with Doppler and retrieve only the secrets available through its approved config.
When one of your agents creates a sub-agent, give the sub-agent its own credential instead of passing down the parent’s. A trusted launcher can issue a new token scoped to the sub-agent’s task and provide it when the sub-agent starts. This keeps the parent’s broader access outside the sub-agent’s runtime.
For example, suppose your orchestrator uses a token for config A and needs to launch a database-testing agent. The launcher can issue the database-testing agent a separate token for config B, which contains only the credentials it needs to test the database.
The flow looks like this:

With this setup, the sub-agent authenticates with its own token and can only access config B. To preserve the access boundary, build the sub-agent’s environment from an allowlist instead of passing down the parent’s entire environment. Keep the parent’s token, retrieved secrets, and credential files outside the sub-agent’s runtime so that its effective access matches the scope of the credential you issued for it.
Scoped service tokens work well when you can securely issue a token for each agent run. As you move to shared infrastructure, CI environments, or larger agent fleets, issuing and distributing those tokens can become another credential-management problem.
At that point, you can use workload identity instead. With OpenID Connect (OIDC), your agent proves its identity through a trusted identity provider and exchanges that identity for short-lived access to the secrets manager. You no longer need to store or distribute a bootstrap token for each workload, while still controlling which secrets each workload can access.
Solving the secret zero problem in a multi-agent system requires controlling how each agent gets initial access to secrets. Give each agent its own scoped, expiring credential, keep provisioning credentials outside agent runtimes, and preserve those boundaries as agents create sub-agents. The agent setup guides show you how to start implementing this pattern with Doppler.
The secret zero problem is the challenge of securely giving a workload its first credential to access a secrets manager. Even when your application secrets are stored securely, the workload still needs a way to prove that it is allowed to retrieve them. That initial credential is secret zero.






Protect secrets across your entire stack with centralized management, automated workflows, and the flexibility to deploy in the cloud or on-prem.
