Applies to v1.3.18

Run Identities

Purpose

This page explains what a scheduled or webhook-started run of a hosted agent executes as, and how to set that identity up: the two kinds of run identity and when to choose each, registering a client-credentials application in Microsoft Entra ID, Okta and Keycloak, using an application API key, limiting which agents may use an identity, and what an application identity cannot do.

Why Unattended Runs Need One

When a person or an application calls an agent — over A2A, with Run… or with the executions API — the run executes as that caller. Schedules and webhooks have no caller: nobody is present to authenticate. A webhook sender proves only that it may fire the trigger; it is never the identity the run uses.

So every schedule and webhook trigger names a run identity: an application, defined by a Security administrator, that the run executes as. The run identity is what:

  • the agent's access policy is evaluated against, at every run;
  • each tool's access policy is evaluated against, for every tool call;
  • the audit trail records as the caller;
  • a downstream system sees, when a tool passes the caller's own token through.

A run identity grants nothing a caller with the same credential could not already do by calling the agent directly. It is a real credential — an API key or a token your identity provider issues — governed by the same policies as any other application caller.

Who Does What

Task Where Role
Create, edit, test and delete run identities; decide which agents may use each Security → Agent Run Identities Security area manage role
Choose a run identity for a trigger Apps & Tools → Agent Triggers, trigger editor Apps & Tools manage role. Only identities allowed for the trigger's agent are offered
Allow the identity to call the agent and its tools Agent Directory access policies; tool access policies Apps & Tools

Because the roles are split, the person who writes a trigger cannot choose an identity the Security administrator has not allowed for that agent.

The Two Kinds

Kind The run presents Choose it when
Application API key An existing API key of a client application, resolved by the platform at each run You want the simplest setup, and the agent's tools use shared downstream credentials. Roles, scopes and claims come from the key, as an Apps & Tools administrator issued it
OAuth client credentials An access token your identity provider issues to an application registration, obtained with the client-credentials grant at run time Your organization manages application identities in its identity provider, wants the provider — not the platform — to decide what the identity holds, or has tools that pass the caller's token through to a downstream API

The kind is fixed once the identity exists.

Creating A Run Identity

In Security → Agent Run Identities, choose New run identity and fill in, on the editor page:

  • Name and Description.
  • Kind, then the kind's fields (below).
  • Agents that may run as it — Every hosted agent of the tenant, or a chosen list. An identity is offered only to triggers of the agents allowed here, and is checked again at every run.
  • Enabled — a disabled identity cannot be used; runs that name it fail.

Then select the identity in the list and choose Test run identity in its summary: it resolves the identity exactly as the Runtime will, and shows the principal it becomes — subject, user name, whether it is an application, roles, scopes and groups — or why it cannot be resolved. A failure because the identity provider was unreachable is reported as transient.

Check identity

In the trigger editor, Check identity goes one step further than Test run identity: it checks the identity chosen there against that trigger's agent the way the next run will, and stops at the first thing that would refuse it.

Result What it means What to do
Ready The identity resolves, and the agent's access policy allows it for at least one skill — or the agent has no skills Nothing, unless a tool is listed as refused. The editor lists the skills the run may use, any it may not, and each allowed skill's tools
The agent is inactive Every run of the agent is refused, whatever its identity, so the identity is not checked Activate the agent in the Agent Directory, then check again
Not allowed for this agent The identity does not exist, is disabled, or does not list this agent Ask a Security administrator to enable it or add the agent under Agents that may run as it
Identity refused The identity cannot be resolved: a revoked or expired key, a client the identity provider rejects Fix the identity under Security → Agent Run Identities. Retrying will not help
Identity unavailable The identity provider could not be reached, or failed Try again. A run that meets this is retried if the trigger allows it
No tool would be available to the run The identity may use the agent's skills, but each of the tools they use refuses it, or is no longer published, so every run would stop before calling the model Admit the identity in each tool's access policy — Open its access policies goes to the toolset or the ESRA exposure — or publish the tool again
Denied by the agent's access policy The identity resolves, but no access policy on the agent allows it for any of the agent's skills, so every run would fail Add an access policy on the agent that admits this identity — by client id, role or scope. A policy that restricts issuers admits an API-key identity only when it includes Platform API key

It also shows whom the identity resolved to — its name, client id, issuer, roles and scopes — and, for each skill, the reason the policy gave. Under each skill the identity may use, it lists the skill's tools as a run would get them: those the run gets, and those it would be refused, each with the reason and the policy that decided, and a link to where the tool's access policies are kept. That answers why can't it…? before the run: a run that goes without one of its tools says so too, but only after it has run. It never shows a token, a secret or any other claim.

Check identity needs the Apps & Tools manage role, not a Security role: it tells a trigger's author whether the trigger will run without showing them how the identity is configured. It runs nothing, and saving a trigger does not depend on it. The run checks again when it runs, so a permission revoked after the check still stops it.

Application API key

  • Client application — the application whose keys to list.
  • API key — one of its keys. Keys that are revoked or expired are marked unusable.

The platform never stores or needs the raw key: it resolves the key record directly. The key must be active and unexpired at each run — revoking it, or letting it expire, makes the next run fail with failure kind IdentityRefused. Roles, scopes, groups and claims the key carries are what policies match. See Application API Keys.

OAuth client credentials

  • Identity provider — a trusted identity provider configured under Security → Trusted Identity Providers. The platform finds the provider's token endpoint from its authority or metadata address. The platform's own sign-in issuer, Platform (device flow & web sessions), is not offered: it signs people in and issues no client-credentials tokens. To run as a caller the platform itself issues, use an application API key.
  • Client id — the application registration's client id.
  • Client secret — either A secret in the Secret Store allowed for the identity-providers usage, or Enter it here, which stores it for this identity alone. It is never shown back; on an edit, leaving it untouched keeps the current secret. Deleting the identity deletes a secret entered here, but never a shared Secret Store secret.
  • Scope — what to request, for example api://apimapper/.default for Entra ID.
  • Audience — optional. The platform sends the scope and the audience together as the token request's scope parameter, so use it only for a provider that expects an extra scope value there; most setups need only Scope.

At run time the platform obtains a token, caches it in memory until shortly before it expires — never on disk — and then validates it exactly as it validates a token from an external caller: the trusted identity provider's issuer, allowed audiences, allowed client ids and claim mapping profile all apply. A token the Runtime would refuse from a caller is refused here too, and the run fails with that reason.

So before creating the run identity, make sure a token obtained with these values would be accepted as a caller: its iss matches the provider entry, its aud is an allowed audience, and its client id is allowed. Obtaining one by hand with the requests in Obtaining a token with client credentials and decoding it is the quickest check.

Registering A Client-Credentials Application

The steps below create an application identity in your identity provider whose tokens the platform accepts. The same registration works for a webhook sender in bearer mode.

Microsoft Entra ID

  1. Expose the platform as an API (once per directory). In App registrations, register an application that represents the platform's API — for example ApiMapper Runtime — and under Expose an API set its Application ID URI, for example api://apimapper. Under App roles, add a role allowed for Applications, for example Agents.Run.
  2. Register the run identity's application. App registrations → New registration, for example ApiMapper run identity — finance agents. No redirect URI.
  3. Under Certificates & secrets, create a client secret. Copy its value — Entra shows it once — and store it in the run identity (or the Secret Store).
  4. Under API permissions → Add a permission → My APIs, choose the platform's API, Application permissions, the Agents.Run role, and Grant admin consent.
  5. In the platform: the trusted identity provider for your directory must accept these tokens — its issuer must be the iss they carry (for a v2.0 token, https://login.microsoftonline.com/<directory-tenant-id>/v2.0), its allowed audiences must include their aud (the API's application ID URI or its client id, depending on the token version), and, if it restricts client ids, the new application's client id must be allowed. Obtain one token by hand and decode it to read the exact values.
  6. Create the run identity: kind OAuth client credentials, that provider, the application's client id and secret, scope api://apimapper/.default.

The token carries idtyp: app and the app role in roles. Write access policies on the role (Agents.Run) or the client id.

Okta

  1. Use a custom authorization server (Security → API → Authorization Servers) whose audience is the platform, for example api://apimapper, and add a scope, for example apimapper.agents.
  2. Applications → Create App Integration → API Services, for example ApiMapper run identity. Copy its client id and client secret.
  3. On the authorization server, add an access policy and a rule that allows the Client Credentials grant for this application and the scope.
  4. In the platform: a trusted identity provider with the authorization server's issuer (https://<your-okta-domain>/oauth2/<authorization-server-id>), audience api://apimapper, and the client id allowed. Okta puts the client id in cid and scopes in scp; make sure the provider's claim mapping profile reads them.
  5. Create the run identity: kind OAuth client credentials, that provider, the client id and secret, scope apimapper.agents.

Write access policies on the scope or the client id.

Keycloak

  1. In the realm, Clients → Create client, client type OpenID Connect, for example apimapper-run-finance.
  2. Turn on Client authentication and Service accounts roles; turn off the browser flows you do not need. Copy the secret from the Credentials tab.
  3. Add an audience mapper so tokens carry the platform's audience: in the client's dedicated scope, Add mapper → By configuration → Audience, included client audience or custom audience apimapper, added to the access token. Without it the token has no audience the platform allows.
  4. Grant the service account the realm or client roles your policies will check, under Service account roles.
  5. In the platform: a trusted identity provider with the realm's issuer (https://<keycloak-host>/realms/<realm>), audience apimapper, and the client id allowed. Keycloak puts the client id in azp and roles under realm_access.roles and resource_access; make sure the claim mapping profile reads the roles you use.
  6. Create the run identity: kind OAuth client credentials, that provider, the client id and secret; leave Scope empty unless you defined client scopes to request.

Allowing The Identity In Policies

Resolving is not authorizing. After the identity resolves, the run must still pass:

  • the agent's access policy — add a rule in the Agent Directory that admits the identity, by client id, role, scope or claim (see Hosted Agent Mode);
  • each tool's access policy, for every tool the agent calls (see Runtime Authorization).

A run the agent's policy refuses fails with failure kind PolicyDenied. Each tool the agent's skills use is checked against the identity before the agent starts:

  • when the identity may use none of them, the run fails with ToolsRefused before the model is called, so no tokens are spent;
  • when it may use some of them, the run goes ahead with those, and the execution lists the others and why, as a warning on every screen that shows the run.

What An Application Identity Cannot Do

A run identity is always an application, never a user. That has consequences for tools that act on a downstream system on behalf of a user:

  • Delegated grants do not work. On-Behalf-Of and token exchange need a user to act for. A tool configured that way refuses an application caller, as it would refuse an application calling it directly. See User And Application Callers.
  • Pass-through of the caller's token works only with an OAuth client-credentials identity, and the downstream API then sees that application's token. An API-key identity has no token to pass, so such a tool fails.

Design unattended agents around this:

  • give their tools shared downstream credentials — an API key, basic authentication, or a client-credentials token the platform holds — or configure delegated tools' authentication profiles to call the downstream system as the application;
  • keep tools that must act as a specific person for attached runs — Run…, the executions API with a user token, or A2A;
  • give each unattended use its own run identity, with the narrowest roles, so the audit trail and the downstream system can tell them apart.

When A Run Identity Fails At Run Time

Failure kind Cause Retried?
IdentityRefused The identity is deleted, disabled, not allowed for the agent, its API key is revoked or expired, its secret cannot be read, or the provider rejected the credentials or issued a token the Runtime refuses No — fix the configuration
IdentityUnavailable The identity provider could not be reached, or answered with a server error Yes, if the trigger allows more than one attempt
PolicyDenied The identity resolved, and the agent's access policy refused it No
ToolsRefused The identity resolved, but no tool the agent's skills use is available to it: each tool's access policy refused it, or the tool is no longer published No — admit the identity in the tools' access policies

Deleting a run identity is not refused while triggers still name it; their next run fails with IdentityRefused and a reason naming the identity. Check the Triggers tab on the Agent Triggers page for triggers that use it before deleting one.