Agent Identity and Attribution
In this article
- Name the requester, the executor and the authority of any action an agent takes.
- Read the subject and actor fields of a token and the trace id beside it, and write the audit line they should produce.
- Explain why one shared service account loses who asked, and spot log lines that cannot be attributed.
- Terms defined here: agent identity, service account, subject claim, actor claim, audit record.
Overview
A refund of 30 went through on order 8841 last night, and a manager asks a fair question: who did that? The log says agent-bot. That name tells you which account pressed the button. It says nothing about the person who asked for the refund, or whether that person was allowed to ask.
When a program acts for a person, every action has more than one party behind it. By the end you can take any action an AI agent performs and name three parties: who requested it, who executed it, and whose permission allowed it. You can read those parties off a request and its log line, and you can spot the line that has lost one.
Who takes part
Here is the setup. Alice (alice@acme) is a support lead at Acme, a made-up company. She gives Acme's support assistant a task: check order 8841 and refund 30 if it arrived damaged. The assistant is an agent service called support-agent. To touch orders it makes a tool call to orders-mcp, a tool server that owns order lookups and refunds.
Each of these is a security principal: something a system can identify and then decide what to allow. Agent systems have four kinds:
- End user: a person. Here, Alice.
- Agent workload: the running agent program, here support-agent. It has an agent identity of its own, separate from Alice's: it is named as the one acting when it works for her, and it can also act on its own behalf with no user at all. [1]
- Service account: a service account is a non-human account that gives a workload its own identity. Kubernetes, for example, keeps service accounts for workloads and automation apart from user accounts, which are for people. [2]
- Tool or downstream service: the program the agent calls to get work done, here orders-mcp.
Three roles in every action
For every action, ask what part each principal played:
- Requester: who asked for it?
- Executor: which program carried it out?
- Authority: whose permission makes it allowed?
In a plain web app the three answers are usually one person: Alice clicks Refund and the app acts as Alice. An agent pulls them apart. For the refund on 8841, Alice is the requester, support-agent is the executor, and the authority should be Alice's own permission: she may refund up to 5,000, and the agent should not be able to do anything she could not. Google's ADK guidance names this as the benefit of acting under the user's identity: the agent performs only actions the user could have performed. [3]
Alice's name in the chat proves nothing: the words the model reads (model-visible context) are text anyone can type. Who asked has to reach orders-mcp in a form it can check.
One shared account
Before reading on, predict: support-agent calls orders-mcp through one shared account, agent-bot, which every agent and every user goes through. What can orders-mcp write in its log?
10:42 agent-bot refunded 8841 amount=30 result=okThe requester is gone: nothing in the call says Alice asked. The executor is blurred, since you cannot tell which agent used agent-bot. Authority is the worst loss. orders-mcp never learns that Alice exists, so it cannot hold the refund to her rights; agent-bot must carry enough rights for every user it serves, and each of those users can reach all of them through the agent. Google's ADK guidance says acting on the agent's own identity fits only when every user is allowed the same things, and that the tool must then keep its own record of which user each action was for, because every action will look like the agent's. [3]
:::note In practice On the Claude API, a service account is a named non-human identity; it has no email address, password or Console login. Because each workload signs in as its own named service account, you can audit which workload acted as which account. [4] :::
Subject and actor
The fix is to send both names with every call, inside a credential that orders-mcp can trust: an access token. An access token is a signed set of named fields, called claims, which the receiver checks before it believes any of them. [2,4] Acme's token service issues and signs it after Alice signs in; support-agent cannot write it, and orders-mcp checks the signature against that service's keys. Two claims carry the split. The subject names whom the action is done for, alice. The actor names who is doing it, support-agent. [1]
Here is what orders-mcp receives with the refund call, and the audit line it writes:
call refunds.create order=8841 amount=30
header trace: t-77 (beside the token)
token sub: alice (subject: whom it is for)
act: support-agent (actor: who is doing it)
audit requested_by=alice executed_by=support-agent
authority=alice action="refund 30 on 8841"
time=10:42 result=ok trace=t-77Read the audit line against the three questions. The requester comes from sub, the executor from act, and the authority is Alice's permission, because the token speaks for her: orders-mcp compares the refund of 30 with her limit of 5,000 before it acts.
The trace id is not in the token. It is a plain label, here t-77, that support-agent attaches to the request as a header when Alice's task starts. Every service passes the label on with its own calls and copies it into every audit line it writes. It proves nobody's identity; it only ties lines together.
:::note In practice Microsoft Entra Agent ID puts the same split into its agent tokens under its own claim names: an actor facet claim (xms_act_fct) identifies the entity doing the work, and a subject facet claim (xms_sub_fct) identifies the one the work is for. [1] When an agent works for a user, the token it sends on to the next API keeps the user as subject and names the agent identity as actor. [1] :::
The audit record
An audit record is the log entry that keeps this split for one action, so the action can be traced back later. [1,3] In Acme's design each one holds seven fields: who asked, who ran it, whose permission, what was done, when, the result, and the trace id.
One task leaves lines in more than one service. Here are three made-up lines from Alice's task, written by two services that never read each other's logs, with time and result left out:
| written by | requester | executor | authority | action | trace |
|---|---|---|---|---|---|
| support-agent | alice | support-agent | alice | accept task | t-77 |
| orders-mcp | alice | support-agent | alice | read order 8841 | t-77 |
| orders-mcp | alice | support-agent | alice | refund 30 on 8841 | t-77 |
Search both logs for t-77 and the whole task lines up in order: accepted, order read, refund made. Without the label you would match lines by time and guess.
When nobody asked
Not every run starts with a person. Suppose support-agent also runs a nightly job that rechecks yesterday's refunds. Nobody asked for it, so its lines show support-agent as executor and no requester. That is no defect. Entra describes the same case: with no user context, the agent identity acts on its own behalf, it appears as both actor and subject, and it uses permissions an administrator granted to it directly. [1] No person is behind the call, so the agent fills both places; the requester stays empty, and the authority is the agent's own, because an administrator granted those permissions. Entra's guidance is to give such an agent two token paths, one for requests a user started and one for scheduled work with no user behind it. [5] In Acme's design that identity belongs to the agent alone, so switching it off leaves Alice's account untouched.
One caveat: an empty requester is fine only where no user is expected; on a call that should have come from a user, it is the shared-account defect again.
Put the three kinds of line side by side and the rule falls out:
| log line | requester | executor | authority |
|---|---|---|---|
| sub=alice, act=support-agent | alice | support-agent | alice |
| agent-bot refunded 8841 | unknown | agent-bot (which agent?) | unknown |
| nightly, sub=act=support-agent | none, no user | support-agent | support-agent |
Track every principal on its own, and keep subject and actor apart at every hop. Any column you cannot fill is a logging defect, and the missing field tells you what to add.
:::note In an interview Asked how to audit an agent, say: keep requester, executor and authority apart; send the user as the token's subject and the agent as its actor, which is how Entra Agent ID tokens work [1]. Carry a trace id beside the token into every audit line, and never route users through one shared account, because it loses who asked. :::
Common mistakes
- One account for every agent. Symptom: every line says agent-bot, and nobody can tell which agent or which user. Fix: give each agent its own identity and send the user as the subject.
- Requester taken from the chat. Symptom: the log says alice because the prompt mentioned her. Fix: write the requester from the signed subject claim, never from text.
- Trace id used as proof. Symptom: a service lets a call through because its trace id matches a known task. Fix: the trace id only joins lines; identity comes from the token.
- A scheduled job run as a user. Symptom: a nightly run is logged as if Alice asked. Fix: Entra's guidance is not to act on a user's behalf when no signed-in user started the operation; use the agent's own app-only access. [5]
In production
- Kubernetes gives a Pod the namespace's
defaultservice account when you do not assign one, so several workloads can end up sharing an identity without anyone choosing it. Name one account per agent. [2] - Use the same field names in every service's audit lines, and alert on a line with an empty requester on a path where a user is expected.
Sources
- Tokens in Microsoft agent identity platform. Microsoft. Checked 21 Nov 2026.
- Service Accounts (Kubernetes docs). Kubernetes. Checked 25 Oct 2026.
- Safety and Security for AI Agents (ADK docs). Google. Checked 25 Oct 2026.
- Workload Identity Federation. Anthropic. Checked 24 Oct 2026.
- Choose an authentication protocol for an agent. Microsoft. Checked 21 Nov 2026.
Check yourself
Check yourself
Question 1 of 13
In an action by an agent, what does the authority role name?
Your first check counts towards your result.