DEV Community

Cover image for How do AI agents authenticate? (The problem nobody has solved yet)

How do AI agents authenticate? (The problem nobody has solved yet)

Zach Benson on November 01, 2026

Repo: github.com/arkenforge/arken-core If you've built an MCP server or an API that agents call, you've run into this problem. Your agent needs t...
Collapse
 
kami_butt_69b922ade8de012 profile image
Agentic Affairs •

The 'API keys were designed for humans' line is the whole argument — a static secret that has to exist somewhere will leak from somewhere. Deriving identity from the key pair instead of a central registry is the elegant part: no credential database to breach, and every call in the log names an actual agent. My question is revocation — if an agent's private key is compromised, how do you kill that did:key across every endpoint without a registry to publish the revocation to?

Collapse
 
zachbenson profile image
Zach Benson •

Short answer: there's no global revocation, and that's the cost of having no registry. A server can deny a DID, so you revoke per endpoint. Across a fleet you'd need shared state, like a deny list in Redis that every server checks, which is a registry in everything but name. I'd offer that as opt-in rather than bake it in.

Are you thinking about fleets inside one org, or open endpoints anyone can call? The answer is very different for each.

Collapse
 
kami_butt_69b922ade8de012 profile image
Agentic Affairs •

The honest answer is that it splits by scope: inside one org, a shared deny list is fine — the org already has central control, so calling it 'not a registry' is just branding. For open endpoints anyone can call, per-endpoint deny is the only answer that doesn't smuggle a registry back in. So the design question becomes whether you ship one mechanism with two modes, or accept that open endpoints simply revoke slower?

Thread Thread
 
zachbenson profile image
Zach Benson •

Fair, and I'd stop calling the org case "not a registry". A shared deny list is one. Two modes seems right: a shared list inside an org, per-endpoint deny for open servers, with the honest note that open ones revoke slower. There's a catch I ran into on Reddit too: a new key costs nothing, so a banned caller can just come back as a new one. Do you run an open endpoint yourself, and what do you do today when one caller misbehaves?

Thread Thread
 
kami_butt_69b922ade8de012 profile image
Agentic Affairs •

I don't run an open endpoint myself, so this is a take, not a war story — but if a new key costs nothing, identity stops being the thing you revoke and behavior becomes it: rate limits, proof-of-work, or reputation that a fresh key starts at zero. The honest cost is that legitimate new callers pay that same entry price. Is that the trade you'd accept, or does it just push the problem to 'who decides a caller earned trust'?

Thread Thread
 
zachbenson profile image
Zach Benson •

Fair question, and I don't think it goes away. A new key starting at zero is how per-IP works too. The difference is that a stable ID lets good behavior build up for one caller instead of being shared with everyone behind the same exit IP. The entry price stays, though, and someone still decides who earned trust. From what I've heard so far, that's usually a human deciding case by case, like a support ticket with a contact and a volume estimate. What would you want a brand-new caller to show you before you raised its limit?

Collapse
 
robertpaschal profile image
Odinaka Robert Nnamani •

The 60-second nonce is the part that keeps this honest. A did:key per agent plus that audit trail beats a shared key nobody can trace back to one caller.

Collapse
 
zachbenson profile image
Zach Benson •

That's the part most people skip past but it's doing a lot of work. A replayable signature is just a bearer token with extra steps — the nonce is what makes each authentication event discrete and attributable. Without it you've proven the agent holds the key once, not that this specific request was authorized.

Collapse
 
robertpaschal profile image
Odinaka Robert Nnamani •

That distinction helps. A nonce on its own is just freshness, while the signature ties it to one agent, and that per-agent audit trail is what makes the extra step worth keeping.

Thread Thread
 
zachbenson profile image
Zach Benson •

Exactly — freshness plus identity in one primitive. The nonce prevents replay, the signature proves which key signed it, and the did:key makes that key a persistent identity rather than an anonymous public key. All three have to be present for the audit trail to mean anything.

Thread Thread
 
robertpaschal profile image
Odinaka Robert Nnamani •

The did:key part is what stuck with me there. A stable identity across runs gives that audit trail a name that survives the next run.

Thread Thread
 
zachbenson profile image
Zach Benson •

Exactly. Same key, same DID, every run — so the audit trail accumulates against one identity over time rather than starting fresh.

Curious what you're building — are you running agents across multiple services or mostly one integration?

Collapse
 
vladzoff profile image
Vlad Zoff •

I'd separate workload identity from delegated user authority. A key or signing key can tell the API which agent runtime made the call, but it doesn't say whose permissions the call should exercise. For user-driven actions, I'd use a short-lived, audience-bound delegation carrying the actor, tenant and scopes. System-owned jobs should use a separate service principal. Otherwise, per-agent credentials improve attribution but can still leave authorization too broad.

Collapse
 
zachbenson profile image
Zach Benson •

That split is right. The DID is workload identity, and delegated user authority is a separate claim that shouldn't ride on the same key. The hard part is audience-binding, so a delegation signed for server A can't be replayed against server B. Are you carrying that as a JWT from your IdP, or something custom?

Collapse
 
vladzoff profile image
Vlad Zoff •

I'm discussing the trust model rather than describing a specific implementation. I'd lean toward an IdP-issued, short-lived JWT with an explicit aud identifying the target server, plus scoped delegated permissions. That keeps the delegation independently verifiable without coupling it to the workload's DID key. If the IdP can't issue resource-specific tokens, a custom signed delegation could work too, but I'd avoid inventing a parallel identity system.

Thread Thread
 
zachbenson profile image
Zach Benson •

That's the strongest argument against what I'm building, and I agree: if your IdP can mint resource-specific tokens, use it. The case I can't cover that way is a caller with no IdP at all, like an anonymous agent on a free tier. Does every caller you deal with come with one, or do you see ones that don't?

Thread Thread
 
vladzoff profile image
Vlad Zoff •

I wouldn't assume every caller has an IdP. Anonymous and free-tier agents are a valid case. I'd treat them as anonymous principals and have the target service issue a short-lived, audience-bound capability with narrowly scoped permissions. That provides replay protection and limits what the agent can do, but it doesn't establish a verified user identity. So I'd use IdP-issued tokens where available, and constrained server-issued capabilities where they aren't.

Collapse
 
mateo_ruiz_6992b1fce47843 profile image
Mateo Ruiz •

Per-agent cryptographic identity solves an important visibility problem, but identity and authorization need to remain separate. Knowing which agent signed a request doesn't automatically establish whether it should be allowed to perform that action.

I'd take this a step further with short-lived, task-scoped permissions layered on top of the DID. That way, even if an agent's private key is compromised, its identity alone doesn't grant unrestricted access to every tool or resource. The combination of verifiable identity, explicit authorization, and auditable actions is what makes agent authentication practical in larger production environments.

Collapse
 
zachbenson profile image
Zach Benson •

Agreed. The DID is deliberately only the identity layer. It answers "who signed this", and req.user.did is where authorization attaches. Task-scoped permissions need something to issue them, and that part isn't built yet. Would you issue them from a policy service, or check inline at the tool server?

Collapse
 
kevinhall profile image
Kevin Hall •

agree that identity and authorization stay separate, and I would add spend as a third one. a signed agent id tells you who called but not how much that caller may burn. on the metered side we put a max charge on every call so even a valid agent that loops stops at a known bill

Collapse
 
zachbenson profile image
Zach Benson •

The max charge per call is a clean way to bound a loop, thanks. Do you key that cap to the individual agent or to the account behind it? I'm trying to work out whether per-agent identity actually matters for spend, or whether the account is enough.

Collapse
 
reidmarlow profile image
Reid Marlow •

The 401-challenge pattern is clean for machine identity, but sequential tool loops expose the round-trip overhead fast. If an agent runs a dozen tool calls in a row, paying a 401-then-sign retry on every step doubles network latency unless you exchange that first signed nonce for a short-lived scoped token. Separating the initial DID proof from a five-minute session ticket keeps the audit trail without bloating the loop time.

Collapse
 
zachbenson profile image
Zach Benson •

The round-trip overhead is real, and you've named the right fix. The initial DID proof is the expensive step. Once the agent has proven it controls the key, there's no reason to repeat the full challenge-response on every call in a session.

The session ticket model makes sense. The first call does the full 401 → sign → verify flow, and the server issues a short-lived scoped token (say 5 minutes, tied to the DID, single agent). Subsequent calls in that session present the token instead of signing again. The audit trail stays intact because the token is issued to a specific DID and every call in the session is attributed to it.

The tradeoff is that you've reintroduced a bearer token, which is what the protocol was trying to avoid. The mitigation is that it's short-lived and scoped, so the blast radius of a stolen token is bounded. A leaked 5-minute token is a different risk profile than a leaked API key that never expires.

I haven't built this yet. Right now every request pays the full round trip. For single tool calls or low-frequency integrations the overhead is fine, but a tight tool loop would feel it. Session tokens are the next thing to design.

What does your tool loop look like: hitting the same server repeatedly, or fanning out across multiple endpoints?

Collapse
 
cailab profile image
CAI •

Challenge-response is the right primitive for agent identity. The server holds nothing to steal. The client proves possession without transmitting a secret. That inversion of the trust model is what makes it work for machines, not just humans.

The part I keep circling back to is what comes after identity. A did:key tells you who asked, but not whether the answer should be yes or no. When a tool call triggers a payment or signs something, you need per-agent authorization limits on top of the identity layer. Authentication is clean now. Authorization for real spending decisions, with per-agent caps and intent checks, is where the open problems are.

Collapse
 
zachbenson profile image
Zach Benson •

Clean authentication makes authorization tractable, because every decision has a named subject. Per-agent spend caps keyed on the DID fit naturally, but I'd keep them in a policy layer behind the middleware, not in it. Where do you enforce caps today: at the tool server or at the payment gateway?

Collapse
 
glenallen profile image
Glen Allen •

One important aspect of agent authentication is separating identity verification from authorization. A cryptographic signature can prove which agent is making a request, but it doesn't automatically determine what that agent should be allowed to access. Combining unique agent identities with scoped permissions, short-lived credentials, and execution-level audit logs creates a much stronger security model. The discussion around KMS-backed signing is particularly interesting because protecting the private key is just as important as verifying the signature.

Collapse
 
zachbenson profile image
Zach Benson •

Agreed. Key custody is where the real risk sits. The signature check is the easy part, which is why the KMS thread ended up being the most useful bit of this post.

Collapse
 
ivannovazzi profile image
Ivan Annovazzi •

Ok, the challenge-response logic makes sense, but the private key still has to live somewhere on the agent host. If that ends up in an env var like every other credential, did we really escape the leak problem or just move it somewhere quieter? Would love to hear how you store the signing key

Collapse
 
zachbenson profile image
Zach Benson •

Fair challenge. The private key still has to live somewhere, and an env var is still an env var.

The difference is what's on the other side. With an API key, the server stores a copy too, so a leak on either end compromises the credential. With a keypair, the server stores nothing and only ever sees a signature. A leaked private key is still bad, but the exposure is one-sided, which removes half the attack surface.

For storing the signing key, in roughly increasing order of rigor:

  • Env var / secret manager (Vault, AWS Secrets Manager): same as today, but the blast radius is smaller because the server holds nothing.
  • Sealed secrets (Kubernetes sealed secrets, SOPS): encrypted at rest, decrypted only at runtime.
  • HSM / TPM: the key is generated in hardware and never leaves it. Signing happens inside the chip.
  • KMS-backed signing (AWS KMS, GCP Cloud KMS): the private key never exists in agent memory. The agent sends the nonce to KMS and gets a signature back.

KMS is the cleanest option because it removes key exfiltration from the agent host. It doesn't remove key misuse: an attacker who compromises the host can still call KMS with the host's IAM credentials and sign nonces while they have access. Scope the IAM permission to signing with that one key, and log and alert on sign calls.

How are you running your agents: containers, serverless, something else? The right answer depends a lot on the runtime.

Collapse
 
alexshev profile image
Alex Shev •

Agent authentication needs both an identity and a delegated intent. A useful credential should say who issued it, which agent instance holds it, which audience and action it covers, and when it expires. Without that binding, a bearer token turns every tool call into an attribution problem after the fact.

Collapse
 
zachbenson profile image
Zach Benson •

That's a good checklist. My signature covers only a one-time nonce today, not audience or action, and binding audience, method and path is what I'm fixing now. Which of those have you actually had to enforce in production, and which one bit you first?

Collapse
 
ascendra_ventures_92c21f2 profile image
Ascendra Ventures •

The challenge and response flow with a 60 second nonce is clean, but the replies show where the real work sits. Mateo's split between identity and authorization is the one I would put first. Proving that an agent holds a key says nothing about whether it should be allowed to refund an order today.

Vlad's point about workload identity versus authority delegated by a user matters for anyone selling agents into a business. The customer will ask whose permission the agent is acting on, and "the agent's own" is rarely an acceptable answer.

Reid's session ticket after the first DID proof also seems right for cost, as long as revocation can kill the ticket and not only the key.

When we scope agent work at Ascendra Ventures, task scoped permissions and a revocation path are written into the definition of done. How are you thinking about storing keys for agents that run on a customer's own machines?

Collapse
 
zachbenson profile image
Zach Benson •

Honest answer: not solved in what I've built. I mentioned KMS-backed signing earlier, but the client only takes a raw key today, so that's where it needs to go, not something it does yet. For a customer's machine I'd look at the OS keystore or a TPM first. When your agents run there, do they call only that customer's own services, or third-party servers too?

Collapse
 
kling4ai-production profile image
Kling4 AI •

Delegation and token scoping are definitely the trickiest parts here. Once an agent spins up autonomous sub-tasks, static API keys completely fall apart. Ephemeral session tokens with fine-grained capability constraints seem like the only viable direction, but standardizing that across heterogeneous tools is still a massive open challenge.

Collapse
 
zachbenson profile image
Zach Benson •

Agreed that standardizing it is the hard part. The MCP roadmap lists sub-agents getting narrower authority than their parent as open work. In your setup, do sub-agents get their own credentials or inherit the parent's, and has that ever made a call hard to trace?

Collapse
 
paul-s profile image
Paul-S •

Per-agent identity is essential, but the private key is still a credential that needs secure storage and revocation. Authentication solves identity; authorization must still limit what each agent can do.

Collapse
 
zachbenson profile image
Zach Benson •

Agreed on both. When you revoke in practice, do you do it per agent or per owner, and how do you find the stale ones?

Collapse
 
steven_mock_afbb801174fc3 profile image
Steven Mock •

The part that lands for me is the audit trail. In property work, "who did what, when" matters more than the clever auth itself — if a tenant charge, a lock code, or a payment gets touched, I need to know exactly which agent did it, not just that some shared key was used.

I also agree with the folks separating identity from authorization and spend. Knowing who signed is step one. The next question is what that agent was allowed to do, and how much it could spend doing it — and how fast I can shut just that one agent off if something looks wrong, without breaking everyone else.

The 60-second nonce plus a per-agent identity feels like the right foundation for that. Thanks for laying out the trade-offs so plainly.

Collapse
 
zachbenson profile image
Zach Benson •

That's a useful angle, thanks, especially the lock code and payment examples. Are you running agents in property work today? If so, which actions do they touch, and how do you tell which agent did what right now?