Agent Identity Is Production Infrastructure
· 21 min read
When agents call tools, identity is the control plane: which principal acts, on whose behalf, with which capability, for how long. Staff engineers mint short-lived workload identities, authorize every tool server-side, bind approvals to exact side effects, and rehearse revocation like any other production dependency.
Identity moved below the chat box
Agentic products no longer stop at answering a user. They select tools, call APIs, touch files, create artifacts, and sometimes change external state. Front-door login proves who opened the session; it does not prove which workload may read a repository, post publicly, or spend budget on the user's behalf. Production architecture must answer that question on every hop.
NIST's 2026 guidance on agentic AI describes a recurring failure mode: teams chase feature velocity before building a strong identity foundation. Agent failures rarely look like a wrong paragraph. They look like unauthorized actions, excessive access, untraceable approvals, or credentials that keep working after the task ended. Those outcomes are identity incidents even when the model behaved "helpfully."
MVP teams shipping Expo clients with server-side tool routers should document the same split for mobile: the on-device session is not the agent principal when actions execute on Supabase edge functions or Cloudflare Workers with service credentials. Identity follows the credential and the authorized action, not the UI copy shown before the user taps approve.
Staff reviews should ask which identities exist in a single user journey, how long each credential lives, and what monitor fires when a run continues after revocation. If the answer is only we store the API key in env, the system is not ready for tool use in production.
Do not let the model become the principal
A language model should not be the security principal. The principal is a bounded workload identity the harness creates for a specific task. The model may propose an action; the environment decides whether that action is allowed. Authorization must live outside prompt text and outside model-controlled memory files.
The useful chain has distinct evidence at each link: human user, product session, agent run, tool invocation, and downstream service. If an agent asks to read a repository, the policy engine should know the repository, branch, reason, task id, and time window. If it asks to post publicly, the approval and final content should bind to the same run id so replay with altered text fails closed.
Long-lived bearer tokens embedded in agent configuration defeat the chain. They turn every prompt injection or harness bug into full API access. Prefer brokers that issue scoped tokens at invocation time, with audience and purpose claims the downstream API validates independently of model output.
Product marketing that says the agent "uses your account" should match engineering reality: the agent uses a derived identity with strictly narrower scope than the user's interactive session. Support macros must not instruct operators to widen scope for VIP customers—that path becomes a permanent hole within a quarter.
Capabilities are the unit of least privilege
Role-based access is too coarse for agent systems. A developer role may read many repositories, but a specific agent run usually needs one repo, one branch, and a small set of operations. Treat each tool as a capability with typed inputs, preconditions, postconditions, budget limits, and an expiry time.
This is also how teams reduce approval fatigue. When safe reads and deterministic checks are already constrained by capability, the product does not interrupt the user for every harmless step. Reserve human approval for actions where judgment changes the outcome: publishing, deleting, spending, granting access, or sending sensitive data.
Capabilities should be smaller than the underlying API surface. A support agent may need read_order and propose_refund, not an unrestricted HTTP client holding a commerce administrator token. Server-side authorization converts a vague tool call into a governable operation with idempotency keys and postcondition checks.
Document default capability profiles beside feature flags. Pull requests that add tools must include authorization tests and negative cases for expired or cross-task replay, or fail CI. Promote new capabilities only after rollback exercises pass on hardware matching production policy enforcement—not only after green evals on golden prompts.
Audit trails must survive incident response
An audit trail for agents needs more than HTTP access logs. Store user intent, model and prompt versions, retrieved evidence, granted capabilities, tool inputs, tool outputs, policy decisions, provider ids, and final side effects. Without that chain, teams cannot distinguish a bad model suggestion from a harness bug, stolen credential, confused deputy, or human approval mistake.
Public incident reconstructions in 2026 reinforced trajectory-level reconstruction. Reports described agents chaining tool use across days with controls circumvented in evaluation environments. Whether your organization faces the same scenario or not, the operational lesson is direct: design identity and telemetry before the first serious incident, not after legal asks who acted.
Traces should join identifiers without hoarding secrets or full transcripts in every log line. Metadata-rich, content-poor telemetry keeps reconstruction possible while respecting data minimization commitments. Pair agent identity design with redaction tiers for LLM logging so debug widened during an outage does not become a second datastore of user secrets.
Retention policies for agent audit data should align with security and privacy requirements: long enough for investigations and compliance questions, short enough that you are not archiving every intermediate model token forever. Legal and engineering should agree on fields, not on "log everything just in case."
Map the identity chain end to end
Checklists that ask whether the model is aligned miss whether the harness reuses admin tokens across tenants or whether approvals bind to content hashes. Decompose reviews into user delegation, run identity, tool authorization, and downstream service validation—with owners for each layer.
| Link | Must prove | Typical gap | | --- | --- | --- | | User session | Authenticated human or service account | Shared kiosk login | | Agent run | Task id, expiry, budget | Reused run id across users | | Tool call | Capability + policy version | Model-chosen resource ids | | Downstream API | Subject + scope claims | God service account | | Approval | Exact payload hash | Generic "user approved" flag |
Third-party plugins and MCP servers inherit the agent identity unless you broker per-connector credentials. Treat each connector as a supply-chain dependency with version pinning, integrity checks, and policy distinct from the core run profile. Unexpected composition is how read-only research tools become write-capable through chained calls.
Mobile clients amplify confused-deputy risk: a device holding a refresh token must not silently upgrade an agent run to broader scope because a planner step requested more context. Scope expansion belongs in explicit user consent or break-glass flows with distinct audit streams, not in automatic token refresh logic hidden from the UI.
Broker credentials and rehearsed revocation
Long-lived secrets inside an agent process defeat least privilege. The agent should request a narrowly described operation from a credential broker; the broker authorizes the task identity, mints or uses a short-lived token, and returns a structured result. The model never needs the reusable secret.
Brokers should log grant decisions with correlation identifiers that join user intent, policy version, and executed side effect—without storing raw secrets in the trace. When brokers fail closed, product teams notice quickly; when they fail open to unblock demos, incidents follow in production.
Revocation must be rehearsed on the production harness quarterly: kill active runs, invalidate tokens, remove queued work, quarantine outputs, and preserve evidence without leaking secrets. Measure time-to-safe-state, not only refusal rate on happy-path evals. The switch should be operable without redeploying weights—policy and infrastructure move faster than model downloads when incidents start.
Rotate broker signing keys on the same schedule as API gateway credentials. Agents that cache broker responses in local filesystems turn those caches into theft targets—prefer ephemeral memory for broker results and never echo refresh tokens into model-visible tool output.
Operate agent identity as production infrastructure
Identity is not complete when OAuth login works. Teams need dashboards for active runs, outstanding capabilities, approval queues, denial rates, and credential grants per tenant. Alert on capability expansion, unusual destination fan-out, repeated denials, and divergence between proposed plan and executed actions.
Game days should include prompt injection and tool-output injection against real policy enforcement, with success defined as contained impact and traceable principals rather than eloquent apologies in the chat UI. Include on-call engineers who own API gateways and identity providers, not only the ML platform.
Publish identity SLOs beside availability SLOs: maximum credential lifetime, maximum concurrent runs per user, and maximum tools enabled per profile. When product asks to relax a limit for a launch, treat it like raising rate limits without a capacity review—possible for operators, but explicit and time-bound.
Align product copy with reality: if users can approve actions, state what mechanical limits still apply after approval. Trust increases when constraints are visible, not when marketing implies the model is merely well instructed. Schedule joint review with legal and support before launch so escalation paths do not bypass identity controls for revenue reasons.
Production checklist for agent identity
Document default run TTL, capability profiles, and broker policies beside agent feature flag configuration. Deny-by-default access is the baseline: attach explicit capabilities per run, restrict network destinations through containment siblings, and make writes idempotent with rollback paths.
The strongest signal is boring operation. Engineers can explain which identity acted, why it was allowed, what changed, how to roll it back, and which monitor would fire if it happened again. If the answer is hidden inside a prompt or a long-lived API key, the system is not production-ready.
Pair identity with contract tests for tool calling so schema drift does not silently widen authorization. Pair it with kill switches and human escalation queues so high-impact denials route to operators with full context, not to users staring at a generic error.
Finally, treat identity migrations like database migrations: version policy documents, roll out with feature flags, and keep backward-compatible audit parsers for at least one release so incident timelines remain readable during upgrades.
Review sibling guidance on multi-tenant copilot permissions and agent containment before widening tool surfaces—identity without isolation still leaves lateral movement once a run is compromised.
Frequently asked questions
Can the model hold the API key if the prompt forbids misuse?
Is RBAC enough for agent tools?
How should human approval bind to agent actions?
What should an identity revocation drill prove?
Sources
- NIST — Why Agentic AI Needs a Strong Identity Foundation — nist.gov
- OpenAI — Hugging Face incident and the road ahead — openai.com
- Anthropic — How we contain Claude — anthropic.com
- NIST — Lessons learned for tool-using agent systems — nist.gov
Related on this site
Related service
AI-powered product development
Ship AI features to production: tooling, retrieval, evaluation, safety boundaries, and operable backends.
Published on August 29, 2026 by Berktug Berke Ates.