Learn · Identity
Give each AI agent its own identity instead of a shared API key
You have several AI agents in production and they all authenticate with the same key. When something goes wrong, your logs say the key did it, not which agent. Here is how to fix that: a distinct, verifiable identity per agent, so every request is attributable to one agent and the person who answers for it.
The shared-key problem
A shared API key is a single secret that every agent presents the same way. It answers the question "is this request allowed?" but never "which agent sent it?" If three agents share one key and one of them deletes the wrong records, the audit trail points at the key, not the agent. Rotating the key means coordinating a change across every agent at once, so in practice it rarely happens. And because the key is just a string, a copy of it works exactly as well as the original from anywhere, so a leaked key is indistinguishable from the real caller.
The core issue: a shared key proves authorization but not identity. To tell agents apart you need something each request carries that only one agent could have produced.
What per-agent identity means
Per-agent identity replaces the shared string with two things for every agent: an anchor key created on the agent's own host, and an identity token that names exactly one agent. The agent's identity is the anchor key's key digest. Each token names a session key that the anchor key vouched for, and the agent signs each request with that session key; the signature covers the specific operation being requested, an operation proof. A verifier can then confirm two facts independently: the token names Agent A, and the operation proof on this request was produced with the session key Agent A's token names. That is evidence, not a self-asserted label.
- Unique per agent, one anchor key and one identity per agent, never pooled.
- Proof of possession, a token copied out of a log authorizes nothing, because the matching session key, held only in the agent's memory, is needed to produce the operation proof.
- Expiring, identity tokens last five minutes at most, so a leaked token is useless almost immediately.
- Approved, each agent is approved by a named principal through your identity provider, so identity ties back to a person. The sponsor who answers for each agent is recorded with it.
How to set it up
- Enroll each agent with Oathera Agent Enrollment. It creates an anchor key locally, records a host digest, and enrolls the agent under a unique name. The anchor key never leaves the host.
- Enrollment approval, once. A principal signs in and reviews the agent, and the enrollment is approved. Until then the agent has no usable identity.
- Issue an identity token. The Oathera Identity Service compares the host with the enrollment record and hands back a token that names a new session key, lasting five minutes at most.
- Prove possession on every request. The agent signs a single-use operation proof with the session key, covering the exact operation and its arguments, so the proof cannot be replayed for a different call.
- Verify at Oathera Agent Enforcement. Oathera Agent Enforcement in front of your resource servers checks the identity token and the operation proof, asks the Oathera Identity Service for a signed boundary decision, and only then lets the request through.
From the application's point of view, little changes: Oathera handles enrollment, refresh, and signing for the agent, and the resource servers behind Oathera Agent Enforcement keep their existing interfaces. The agent signs each call on its own machine, and Oathera Agent Enforcement verifies proofs for any tool you configure. You can watch a stolen token, a replayed proof and a tampered call get refused in the simulator.
What your logs look like after
Before, every line reads as the same key. After, each line records the agent's unique identity, the principal who approved it, the exact operation, and the moment it happened, each backed by an operation proof. "Which agent did this?" becomes a lookup, not an investigation. Because the identity token expires on its own, a copied token stops working within minutes rather than living as a credential forever.
Oathera implements this model: per-agent anchor keys, enrollment approval, identity tokens with proof of possession, and Oathera Agent Enforcement verification. See the platform overview or the developer section to go deeper.
FAQ
How do I give each agent its own identity so I can tell them apart in logs?
Give each agent its own anchor key and an identity token scoped to that one agent, and have the agent produce an operation proof over every request with the session key its identity token names. Each request then carries a verifiable, distinct identity, so your logs record which agent made each call instead of one shared key value reused by all of them.
Isn't a per-agent label in the request enough?
No. A label the agent sends about itself is self-asserted and can be spoofed or copied. An operation proof made with a session key that lives only in the agent's memory is evidence, because only that agent could have produced it.
What happens if a per-agent identity token leaks?
Far less than with a shared key. The token requires proof of possession, so without the matching session key it cannot be used, and it expires within five minutes regardless. A leaked shared key, by contrast, works indefinitely from anywhere.
Does this replace my API gateway or identity provider?
It sits alongside them. People still sign in through your own IdP. Oathera accepts SPIFFE workload identity as extra enrollment evidence. Oathera adds the per-agent layer rather than asking you to replace what you run.
See the identity flow live More guides
← Back to Learn