An AI agent asks LumoAuth who it is by calling the OpenID Connect UserInfo endpoint with its own access token. For an agent, the response holds sub (agent_ followed by the agent ID), name, agent_id, capabilities, budget_policy, workload_identity, tenant and identity_type, which is always agent. GET /agents/me adds the scope of the token that made the call. Neither call counts against the agent’s budget.
TL;DR
- UserInfo, from OpenID Connect Core section 5.3, returns the agent’s record: its ID, its name, its capabilities, its budget with the current usage, and the binding that you registered for it.
- An agent needs no
openidscope at UserInfo, but it needs an access token. Anagk_API key works on/agents/meand not on UserInfo. /agents/mereturns the scope of the token that made the call. That scope can be narrower than the agent’s capabilities.- Both calls read the agent’s record at the time of the call. They do not count against the budget, and a suspended agent gets
401from both. - Do not decode the access token to find out who the agent is. RFC 9068 says that a client must not inspect it, and the token is a copy from the time of issue.
Why does an agent need to ask who it is?
An agent starts with a credential: an API key, a client secret, a private key, or a token from the platform where it runs. The credential proves to LumoAuth who the agent is. It does not show the agent’s code what LumoAuth has on record for the agent.
That record changes after the code is written. An administrator adds a capability, sets a budget or binds the agent to another repository. An agent that has its permissions written into its code misses those changes. It then fails in the middle of a task, instead of at the start with a clear message.
So the agent asks. Three questions come up in practice:
- Who am I? The agent’s ID and name, for its logs and for messages to its owner.
- What may I do? The capabilities on the agent’s record, and the scope of the token that the agent holds now.
- How much is left? The budget limits, the usage in the current windows, and the step limit for the agent’s own loop.
UserInfo answers the first and the third question, and the record half of the second. /agents/me answers the token half.
What does OpenID Connect say about UserInfo?
OpenID Connect Core 1.0, section 5.3, defines UserInfo as an OAuth protected resource. It returns claims about the person who signed in. Four rules from the specification matter here:
- The client sends the access token as a Bearer token (RFC 6750), with GET or POST.
- The response is a JSON object.
- The
subclaim is always present. It identifies the subject within the issuer. - An error uses the error codes of the Bearer scheme, such as
invalid_token, in aWWW-Authenticateheader.
LumoAuth applies these four rules to agents too, and it changes one thing. In OpenID Connect, the access token comes from a sign-in that asked for the openid scope. An agent does not sign in that way. Its token’s scope is a subset of its capabilities, such as tickets:read, and it never includes openid. LumoAuth therefore answers an agent’s own token without openid. The answer describes only the agent’s own record, never a user.
What does UserInfo return for an agent?
The agent sends its access token to the UserInfo endpoint of its organization:
ORG=acme-corp
curl -sS "https://app.lumoauth.dev/orgs/$ORG/api/v1/oauth/userinfo" \
-H "Authorization: Bearer $AGENT_ACCESS_TOKEN"
For the support agent from the post on budgets, LumoAuth returns this response:
{
"sub": "agent_agt_3f9a51c07be24d18",
"name": "Support triage prototype",
"agent_id": "agt_3f9a51c07be24d18",
"workload_identity": "client_secret:agt_3f9a51c07be24d18",
"capabilities": ["tickets:read", "tickets:reply"],
"budget_policy": {
"max_steps": 40,
"timeout_seconds": 600,
"max_api_calls_per_hour": 500,
"max_cost_per_month_usd": 50,
"api_calls_this_hour": 47,
"api_calls_today": 310,
"tokens_used_this_hour": 18230,
"tokens_used_today": 412530,
"cost_today_usd": 1.21,
"cost_this_month_usd": 14.87,
"exhausted": false
},
"tenant": "acme-corp",
"identity_type": "agent"
}
Every claim in this response is always present:
| Claim | What it holds |
|---|---|
sub |
agent_ followed by the agent ID. The agent’s access tokens carry the same sub |
name |
The agent’s display name |
agent_id |
The agt_… ID, as the portal and the Admin API show it |
workload_identity |
The binding on the agent’s record. The next section explains it |
capabilities |
The capabilities on the agent’s record at the time of the call, in their stored form |
budget_policy |
The limits that are set, the settings max_steps and timeout_seconds when you set them, the usage in the current hour, day and month, and exhausted |
tenant |
The slug of the agent’s organization |
identity_type |
Always agent. It shows that the subject is an agent, not how the agent proves its identity |
Three details are easy to miss:
capabilitiesdescribes the agent, not the token. If the agent asked for a token with fewer scopes, UserInfo still lists every capability./agents/meshows what the token covers.budget_policyis the same object that the budget post describes. A limit that is not set is left out.max_stepsandtimeout_secondsappear only when you set them, and the agent’s own loop must apply them.- LumoAuth sends the response with
Cache-Control: no-store. A proxy between the agent and LumoAuth therefore keeps no copy of the usage.
What does workload_identity hold?
workload_identity shows the binding on the agent’s record. What it holds depends on how the agent proves its identity:
| How the agent proves its identity | workload_identity |
|---|---|
| Workload identity | The binding that you registered, such as github:acme-corp/support-bot:refs/heads/main, k8s:support/triage-bot or a SPIFFE ID |
| AAuth | The agent’s AAuth identifier |
| Custom | The identity that you entered |
| API key, client secret or private key JWT | A label such as client_secret:agt_3f9a51c07be24d18, or null. It names no workload |
For a workload agent, the claim shows the binding, not one run. Suppose that you bound the agent to a whole repository, github:acme-corp/support-bot. A run from any branch of that repository can then attest, and UserInfo still shows the repository. The exact subject of one run is in the response to its attestation, under identity.subject. The docs on workload attestation list the format for each platform.
What does /agents/me add?
GET /agents/me is LumoAuth’s own endpoint. No standard defines it. It answers the token half of “what may I do?”:
ORG=acme-corp
curl -sS "https://app.lumoauth.dev/orgs/$ORG/api/v1/agents/me" \
-H "Authorization: Bearer $AGENT_ACCESS_TOKEN"
Here the agent asked for a token with only tickets:read, for example to hand it to a tool that only reads tickets:
{
"identity": {
"id": "agent_agt_3f9a51c07be24d18",
"type": "agent",
"tenant": "Acme Corp",
"agent_id": "agt_3f9a51c07be24d18",
"status": "active"
},
"capabilities": ["tickets:read", "tickets:reply"],
"scope": ["tickets:read"],
"workspace": {
"slug": "acme-corp",
"api_base": "/orgs/acme-corp/api/v1/"
}
}
scopeis the scope of the token that made the call. This token can read tickets but not reply, although the agent holds both capabilities. The post on capabilities explains why a token can be narrower than its agent, but never wider.scopeisnullfor anagk_API key. A key stands for the agent itself, with all of its capabilities./agents/meis the endpoint that answers an API key, because UserInfo needs an access token.identity.tenantis the organization’s display name. The slug is inworkspace.slug. In UserInfo,tenantholds the slug.identity.statusisactiveon every successful call. LumoAuth answers only an active agent, so a suspended agent gets401and no status.
A token can cover less than the agent’s record for a second reason. If you add a capability to the agent, UserInfo lists it at once. The tokens that the agent already holds do not cover it, so the agent needs a new token to use it. A removal works the other way: it revokes the agent’s live tokens, and the agent’s next call gets 401.
Which endpoint should the agent call?
LumoAuth has a third endpoint, GET /me, for code that may run with a user’s token or with an agent’s token. For an agent, it returns subject_type: "agent", the capabilities, the token’s scope and scope_narrowed. scope_narrowed is true when the token leaves out one of the agent’s capabilities. GET /me also returns identity_type, but there it names how the agent proves its identity, such as workload. The three endpoints compare like this:
| UserInfo | GET /agents/me |
GET /me |
|
|---|---|---|---|
| Defined by | OpenID Connect Core | LumoAuth | LumoAuth |
| Credential | Access token | Access token or agk_ API key |
Access token |
| Capabilities on the record | Yes | Yes | Yes |
| Scope of this token | No | scope |
scope and scope_narrowed |
| Budget and usage | budget_policy |
No | No |
| Binding on the record | workload_identity |
No | No |
| How the agent proves its identity | No | No | identity_type |
Use UserInfo when the agent starts and before costly steps. Use /agents/me when the agent holds an API key, or to find out what a token covers. Use /me in a library that serves users and agents with one call.
All three endpoints are for the agent itself. An API of yours that receives the agent’s token checks it with token introspection instead. Introspection answers active: false once the agent is suspended.
Why not read the access token itself?
An agent token from LumoAuth is a signed JWT, so the agent could decode it. It should not, for three reasons:
- The standard says so. RFC 9068, the JWT profile for access tokens, says in section 6 that a client must not inspect the content of an access token. The format can change at any time, and code that reads the token then breaks.
- A token is a copy from the time of issue. LumoAuth reads the agent’s record on each UserInfo call. A capability that you added after issue appears in UserInfo and not in the token.
- Some answers are never in the token. The usage changes with every call that counts, so no token carries it.
The token is for the API that receives it. The agent treats it as an opaque string, sends it, and asks UserInfo when it needs to know something.
What does the agent get when it cannot ask?
UserInfo and /agents/me check the token like every other endpoint of LumoAuth’s API:
- The agent is suspended, revoked or inactive. Both answer
401witherror: invalid_tokenand aWWW-Authenticate: Bearerheader. The same answer comes for a revoked or expired token, and for an organization that is suspended. - The token was issued for another server, such as an MCP server, with the
resourceparameter of RFC 8707. Both answer401. A token for another server is not a credential for LumoAuth’s own API, so that server cannot replay it here. - The token is bound with DPoP. The agent sends it with the
DPoPscheme and a fresh proof (RFC 9449), as on every other endpoint. Without the proof, the answer is401. - LumoAuth refuses the agent under a conditional access policy. Both answer
403witherror: access_policy_deniedand a reason code. The governance docs describe these policies. - The budget is spent. Both calls still work. They do not count against the budget, so the agent can read which window is spent.
After a 401, the agent should get a new token once, because its token may have expired. If the new request fails too, the agent should stop and tell its owner. The agent may be suspended, and a loop of new attempts does not help.
How should an agent use the answer?
In Python, the lumoauth package (version 1.4.0 or later) wraps both calls. get_agent_info() calls UserInfo, and get_identity() calls /agents/me. This start-up check stops the agent before its first step if its record does not fit the task:
from lumoauth import LumoAuthAgent
# Reads LUMOAUTH_ORG_ID, AGENT_CLIENT_ID and AGENT_CLIENT_SECRET from the environment
agent = LumoAuthAgent()
agent.authenticate()
# UserInfo: the agent's record at the time of the call
info = agent.get_agent_info()
needed = ["tickets:read", "tickets:reply"]
missing = [name for name in needed if not agent.has_capability(name)]
if missing:
raise SystemExit(f"{info['agent_id']} lacks {missing}. Ask its owner to add them.")
budget = info.get("budget_policy", {})
if budget.get("exhausted"):
raise SystemExit("Budget spent: stop the task and tell the owner")
max_steps = budget.get("max_steps", 20)
# GET /agents/me: what this token covers
me = agent.get_identity()
print("Running as", me["identity"]["agent_id"], "with scope", me["scope"])
has_capability() uses the matching rules of the server, so an agent that holds tickets:* has tickets:read too. Write each name as the server stores it, such as tickets:read. LumoAuth rejects tickets.read in token requests and in calls to the Ask API. Five habits make the answer useful:
- Check at the start, and fail with a clear message. A missing capability is a setup error. Name it before the first step, instead of failing at step 7.
- Apply
max_stepsandtimeout_secondsin the agent’s own loop. LumoAuth stores them and returns them, but the agent’s steps never reach LumoAuth. - Do not treat the capability list as the decision. Before each action, call the Ask API. It also applies your policies, deny rules and the token’s scope, and LumoAuth records each denial in the audit log.
- Read the record again during a long run.
has_capability()keeps the answer from the first call. Callget_agent_info()again after a change, or after an unexpected403. - Log
agent_idwith every step. Your logs and the LumoAuth audit log then name the same agent. Never log the token.
How LumoAuth does it
In the Organization Portal, go to Agents (/portal/agents) and open the agent. The section Test this agent has Mint test token. It issues a token for the agent that expires after 5 minutes and carries token_use: test. The portal shows the token once, with a curl command for GET /agents/me, so you see the answer that the agent sees. A test token works on /agents/me, the Ask API and permission checks. It is refused for just-in-time requests, the Token Vault, approval prompts, usage reports, token exchange and delegation. You need the agents.edit permission, and LumoAuth records each test token in the audit log as agent.test_token.issued.
The agent itself needs no extra setup. Every agent can call UserInfo and /agents/me with its own credential, whatever its capabilities.
The docs for the agent registry describe the UserInfo response for agents. The Ask API docs cover /agents/me, and the API reference covers /me. This series starts with What is an AI agent identity?, and the previous post covers budgets for agents.
Standards involved
- OpenID Connect Core 1.0, section 5.3, which defines the UserInfo endpoint
- OAuth 2.0 bearer token usage, RFC 6750, for the
Authorizationheader and theinvalid_tokenerror - JWT profile for OAuth 2.0 access tokens, RFC 9068, whose section 6 tells clients not to read access tokens
- Resource indicators for OAuth 2.0, RFC 8707, for tokens that belong to another server
- OAuth 2.0 demonstrating proof of possession (DPoP), RFC 9449, for bound tokens
- OAuth 2.0 token introspection, RFC 7662, for an API that receives the agent’s token
The full list is on the standards reference.
FAQ
Does an agent need the openid scope to call UserInfo?
No. In OpenID Connect, UserInfo describes a person who signed in, and that person’s token carries openid. An agent does not sign in that way, and its token’s scope is a subset of its capabilities. LumoAuth therefore answers an agent’s own token without openid, and the answer describes only the agent’s own record.
Can an agent call UserInfo with its agk_ API key?
No. UserInfo needs an access token. With an agk_ API key, the agent calls GET /agents/me instead.
Why does UserInfo list capabilities that my token cannot use?
UserInfo describes the agent, not the token. A token covers less than the agent’s capabilities when the agent asked for fewer scopes, or when you added a capability after the token was issued. GET /agents/me returns the token’s scope next to the capabilities.
Can a suspended agent still ask who it is?
No. A suspended, revoked or inactive agent gets 401 at UserInfo and at /agents/me, as on every other endpoint. An agent whose budget is spent can still ask, because these calls do not count against the budget.
Should an agent decode its own access token instead? No. RFC 9068 says that a client must not inspect the content of an access token. The token also shows the agent as it was when the token was issued, and it never holds the budget. UserInfo reads the agent’s record at the time of the call.
Related: AI agent identity on the solutions pages, and capabilities, not scopes on this blog.
Register your first agent at app.lumoauth.dev/register.