I focus on keeping credentials beyond an AI agent’s reach when it runs in a Docker Sandbox. The approaches I have shared include retrieving credentials from a vault on demand and enforcing access boundaries through infrastructure.
I shared a hands-on guide wiring the 1Password CLI into Docker Sandboxes so credentials resolve from your vault on demand and never sit in plaintext inside the container.
I shared that Docker Sandboxes keep your API keys out of the agent’s reach, and pointed readers to an explanation of secrets in local and cloud sandboxes.
I shared that Docker Sandboxes keep your API keys out of the agent’s reach while explaining that local and cloud sandbox secrets differ.
I described Docker Sandboxes as changing what the agent can see: credentials remain on the host and are injected only as a request leaves the VM, while the filesystem the agent reads stops at the workspace. I said the boundary is enforced by infrastructure rather than the model’s judgement, so a team can reason about it in advance.
In both local and cloud sandboxes, the agent never holds my real API key.
A proxy sits between the sandbox and the internet, and it adds the real credential to each request on the way out.
When an agent like Claude Code calls its model provider, it sends a request from inside the sandbox with only a placeholder value, such as proxy-managed.
The proxy catches the request and checks the destination, for example api.anthropic.com.
If the destination matches a known service, the proxy looks up my stored secret and writes the real value into the auth header.
The request goes to the provider with the real key, and the sandbox never sees it.
The main difference between local and cloud is where the proxy runs and where the secret is stored.
Locally, both live on my own computer.
In the cloud, both live in Docker's cloud.
Related: secure agent web access, agent security tooling, sandboxing agent security