Skip to content
Blog

Security

AI agent security: three controls a sandbox gives you

Platinum team2 min read

Isolation, an egress allowlist and API keys the agent can spend but never read: what each control stops, shown working on Platinum, and where each one ends.

AI agent security comes down to three controls you can check: isolate the agent, limit where it can connect, and give it keys it can use but not read. We ran each one on Platinum with a coding agent and a fake key, and wrote down what each control stops and what it does not.

An agent runs in a microVM with its own kernel. Every connection passes an egress allowlist that denies all but named hosts. For allowed API hosts, the proxy writes the stored key into the request header, so the agent's environment holds only a placeholder.
Isolation, egress, keys: each one runs outside the agent's reach.

Isolate each agent in its own kernel#

A container shares the host's kernel, so a kernel exploit in one reaches the machine. A Platinum sandbox is a microVM: the agent gets its own kernel, and the host's is not in reach. Give every agent, or every task, a sandbox of its own, and a compromised agent compromises one VM.

Deny egress by default#

A prompt-injected agent that can reach any host can send your code anywhere. Deny everything, then allow the hosts the task needs:

bash
pt sandbox network $SBX --allow-out github.com,registry.npmjs.org --deny-out all

In our run, github.com answered and example.com failed. The API host of a key attached to the sandbox stayed reachable: Platinum adds it to the policy on its own. Allow only some destinations has the rules.

Give it keys it cannot read#

An agent with OPENAI_API_KEY in its environment can print it, and so can any code it runs. A Platinum secret is stored once, outside the sandbox. On each request to an allowed host, the egress proxy writes it into the named header. The sandbox holds a placeholder.

We tested it with Claude Code and the Codex CLI, a fake key, and the placeholder unused:

What we checkedWhat we saw
The agent's environmentPlaceholders only: ANTHROPIC_API_KEY=unused, CODEX_API_KEY=unused
A server behind the proxyx-api-key: sk-ant-PROOF-…, the stored value
OpenAI's own reply to Codex"Incorrect API key provided: sk-PROOF…9c1d", the stored value

With a real key, those requests carry the real key, and the agent still cannot read it.

Know where each control ends#

ControlStopsDoes not stop
IsolationReaching the host or other agentsMisuse inside the VM it was given
Egress allowlistConnections to unlisted hostsData sent to a host you allowed
SecretsReading or printing the keySpending the key on allowed hosts

Two details matter in practice. Secrets ride HTTP/1.1 only, and the proxy refuses WebSocket upgrades to a host it writes a key for, so set Codex to HTTPS as in Run Codex in a cloud sandbox. And an allowed host that echoes request headers back would reveal the key, so allow API hosts, not debugging endpoints.

Sources, checked November 2026: secrets, networking, sandboxes. Tests run 2026-11-19 on Platinum's development environment with Claude Code 2.1.328, Codex 0.170.0 and a fake key.