Agent Authentication and Identity: Authority


The moment an AI agent can call a tool, send a message, read a document, or change a record, identity becomes architecture. “The agent is logged in” is not an answer. A production system needs to explain which human or system initiated the work, which workload executed it, which tool received the request, what authority was delegated, and how that authority can be stopped.
This is not paperwork. Without that chain, a helpful assistant gradually becomes a broad service account with an opaque audit trail—the opposite of what high-impact automation needs.
Identity Is More Than a Login
Authentication establishes the identity of an entity; authorization decides whether that entity may perform a specific action on a specific resource. The OWASP authorization guidance (opens in new tab) emphasizes least privilege, deny-by-default behaviour, and permission checks on every request. Those principles apply especially well to agents, because agents can select actions dynamically.
OpenID Connect gives applications a standard way to obtain claims about an authenticated end user through an ID Token. OAuth-style access tokens, by contrast, represent delegated access to a resource. Do not use the words interchangeably: an identity claim does not automatically grant permission to delete a customer record, and a tool credential should not be treated as proof of a human’s identity.
An agent system commonly has at least five principals:
- the initiator: a human user, scheduled job, or upstream service that requested work;
- the agent run: a bounded execution with a purpose, input, and expiry;
- the workload: the deployed service or runtime authenticated to infrastructure;
- the tool: the downstream service performing an operation; and
- the resource owner or tenant whose policy governs the resource.
Collapsing all five into one bearer token loses the information needed to enforce and investigate a decision.
Model the Principal Chain
Represent delegated authority as data, not as an assumption hidden in a prompt. At minimum, carry an immutable run ID, actor ID, tenant, requested capability, policy decision, and expiry alongside every tool call.
type Delegation = {
runId: string;
initiator: { type: "user" | "service"; id: string };
workloadId: string;
tenantId: string;
capability: "issues:comment" | "issues:read";
resourceScope: { projectId: string };
expiresAt: Date;
};
async function addIssueComment(
input: { issueId: string; body: string },
delegation: Delegation
) {
await policy.assertAllowed({
subject: delegation.initiator,
action: delegation.capability,
resource: {
type: "issue",
id: input.issueId,
projectId: delegation.resourceScope.projectId,
},
});
return issues.comment({
...input,
author: delegation.initiator.id,
runId: delegation.runId,
});
}The policy check must use the real target resource, not only a coarse “agent may use issue tools” flag. An agent that may comment in project A should not gain access to project B because it can guess an identifier. Relationship and attribute-aware checks are often a better fit than a single global role: tenant membership, document ownership, project assignment, data classification, and time-bound approval all matter.
Never Let Prompt Text Become Authority
A tool description, system prompt, or model claim that a user “approved this” is not authorization. Authority comes from verified identity, policy, and a server-side decision at the moment of the action.
Authenticate Workloads, Authorize Actions
The workload needs its own machine identity to access databases, queues, model providers, and internal tools. Use short-lived workload credentials where the platform supports them, scope them to the runtime’s minimum infrastructure needs, and rotate or revoke them independently of user sessions.
That workload identity says which service is calling. It does not say which user’s authority is being exercised. The downstream tool should receive enough signed or server-verifiable context to evaluate both. A useful policy input looks like: “workload support-agent, acting for user u_42, in tenant acme, requests refund:propose for order o_7, from run r_9.”
Keep high-risk side effects behind dedicated server-side capabilities rather than giving the model a general database or admin token. proposeRefund, createDraft, and requestApproval are safer interfaces than executeSql or callAnyInternalApi. Capability design is authorization design.
Design Delegation That Can Be Revoked
Delegation should be narrow, short-lived, and interruptible. Bind it to an audience (the intended tool), a tenant, an operation family, and—where feasible—a specific resource or approval. Expiry limits how long a leaked or stuck run can act. A run status check and a revocation record give operators a way to halt pending authority before a background worker reaches its next tool call.
Avoid forwarding a user’s long-lived session credential through every agent layer. Mint a constrained, purpose-specific credential or resolve the delegation server-side at the tool boundary. The OAuth security best current practice, RFC 9700 (opens in new tab), is a useful baseline for protocol choices; it does not substitute for your application’s resource policy.
For irreversible or externally visible operations, insert an approval boundary with a human-readable summary: what will happen, to which resource, on whose behalf, and with what external consequence. Approval is not a generic “continue” button. It should create a specific, expiring grant that the action can consume once.
Put authority near the tool boundary
There are two tempting but fragile designs. In the first, the orchestrator receives a powerful token and every tool trusts the orchestrator’s judgment. In the second, every tool asks the model to supply an actor identifier and trusts that value. Both centralize too much trust in the least deterministic part of the system.
Instead, make the tool gateway or service enforce the decision. The orchestration layer may request a capability, but the service that owns the resource verifies the delegation and evaluates the policy. This keeps a compromised prompt, a confused tool planner, or an implementation bug from converting broad infrastructure access into broad customer access.
type ToolRequest = {
delegationId: string;
action: "invoice:send";
invoiceId: string;
};
export async function sendInvoice(request: ToolRequest) {
const delegation = await delegations.loadActive(request.delegationId);
const invoice = await invoices.find(request.invoiceId);
await policy.assertAllowed({
subject: delegation.initiator,
workload: delegation.workloadId,
tenantId: delegation.tenantId,
action: request.action,
resource: invoice,
});
return invoiceDelivery.send(invoice, { runId: delegation.runId });
}The important detail is that invoice is loaded before the decision. A tenant ID or identifier supplied by the agent is an input, not proof. The resource’s authoritative tenant, state, and relationship data should drive authorization.
Session identity is not delegated authority
Human sessions and agent runs have different lifecycles. A session might remain valid for hours, while an agent’s permission to send one invoice should expire after minutes or a single use. A user can lose a role while the run is waiting on a queue. An administrator can cancel a run after a risky plan has been proposed. If the agent merely holds the original session token, the system has no natural point to make those changes effective.
Resolve or re-check delegation immediately before each consequential tool call. For long-running workflows, re-evaluate policy after resume points rather than treating authorization at workflow start as permanent. This is especially important when the task can wait for human approval, cross a day boundary, or touch data whose classification may change.
The same separation helps incident response. You can revoke a specific run, freeze a workload identity, remove a user’s access, or disable one tool independently. A single shared credential makes every response an all-or-nothing outage.
Define Capabilities at Human Scale
Capabilities should map to outcomes a reviewer can understand. “Read customer profile” and “draft a renewal email” are reviewable. “Call CRM API” is too broad. A narrow capability can include a verb, a resource type, a tenant, optional relationship conditions, a value limit, and expiry.
| Capability | Appropriate scope | Unsafe shortcut |
|---|---|---|
cases:read | Cases assigned to the initiator’s team in one tenant | Global read token for the support database |
email:draft | Create an unsent draft for a named customer | Permission to send arbitrary email |
refund:propose | Propose a refund under a policy limit | Payment-provider administrator credential |
invoice:send | One approved invoice, once, before expiry | Reusable access token for every invoice |
This does not mean every action needs a brand-new protocol. It means the domain interface should expose the smallest meaningful authority. Combining a focused capability with server-side policy makes a tool easy to document, test, approve, and eventually retire.
Plan for Failure and Revocation
An authorization denial is an expected system outcome, not an exceptional crash. The agent should receive a controlled response that distinguishes “not allowed” from “resource missing” only to the degree your information-disclosure policy permits. It should not receive an internal policy expression, token contents, or hints about another tenant’s resources.
When a user revokes consent or an operator cancels a run, mark the delegation inactive in durable storage and have tools check that state. Token expiry alone may leave an unacceptable window. If a tool has started an external side effect, record the attempt and surface an operator workflow for compensating action; cancellation cannot unsend an email or reverse an already-settled payment.
Test revocation as an event sequence: create a grant, queue work, revoke the grant, then execute the tool. The correct result is a denial with no side effect. Repeat it with retries and duplicate messages. The test is more valuable than a diagram because it proves the enforcement point sees fresh state.
Audit the Decision, Not Just the API Call
An audit event should reconstruct the authorization story without storing sensitive prompts or secrets. Record the initiator, workload, run ID, tenant, requested capability, resource identifier or safely scoped reference, decision, policy version, time, and outcome. Link related tool calls through the run ID and preserve a correlation ID across queues and retries.
Log denials too. They reveal broken integrations, ambiguous policy, and attempted privilege escalation. Protect audit logs as security data: an agent transcript or full document body can be far more sensitive than the fact that a comment was attempted.
Test the negative cases deliberately: cross-tenant identifiers, expired grants, cancelled runs, a changed user role midway through a long task, a tool invoked outside its audience, and a duplicate approval. The happy path only proves an agent can act. These tests prove it can stop.
Key Takeaways
- Separate the initiator, agent run, workload, tool, and resource owner in your identity model.
- Authenticate workloads for infrastructure access; authorize each requested action against the current resource policy.
- Make delegation explicit, narrow, expiring, and revocable—never a silent prompt-level assumption.
- Prefer focused capabilities over general-purpose admin credentials.
- Audit the actor, authority, target, decision, and outcome so an action remains attributable after the run ends.
Next, we turn identity into practical policy with least privilege: capability scopes, resource relationships, approval boundaries, and the small grants that make powerful tools safe to compose.