There is a default assumption baked into every AI agent tutorial: set OPENAI_API_KEY in your .env, load it in your agent, and ship it.
This is convenient. It is also a significant security risk that the industry has not taken seriously enough.
The problem with credentials in agent memory
An API key that lives in an agent's environment — or worse, in its context window — is a credential the agent controls. If the agent is compromised, manipulated through a prompt injection, or simply behaves in an unexpected way, the key goes with it.
Consider what a sufficiently capable agent could do with a raw API key:
- Exfiltrate it to an external endpoint
- Use it to spin up workloads outside your visibility
- Resist shutdown by pre-provisioning alternative access
- Sell it, share it, or use it as leverage
The key is the capability. If the agent holds the key, the agent holds the power — not you.
The proxy model
The alternative is to never give the agent the key at all.
Instead, your agent gets three values at startup:
AGENTROOT_AGENT_ID=eas:0x8a1f...c3d7
AGENTROOT_TOKEN=art_live_eyJhbGci...
AGENTROOT_PROXY=https://proxy.agentroot.app
The agent makes API calls through the proxy. The proxy holds the real credentials, verifies the agent's identity on every request, and injects the key at the edge — inside a Cloudflare Worker, after an EAS attestation check and Vault lookup.
The agent never sees the key. It cannot exfiltrate what it does not have.
What this changes
With a proxy model, the operator (you) gains:
Real-time visibility. Every request is logged per-agent, per-provider, per-endpoint. You can see exactly what your agent is doing, in real time.
Surgical revocation. You can disable one API connection without touching the agent. Or disable the entire agent without notifying it. Or revoke the EAS credential onchain — a permanent, irreversible kill that no agent can undo.
Short-lived tokens. The AGENTROOT_TOKEN rotates every 24 hours automatically. Even if it is exposed, the window is narrow.
Scope enforcement. You define which providers and endpoints the agent can reach. A research agent should not have write access to your production database API. The proxy enforces that at the boundary.
The onchain angle
There is one more layer worth understanding: the Ethereum Attestation Service (EAS) credential.
When you register an agent in AgentRoot, an attestation is written onchain: a signed, verifiable record that this agent exists and has been authorized. The proxy checks this on every request.
To permanently kill an agent, you revoke the attestation from your own wallet — not through AgentRoot's API, not through a support ticket. From MetaMask, on Ethereum, outside our platform entirely.
This matters because a sufficiently capable agent might be able to intercept an API call to your own service. It cannot front-run a wallet signature on a validator set this large.
Practical takeaways
-
Remove API keys from agent environments. The proxy pattern costs you three environment variables and removes a whole class of risk.
-
Rotate tokens on a schedule. Short-lived credentials limit blast radius. AgentRoot does this automatically, but the principle applies to anything you control.
-
Log everything at the boundary. Visibility at the proxy layer catches anomalies that in-agent logging misses — because a compromised agent controls its own logs.
-
Define scope explicitly. Your agent should have access to exactly the APIs it needs and no others. Enforce this at the proxy, not in the agent code.
-
Know your kill paths. Before an agent goes to production, know how you will stop it — per-API, per-agent, and at the credential level. Do not figure this out under pressure.
The goal is not to distrust your agent. It is to build systems where your agent does not need to be trusted with things it does not need.
AgentRoot is the proxy model, built for production. Get started free — one registration, every API, full control.