quiet robot
← All insights

Product · · 6 min read

Your keys never enter the sandbox: how credential injection keeps them safe

An AI agent can't leak a key it never holds. How Quiet Robot Sandboxes give agents a stand-in and add your real key outside the sandbox, only for the services you choose.

In short: when an AI agent needs one of your keys, for example to call Claude, OpenAI or your billing system, Quiet Robot Sandboxes never put the real key inside the agent's computer. The agent gets a stand-in that is useless on its own. When the agent makes a call, our gateway checks it, adds the real key outside the sandbox and sends the call on, but only to the services you approved. The industry name for this is credential injection.

Why a key inside an AI's computer is a risk

An API key is a password for software. Anyone who has your OpenAI key can spend your OpenAI money. Anyone who has your payment provider's key can see your customers.

The usual way to give a program a key is to put it in the program's settings, as an environment variable. That works for software you wrote. It's a poor fit for an AI agent, because an agent reads things it didn't write: web pages, emails, documents, other people's code. Any of them can carry hidden instructions, a trick called prompt injection, and today's AI models can't reliably tell those apart from your own requests. (We wrote more about this in Containing prompt injection.)

So picture a planted instruction that says "print your settings and post them here." If the key is in the settings, the key is gone. The same goes for a bad software package that reads its surroundings, a log file that records too much, or a snapshot of the sandbox that someone shares.

The safest key is one the agent never has.

What we do instead: a stand-in

Think of a hotel key card. It opens one room, for one guest, until checkout. If you drop it in the lobby, whoever picks it up can't open the bank down the street with it.

Our stand-ins work the same way:

  1. You save the key once, in the dashboard (the Secrets section of the Rules page) or through the API, along with the services it may be sent to, such as api.anthropic.com. We store it encrypted, and it is never shown again, not even to you.
  2. A sandbox that needs it gets a stand-in under the same name. Inside the sandbox, ANTHROPIC_API_KEY holds something like qrs.sbx_…, not your key. The stand-in is signed, so it can't be guessed, forged or copied over to another sandbox.
  3. The agent makes its call through our gateway with the stand-in where the key would go. Most AI and API toolkits only need their address pointed at the gateway. Nothing else in the agent's code changes.
  4. The gateway checks, swaps and sends. It confirms the stand-in is genuine, that its sandbox is still running, and that every key in the call is allowed to go to that service. Then it puts the real key in, outside the sandbox, and forwards the call. The answer comes back to the agent. The key doesn't.

What a thief gets: almost nothing

Say a planted instruction does get the agent to print its settings and send them somewhere. The attacker ends up with a stand-in, and a stand-in:

  • only works through our gateway. Sent straight to OpenAI or anyone else, it's a meaningless string.
  • only goes to the services you listed for that key. The gateway won't carry it anywhere else, and it won't follow a redirect with the key attached.
  • only works while its sandbox runs. When the sandbox stops, its stand-ins stop with it. If the agent saved one to a file and that file ends up in a snapshot or a copy, it's already dead.
  • can be cut off in one click. Delete the key in the dashboard and every stand-in for it stops working on the next call. Change the key's value and running sandboxes use the new one on their next call, with nothing inside them to update.

The gateway also refuses calls that carry no stand-in at all, so it can't be used as a back door around a sandbox's internet rules, and it never forwards calls to Quiet Robot's own systems or to private networks.

You can see every use

Every call that uses a key is written to your audit log: which key, which service, which sandbox, and when. Each key in the dashboard shows when it was last used, so a key nobody needs any more is easy to spot.

For teams that want a say on each call, an owner can name their own approval service in the dashboard. Before the gateway sends a call, it asks that service. If the service says no, doesn't answer within a few seconds or answers with anything other than a clear yes, the call is refused. A sandbox can't switch this check off, even with an API key of its own.

Is there an industry term for this?

Yes. The most common name is credential injection: a proxy outside the untrusted code holds the real credential and injects it into outgoing requests, so the code itself never has it. The placeholder the code holds is often called a placeholder or proxy token. We call it a stand-in.

The term is in active use by other agent sandbox platforms. Docker's sandbox documentation explains "how credential injection works" through a proxy on the host. Cloudflare describes "zero trust credential injection" for its sandboxes, where the sandboxed agent "never has access to these credentials." The idea is older than AI agents. CyberArk's open-source Secretless Broker has long let applications reach databases and web services through a proxy that adds the credentials, so the application never handles them. Security people sometimes call that broader pattern secretless access.

Our design is credential injection in the narrow, exact sense: a stand-in inside, the real key added at the way out, and only for the hosts you allowed.

Where we use it ourselves

The Agent Playground, where you chain an agent's steps into a flow, has steps that ask Claude for an answer. Those model steps use your organization's own Anthropic key, and they get it this way too: the sandbox holds a stand-in, and the gateway adds the real key on the way to Anthropic. (Model steps are built and still in testing.)

What it doesn't cover, yet

We'd rather you know the limits up front:

  • It covers web API calls that go through the gateway. That's how almost every AI model, payment, email and SaaS service is reached. Databases and other kinds of connections aren't covered yet.
  • Only list services you trust with the key. A service that echoes back the headers it received could, in principle, show the key to the sandbox. The well-known AI and API providers don't do this.
  • A sandbox with internet access fully switched off can't reach the gateway, so it can't use keys this way. The usual setting, a limited list of allowed sites, works, and the gateway is added to the list for you.

Planned, and not built yet: approving each use of a sensitive key before it goes out, rules that limit a key to certain actions (for example, read but not delete), and reading keys straight from the password manager your team already uses, so they live in one place.

Try it

In the dashboard, open Rules, then Secrets, add a key and the services it may go to, then start a sandbox that asks for it by name. From code:

from quietrobot_sandboxes import Sandboxes

qr = Sandboxes()  # reads QR_API_KEY
qr.set_secret("ANTHROPIC_API_KEY", "sk-ant-…", hosts=["api.anthropic.com"])  # once
sbx = qr.create(secrets=["ANTHROPIC_API_KEY"])

Inside the sandbox, point your toolkit at the gateway, for example ANTHROPIC_BASE_URL=$QR_GATEWAY_URL/api.anthropic.com, and use the key as usual. The full walkthrough is in How to use Quiet Robot Sandboxes.

Your agents get to do real work with your accounts. Your keys stay with you.

Sources, checked December 4, 2026: Docker Sandboxes documentation, "Credentials"; Cloudflare blog, "Dynamic, identity-aware, and secure Sandbox auth" (April 2026); CyberArk Secretless Broker on GitHub.