As of November 2026. This is a proof of concept, not a production system. All identifiers in this post are examples.
This is the fourth post about a proof of concept with two AI agents. Agent A runs on Azure, in Microsoft Foundry. Agent B runs on Google Cloud, in Agent Runtime. The first post gave each agent an identity with no stored secret, and the second gave them models with no API key. The third answered "who is the agent acting for?" when the person is a customer: one five-minute token per hop, asked for by whoever hands the request on.
Not everyone who talks to these agents is a customer. Operators are people inside the organisation, such as a contact centre, who reach the same agents and the same services. They do not sign in at the customer identity provider. They sign in with Entra ID, like everyone else at work.
An operator does one of two things:
- Acts for themselves. They look a customer up, or ask an agent something that involves no customer.
- Serves a customer. They have a customer on the line and ask the agents about that customer's accounts.
This post shows how both reach the same agents and services under the same rules as customers. It also covers what Entra ID tokens make hard: cutting a person off quickly. A short section at the end covers the third case: an agent acting with no person behind it at all.
Why the operator's Entra token cannot simply travel
The customer design from the last post rests on tokens we issue ourselves: one destination, five minutes, an act claim that names every actor, a scope that only shrinks, and a session the gateways can check. An Entra access token has none of that, and we cannot add it:
- It lives 60 to 90 minutes. Microsoft documents a random lifetime in that range (configurable token lifetimes). We measured 78 to 82 minutes for our operators' tokens. Entra can shorten access tokens for an API to 10 minutes with a token lifetime policy. Microsoft discourages it, it does not apply in CAE sessions, and a 10-minute token still cannot be taken back, names no actors and cannot shrink.
- It cannot be taken back. Disabling the account and revoking the sessions stops new tokens. For a token already issued to an API of your own, Microsoft says that the user "loses access when the access token expires", and asks the application to "stop accepting Microsoft Entra access tokens even if they're still valid" (revoke user access). Continuous Access Evaluation, which does cut live tokens, is documented for Microsoft's own services only (CAE). Entra has no introspection endpoint.
- It names one audience and no chain of actors. Entra's own delegation flow, on-behalf-of, swaps one Entra token for another Entra token. It cannot add our agents to an
actclaim, or shrink a scope that our services define.
Forwarding the operator's Entra token through two agents would leave a token that keeps working for over an hour in the hands of each of them, that any of them could replay as the operator, and that says nothing about the agents.
The idea: the Entra token stops at the gateway
The rule from the customer design applies unchanged: the sign-in token stops at the gateway. At the entry, the gateway exchanges the operator's Entra token for a token from an internal token service, with RFC 8693 token exchange (RFC 8693). From there on, everything is as for customers:
- Whoever hands the request on asks for the next token, as itself, with its own platform identity and no secret.
- Each token is addressed to one destination, lasts at most five minutes, and never outlives the token it came from.
-
actgrows by one actor per hop, and the scope only shrinks.
The internal token service is a second realm in the same Keycloak, next to the customers' realm, with its own signing keys. They are kept apart on purpose: customer identity and internal identity are two trust domains, and a configuration mistake in one does not open the other. The services trust both issuers, and every token says what kind of subject it carries (subject_kind: customer, operator or platform). Nobody has an account in the internal realm. Operators exist only in Entra ID.
In the proof of concept, operators enter through Apigee, in front of Agent B. The gateway checks the Entra token as it does for any person: signature, tenant, audience, and a delegated token (scp). It then checks the operator role: an Entra app role assigned to the operator, which the inventory maps to what that role allows. A person with no operator role is refused before any exchange.
Case 1: the operator acts for themselves
The gateway exchanges the Entra token as itself, the same way it exchanges a customer's sign-in token. The internal token says:
-
subis the operator's Entra object id, andsubject_kindisoperator; - the scope is what the operator's role allows by itself;
-
origin_iatis the time Entra issued the operator's token (more on that below).
What the role allows by itself is narrow on purpose. In the demo it is one operation: look a customer up in the accounts service, with the customer's reference in the request (accounts.lookup). The service answers, and logs which operator looked up which customer.
The same operator can also talk to an agent without naming a customer. The agent then holds a token with no customer in it and no scope on accounts: the lookup scope is above the agent's ceiling, so the token service leaves it out. The agent cannot read anyone's accounts with it, and the service refuses an operator's own token on a customer operation.
Case 2: the operator serves a customer
The operator names the customer they are serving when the request enters. The gateway passes the name on with the exchange, and the internal token service checks three things before it answers:
- the operator's role allows serving customers;
- the customer exists, and their account is enabled, in the customers' realm;
- the scope is within what that customer may do and within the role's ceiling for serving.
The token it issues has the customer in sub and the operator as the first actor in act. From there, the agents hand the request on as they do for a customer, and each one is added to act:
The token the accounts API receives:
{ "iss": "https://sts.example.com/realms/internal", "sub": "customer-7f3a…", "subject_kind": "customer", "aud": "accounts", "azp": "agent-a", "scope": "accounts.read", "act": { "client_id": "agent-a", "type": "agent", "act": { "client_id": "agent-b", "type": "agent", "act": { "sub": "operator-3c9e…", "type": "operator", "idp": "entra" } } }, "origin_iat": 1795560000, "exp": 1795563127 } A few details matter:
- The scope is an intersection again. Token scope = what the customer may do ∩ the role's ceiling for serving ∩ the ceiling of every agent on the path ∩ what was asked for. In the demo, the customer may read and order transfers, the role may only read while serving, and so may the agents. Every token in the chain says
accounts.read. - Money never moves. The service refuses any transfer with an operator or an agent anywhere in
act, whatever the scope says. The token service never issues the transfer scope through this path anyway. - The customer is checked at every hop, not just at the entry. Each exchange confirms that the customer still exists and is enabled. If the customer's account is disabled while a chain is running, the next exchange is refused.
- The service sees who served the customer.
actnames the operator, with its kind, so the service's log answers both "for whom" and "by whom". It also tells the two issuers apart: operations that only a customer may start, such as handing a request to the agents, refuse a token from the internal realm.
Cutting an operator off
This is the hard part, and the reason the Entra token stops at the gateway.
For customers, we own the issuer. Every internal hop asks the customer CIAM whether the customer's session is still open (RFC 7662 introspection), and a sign-out stops the chain. For operators, the session lives at Entra, and Entra will not tell our gateways that it has disabled someone. So the gateways keep a cut list.
One command writes the operator's object id to the cut list of both gateways, then reads it back from both, and fails if either did not take it. From then on, a token is refused if its chain started before the cut. That check runs:
- at the entry, against the Entra token's
iat; - on every internal hop, against
origin_iat, on the operator insub(case 1) or the operator inact(case 2).
Only a gateway may exchange a person's Entra token at the token service, and it checks the cut list first, so a cut operator gets no new chain. The token service does not read the cut list itself. An agent that already holds an internal token can still exchange it for the next hop, but only until that token's five minutes run out, and the next gateway refuses the result.
origin_iat is a claim of our own. Every internal token copies the time Entra issued the token the chain started from. We first used auth_time for this. RFC 9068 defines auth_time as the time the person authenticated, which an Entra access token does not tell us, so we stopped borrowing it (RFC 9068).
We measured it live. About ten seconds after the command, both gateways refused the operator's token. In the other test, an agent was already holding its token for the next hop when the operator was cut. API Management refused it with operator_access_revoked.
A timed entry leaves the list by itself after two hours, longer than an Entra token for our APIs lives. A hard entry, which refuses every token of that person whatever its time, stays until someone removes it.
The order in an incident. The cut list closes the window that Entra leaves open. It does not replace the steps at Entra:
- Cut at both gateways. This stops the person in seconds, including tokens already issued.
- Disable the account in Entra. Entra stops issuing new tokens.
- Revoke the sessions in Entra. This invalidates refresh tokens and session cookies, with a delay of a few minutes (revokeSignInSessions).
The demo uses the hard cut, because it does not touch the Entra account: the browser would otherwise get a fresh Entra token silently, issued after the cut, and walk straight back in. That is the same reason step 2 matters in production.
No person at all: the platform
The third case is an agent that acts on its own, with nobody behind it. Agent to agent with their own identities, as in the first post, needs no token from us. Calling a service is different: a service must never hand customer data to a caller with no customer behind it.
The agent exchanges its own Entra token (an application token issued for the internal token service, not a person's token) for a token with a platform scope. The token service only accepts it from that agent's own identity, only for a business domain and never for another agent, and the token has no act and no person. In the demo, Agent A reads the product catalogue this way. The service opens only the operations its contract marks as platform operations, none of which return customer data. A platform token on customer accounts is refused.
Where this sits among the standards
As in the last post, we keep to what published documents say.
- RFC 8693 describes a token service that converts tokens between security domains. That is the entry exchange, and the platform token.
- The IETF OAuth Transaction Tokens draft (working group draft) exchanges the external token at the entry for an internal one. Ours are per destination rather than for the whole call chain.
- NIST SP 800-204 recommends that user session tokens do not travel beyond the gateway.
- NIST IR 8587 (NIST and CISA, September 2026) says access tokens should be valid for no more than one hour, and that issuers should propagate revocation to relying parties (NIST IR 8587). Our internal tokens last five minutes. The Entra token's 60 to 90 minutes is why the cut list exists.
- OWASP recommends short lifetimes and, when tokens must be revoked, a deny-list where they are consumed (JWT cheat sheet).
Shared Signals and CAEP are final OpenID specifications, but we found no documented way for Entra to send those events to a third-party receiver. If that changes, the cut list becomes a safety net instead of the main mechanism, with no change to the rest of the design.
What we learned the hard way
- Two realms, not one. The customers' realm uses Keycloak's narrow-only policy: an exchange can never return a scope that the token it started from does not have. An Entra token has no
scopeat all, so in that realm the entry would come out empty. In the internal realm the narrowing is the extension's, and tests cover it. - Operators have no account, and Keycloak wants one. A token exchange in Keycloak is tied to a user. We use Keycloak's transient users, which live only for the session and are never stored, so nobody has an account in the internal realm, which a test checks.
- A timed cut is not enough on its own. The first version of the demo cut tokens issued before a given time. The browser renewed the operator's Entra token in the background, and the new token was issued after the cut. In production, disabling the account closes that door. In the demo we use the hard cut.
- Client credentials gave the platform too much. The obvious way for an agent to get a token with no person is the client credentials grant. In our Keycloak setup that token carried every audience the agent's client could reach, other agents included, and the agent could exchange it into a chain it should not have. Exchanging the agent's own Entra token limits the destination to the domain it asks for.
- Keycloak finds a federated client by its identity, not by its name. Our first design gave each agent a second client for platform tokens, with the same identity. Keycloak looks a client up by the identity in the assertion, so two clients with one identity do not work. One client per identity per realm.
What this design asks of you
The cut is as fast as whoever triggers it. Measured, it takes seconds once the command runs. Nothing runs it automatically. Microsoft Graph can notify you of changes to users, but Microsoft does not document a latency for those notifications (change notifications), so we kept the cut a step in the incident runbook. A gateway could also read the person's state from Graph (accountEnabled, signInSessionsValidFromDateTime) with a short cache. We did not, to keep Graph off the path of every request and out of the question of what to do when it does not answer.
The gateways are where the cut lives. Our services never see an Entra token: they only accept internal tokens, and every path to them goes through a gateway that checks the cut list. Anything that accepted operators' Entra tokens directly, outside the gateways, would not know about the cut.
The token service is on every hop that carries a person. The customers' realm and the internal realm run in the same Keycloak, so its availability is the chain's availability, for operators as for customers. If it does not answer, the exchange fails and the request stops there. We have not load-tested it. One server is also one blast radius: separate realms protect against a configuration mistake in one of them, not against a compromise of the server itself.
Removing a role takes effect with the next Entra token. A role already inside an issued token stays there until it expires. The cut list removes the person, not the role. A timed cut forces a new token, which no longer carries the role.
These are bearer tokens. A stolen internal token works for at most five minutes, at one destination, and only for a caller that matches its actor at the gateway. Holder binding, as RFC 9700 recommends, is not done (RFC 9700).
The rules are our own code. As for customers, they live in a Keycloak extension nobody outside the project has reviewed, on an interface Keycloak does not promise to keep stable. Our operator tests have 51 checks, from a person with no operator role to a platform token on customer data.
Wrapping up
- Operators sign in with Entra ID, and their Entra token stops at the gateway.
- From there on, they get the customers' rules: five-minute tokens, one destination, every actor in
act, a scope that only shrinks. - Acting for themselves, the operator is the subject, with a narrow scope of their own. Serving a customer, the customer is the subject and the operator is the first actor, read only.
- Entra cannot take an issued token back. One command cuts the person at both gateways, on every hop, in seconds. Disabling the account in Entra keeps them out.
- An agent with no person behind it gets a platform scope that opens no customer data.




