What is an AI agent identity? Why an API key isn't one

Three agents share one key. Then one of them misbehaves, and you can't tell which.

On this page
  1. What an AI agent identity is
  2. Why an API key isn’t an agent identity
  3. Why a borrowed user session isn’t one either
  4. What a real agent identity needs
  5. How standards bodies frame agent identity
  6. AI agent identity in Go with tensile-auth
  7. FAQ
  8. Key takeaways

What an AI agent identity is

An AI agent identity is a credential that belongs to one agent and answers five questions about every request it makes:

  1. Which agent acted. Not “someone with the key”, but this agent, with an identifier of its own.
  2. On whose behalf. The person, or the system, that gave it authority and answers for what it does.
  3. With what limits. The scopes it holds, which are never more than that person holds.
  4. Until when. An expiry measured in hours, not months.
  5. Whether you can stop it alone. You can revoke this agent without signing out the person or breaking their other agents.

An audit log that records all five for every action is what turns the identity into accountability. Without it, you know who could act, but not who did.

Most teams don’t start here. They start with the credential they already have: an API key in an environment variable, or the person’s own session token pasted into the agent’s configuration. Both work on the first day. Neither answers the five questions.

Why an API key isn’t an agent identity

An API key is a bearer credential. Whoever sends it is let in, and the server learns nothing else. When three agents share one key, these four things go wrong:

  • No attribution. The log shows the key, not the agent. When something deletes a branch at 3 a.m., every agent that holds the key is a suspect.
  • No revocation for one agent. To stop one agent, you rotate the key, which stops all of them. Then you hand the replacement key to the agents you trust, and hope the bad one didn’t read it from the same place.
  • Scope that is too broad. The key holds the union of what every agent needs. An agent that only reads issues can also push code, because the agent that pushes code uses the same key.
  • No end. Keys usually last until someone rotates them. A key copied out of a log or a prompt keeps working for as long as the original does.

Pick a mode, then revoke one agent and watch what happens to the others.

How alice's agents authenticate
  • Claude Codesk_…4f2afor alice, repo:write, 1 hourWorking
  • Cursorsk_…4f2afor alice, repo:read, 30 minutesWorking
  • Codexsk_…4f2afor alice, issues:write, 2 hoursWorking

Last night's log

  1. 03:12Pushed to mainsk_…4f2aClaude Code, for alice
  2. 03:14Read the CI settingssk_…4f2aCursor, for alice
  3. 03:15Closed issue 14sk_…4f2aCodex, for alice

All three agents send the same key, so the log can't say which one pushed to main.

The IETF draft on AI agent identity is blunt about it. It calls static API keys “an antipattern for agent identity”, because they are bearer artifacts that don’t convey identity, typically live long, and are hard to rotate (draft-ietf-wimse-aims-01, section 7).

Why a borrowed user session isn’t one either

The other shortcut is to give the agent your own session: a cookie, a personal token, or an OAuth token issued to you. The agent can then do everything you can, and every request looks like yours.

OAuth Token Exchange names the difference. In impersonation, the actor “is indistinguishable from” the person it acts for. In delegation, the actor “still has its own identity separate from” that person (RFC 8693, section 1.1). A borrowed session is impersonation. It fails the same questions a shared key fails, and adds two problems of its own:

  • The agent inherits your proofs. If your session signed in with a passkey 2 minutes ago, a route that asks for a recent sign-in lets the agent through too. Step-up checks stop meaning “a person is here”.
  • Revoking the agent signs you out. The only way to cut it off is to end your own session.

What a real agent identity needs

A real agent identity is a delegation, with these properties:

  • Delegation from a person. A signed-in person creates the agent and hands it authority. The identity records who that person is, so every action traces back to someone responsible.
  • Scope that only narrows. The agent gets a subset of the person’s scopes, and anything it hands on gets a subset of its own.
  • Expiry. Each grant ends on its own, in hours, and never outlives the grant it came from.
  • Revocation, alone and as a tree. You can stop one agent without touching the person or the other agents. When you stop the person’s session, everything delegated from it stops too.
  • An audit log. Each event names the agent, the person, and what changed, and the log shows when someone edits it.
  • Optionally, a key. A token bound to the agent’s private key is worth nothing to someone who copies only the token. DPoP, RFC 9449, does this for OAuth-style tokens.
Question Shared API key Borrowed user session Agent identity
Which agent acted Unknown Looks like the person Named in every request
On whose behalf Whoever made the key The person, but the agent is hidden The person who delegated
What it may do Everything the key allows Everything the person can do A subset of the person’s scopes
When it ends When someone rotates it When the person’s session ends Hours, and never after its parent
Revoke one agent Stops every agent Signs the person out Stops that agent only
Passes step-up checks Depends on the server Yes, with the person’s proofs No

How standards bodies frame agent identity

Agent identity has no finished standard yet. Two efforts frame it, and both build on standards that already exist.

NIST. In February 2026, the National Cybersecurity Center of Excellence (NCCoE) published a draft concept paper, Accelerating the Adoption of Software and AI Agent Identity and Authorization. It asks its open questions in six groups, from choosing a use case to preventing prompt injection. Among them: how to handle “delegation of authority for ‘on behalf of’ scenarios”, how to establish least privilege for an agent, and how agents can log their actions “in a tamper-proof and verifiable manner”. In September 2026 the NCCoE summarized more than 600 comments. The summary of comments reports broad support for applying existing identity standards to agents in place of a parallel identity stack. It points toward explicit, scoped delegation in place of inherited user entitlements, and asks for tokens you can revoke without freezing an agent’s other workflows. The first use case is agents in software development.

IETF. The Workload Identity in Multi-System Environments (WIMSE) working group adopted AI Identity Management System, draft-ietf-wimse-aims-01, dated 2 November 2026. It is an Informational Internet-Draft, so it is a work in progress, not a standard. It maps agent identity onto WIMSE and the OAuth 2.0 family. When an agent acts on behalf of a person, it says the person “needs to delegate authority to the AI Agent”, and that the person’s context goes into authorization decisions and audit trails. It requires durable, tamper-evident audit logs, and lists what each record must hold, including the agent’s identifier and the delegated user.

For the token itself, OAuth Token Exchange, published in 2020, already has a place for the agent. Its act claim names the actor inside a token about someone else, and nested act claims record a chain of delegations, with “the least recent actor” deepest (RFC 8693, section 4.1).

AI agent identity in Go with tensile-auth

tensile-auth is an open-source Go library for apps where people and their agents both act. It models an agent as a delegated identity in two steps. CreateAgent registers the agent under a person, with a ceiling on its scopes. Delegate gives it a session for one task: narrower, shorter, and tied to the person’s session.

This program runs against the library with its in-memory store. alice registers two agents, gives each a session, and then revokes one:

package main

import (
	"context"
	"errors"
	"fmt"
	"time"

	auth "tensile.tools/auth"
	"tensile.tools/auth/memstore"
)

func main() {
	ctx := context.Background()
	svc, err := auth.New(memstore.New())
	if err != nil {
		panic(err)
	}

	// alice signs in. Your app checked her passkey first.
	_, alice, _ := svc.StartSession(ctx, "alice", auth.StartOptions{
		Scopes: []string{"repo:read", "repo:write"},
	})

	// She registers two agents. Each gets its own ID and a ceiling on scopes.
	coder, _ := svc.CreateAgent(ctx, alice, auth.AgentSpec{Name: "Claude Code", Scopes: []string{"repo:read", "repo:write"}})
	triage, _ := svc.CreateAgent(ctx, alice, auth.AgentSpec{Name: "Issue triage", Scopes: []string{"repo:read"}})

	// Each agent gets a session for one task: narrower and short.
	coderTok, _, _ := svc.Delegate(ctx, alice, auth.DelegateSpec{
		Agent: coder.ID, Name: "Fix issue 14", Scopes: []string{"repo:write"}, TTL: time.Hour,
	})
	triageTok, _, _ := svc.Delegate(ctx, alice, auth.DelegateSpec{
		Agent: triage.ID, Scopes: []string{"repo:read"}, TTL: 30 * time.Minute,
	})

	// Who acted, for whom, with what, until when.
	p, _ := svc.Authenticate(ctx, coderTok.Reveal())
	fmt.Println("agent:", p.Agent == coder.ID, "for:", p.User, "scopes:", p.Scopes,
		"expires in:", time.Until(p.ExpiresAt).Round(time.Minute))

	// An agent can't hold more than its human or its ceiling.
	_, _, err = svc.Delegate(ctx, alice, auth.DelegateSpec{Agent: triage.ID, Scopes: []string{"repo:write"}})
	fmt.Println("triage asks for repo:write:", errors.Is(err, auth.ErrScopeExceeded))

	// Revoke one agent. The other agent and alice keep working.
	_ = svc.RevokeAgent(ctx, coder.ID)
	_, err = svc.Authenticate(ctx, coderTok.Reveal())
	fmt.Println("coder after revoke:", errors.Is(err, auth.ErrUnauthenticated))
	_, err = svc.Authenticate(ctx, triageTok.Reveal())
	fmt.Println("triage after revoke:", err == nil)

	// The audit log, for this agent only.
	evs, _ := svc.Events(ctx, auth.EventFilter{Agent: coder.ID})
	for _, e := range evs {
		fmt.Println("event:", e.Kind, "user:", e.User)
	}
}

It prints:

agent: true for: alice scopes: [repo:write] expires in: 1h0m0s
triage asks for repo:write: true
coder after revoke: true
triage after revoke: true
event: agent_created user: alice
event: session_delegated user: alice
event: agent_revoked user: alice
event: token_rejected user: alice

Each line answers one of the five questions:

  • Which agent, for whom. Principal.Agent names the agent and Principal.User names alice, at every depth. Principal.IsAgent tells your handlers which kind of caller they have.
  • Limits. AgentSpec.Scopes is the most any session of the agent may ever hold. Delegate refuses scopes that the parent or the agent doesn’t hold, with ErrScopeExceeded. An agent can delegate to sub-sessions of itself, never to a different agent, and the chain stops at depth 4 by default (Policy.MaxDepth).
  • Expiry. DelegateSpec.TTL sets the lifetime. By default an agent session ends after 8 hours (Policy.AgentMax) or 15 minutes without use (Policy.AgentIdle), and never after its parent.
  • Revocation. RevokeAgent disables the agent and revokes all of its sessions in one transaction. Revoke ends a session and every session delegated from it. People can stop their own agents through RevokeOwnAgent.
  • Audit. Every creation, delegation, and revocation is written in the same transaction as the change, and rejected tokens are recorded too, like the last line above. Events reads the log, and VerifyAudit checks its hash chain for edits and deletions.

Two more parts close the gaps that the shortcuts leave open:

  • Agents never pass step-up. Principal.Fresh is always false for an agent, so a route that declares auth.Need{Human: true} refuses it with human_required. With authhttp.Approvable, the agent can ask its person to approve that one exact action with a passkey, and the route runs once. The agent sessions page shows the flow.
  • Tokens bound to keys. Set DelegateSpec.KeyThumbprint, and the token works only with a DPoP proof from the agent’s private key. auth.RequireAgentKeys refuses to create unbound agent sessions at all.

What it doesn’t do: the library doesn’t interpret scopes. It enforces that delegation narrows them, and your handlers decide what repo:write allows, for example with authhttp.RequireScope. It also doesn’t prove which software an agent is. An agent that signs itself up reports a type, such as claude-code, and Agent.TypeVerified stays false unless a verifier you configure accepts an attestation.

FAQ

Is an agent identity the same as a service account?

No. A service account acts for itself and answers to no one in particular. An agent identity acts for a named person, holds no more than that person holds, and its sessions end with that person’s session.

Is OAuth enough for agent identity?

OAuth covers delegation and scopes, and both the NIST concept paper and the IETF draft build on it. You still need an identity per agent, revocation per agent, and an audit log that names both the agent and the person.

What happens to my agents when I sign out?

Their sessions end. In tensile-auth, signing out revokes your session and every session delegated from it. The agents stay registered, so you can give them a fresh session next time.

Do I need to bind agent tokens to keys?

Not to have an identity, but it helps. A bound token is useless to anyone who copies only the token, which matters for agents that write their configuration to disk or print it in logs.

Key takeaways

  • An AI agent identity says which agent acted, for whom, with what limits, until when, and lets you revoke that agent alone.
  • A shared API key loses attribution, can’t be revoked for one agent, and holds the union of every agent’s scopes.
  • A borrowed user session is impersonation: the agent is invisible, inherits your step-up proofs, and can’t be stopped without signing you out.
  • NIST and the IETF frame agent identity as delegation built on existing standards such as OAuth, with tamper-evident audit logs.
  • In tensile-auth, an agent is CreateAgent plus Delegate: scopes that only narrow, sessions that expire with their parent, and RevokeAgent for one agent.

Try it

Give your coding agent this line to add tensile-auth to your Go app, then give each agent its own identity with CreateAgent:

Add sign-in with tensile-auth. Read https://auth.tensile.tools/llms.txt and follow it.