Non-human identity security for AI agents

AI agents are non-human identities that act for people. Formal checks both on every request: the agent signs in with its platform's short-lived OIDC token instead of a stored key, policies see the person it works for, and each log entry names the human, the agent and the machine user.

identity · agentsexample
# each request carries the agent, its person and the token's claims
VERIFY  cursor  owner_email=maya@acme.com  -> machine user cursor-agents
VERIFY  devin   requesting_user_email=leo@acme.com  -> machine user devin
AGENT   claude-code on leo's laptop, matched by code signature
ALLOW   cursor-agents for maya  read-only query on prod-replica
BLOCK   devin for leo  orders table, no approval for this session

The problem

Are AI agents non-human identities?

Yes: they sign in like workloads and act for a person. They authenticate with tokens and keys, and no one types a password for them. Two things set them apart from a CI job: an agent picks its next action from whatever it just read, and it usually runs for the one person who started it. A Formal machine user access token is valid for 10 years or until someone refreshes it (token validity), a fair trade for a Looker instance that runs the same dashboards every day. An agent runs for minutes, so non-human identity security for agents has to happen per request, with a short-lived token and the person attached.

  1. One machine user token shared by every agent run

    Every Cursor run your team starts uses the same token, so the requests look identical whoever launched them.

  2. Keys copied into agent sandboxes and images

    The fastest way to give an agent access is a machine user token in an environment variable, and that token lasts for years.

  3. Logs that name the agent and never the person

    Discovery and rotation records won't show which person an agent was working for when it ran a query, and that is the first thing an incident review asks.

today · no policy on the pathexample
01
cursor-agents · run for mayaconnect prod-postgres with the shared tokenALLOWED
02
sandbox · cursor runtoken valid for 10 years, read from envALLOWED
03
devinSELECT id, status FROM ordersALLOWED

# Agent and engineer traffic is mixed on one laptop, and an inventory that finds the key can't stop the request.

Definition

What is a non-human identity?

non-human identitynoun

A non-human identity (NHI) is a credential that software uses to authenticate on its own behalf: a service account, an API key, an OAuth client, a certificate, or a workload identity such as a Kubernetes service account token or a SPIFFE ID.
  • Non-human identity management

    The work of finding those credentials, giving each one an owner, scoping them and rotating them before they leak.

  • Machine identity

    The term PKI teams often use for certificates and keys alone.

  • AI agents, the newest kind of NHI

    And the awkward one. What is AI agent identity? explains how agents authenticate, how delegation claims work and how long agent tokens should live. This page is about enforcing that identity on each request.

Where NHI tools stop

What NHI security tools cover, and what they leave open

Most non-human identity security tooling is organized around the credential. The OWASP Non-Human Identities Top 10 follows the same lines, with improper offboarding, secret leakage and long-lived secrets among its risks. Two of its entries are about request time: NHI9 is reuse, one identity serving many components, and NHI10 is human use of NHIs, which OWASP says leads to “indistinguishable activity between humans and automation.” Agents hit both. Formal is not an NHI inventory. If you have thousands of unowned keys, start with discovery. Formal is the layer you add when agents begin using credentials against production.

NHI inventory toolsFormal
ScopeDiscovers service accounts and keys across clouds and SaaSGoverns the identities that connect through it, at the Endpoint, the Connector and the Control Plane
LifecycleMaps each key to an owner, flags the over-privileged ones, rotates or revokes themDoesn't scan your clouds for service accounts and doesn't rotate secrets
Reuse (NHI9)Knows the one machine user that serves every Cursor run existsSeparates each run's requests by the person it acts for
Human use (NHI10)Can't separate a laptop agent from the engineer whose keys it usesTells the agent from the engineer by process
At request timeKnowing the key exists doesn't separate the requestsDecides on each request what that identity may do and for whom, then records it

How it works

How non-human identity security works in Formal

  1. Step 1 of 4

    Create a machine user per agent platform

    Each cloud agent platform or workload gets its own machine user, so its requests never borrow an engineer's identity.

    MACHINE USERSexample
    • cursor-agents · Cursor Cloud AgentsMACHINE
    • devin · Devin sessionsMACHINE
    • github-deploy · GitHub ActionsMACHINE
  2. Step 2 of 4

    Add an OIDC integration

    Pick the issuer preset, pin the claim condition to your team, organization or repository, and keep the end-user email expression that names the person behind each run.

    OIDC INTEGRATION · CURSORexample
    • Issuer preset: Cursor✓
    • Claim condition: claims.team_id✓
    • End-user email: claims.owner_email✓
  3. Step 3 of 4

    Point the agent at Formal

    The headless Endpoint in a Cursor or Devin environment signs in with the platform's token. Other workloads exchange their token for a federation token and connect through the Connector.

    SIGN-INexample
    • Cursor OIDC token exchanged for a machine sessionALLOWED
    • CreateFederationToken, expires within 1 hourALLOWED
    • CreateFederationToken with an API keyBLOCKED
  4. Step 4 of 4

    Write policies on both identities

    Policies read the machine user, its claims under input.user.oidc.claims and the person under input.end_user. Review the result in Logs and the Access Graph.

    POLICY INPUTexample
    • input.user · cursor-agentsMACHINE
    • input.user.oidc.claims.repo_urlCLAIM
    • input.end_user · maya@acme.comPERSON

At runtime

AI agent identity management at runtime

Where the agent runs decides how Formal identifies it. A laptop agent borrows its engineer’s session, while a cloud agent or CI job brings a token from the platform that runs it. Either way the log ends up with the same three facts: whether a person or an agent sent the request, whom it was for, and what it touched. The policy inputs docs list every field.

Tell apart

Tell agents from humans

On a laptop, Claude Code or Codex has no credential of its own. It uses the engineer’s SSH keys, GitHub token and cloud CLI session, so on the network its traffic looks like the engineer’s. The Formal Endpoint separates them by process, for the 22 AI agents and coding tools Formal recognizes.

  • Network rules match process.is_agent, and process.has_agent_ancestor for the git and curl processes an agent spawns
  • macOS matches code-signed process identity; Linux matches the installed binary’s process name, which is less precise; network rules don’t run on Windows yet
  • Policies get an input.agent object with the agent’s type, LLM provider and version, so one Postgres policy can let an engineer run a migration and stop the agent in their terminal from doing it
  • Cloud agents and CI jobs are machine users, marked machine in user.formal.type
Securing AI coding agents ›
endpoint · leo-mbpexample
09:12:40leo · terminalpsql prod: run migrationALLOWED
09:15:02claude-code for leopsql prod: run migrationBLOCKED
Attribute

A machine user acting for an end user

A cloud agent platform can’t mint a credential for everyone who launches an agent, but it does sign a token that says who started the run. An OIDC integration’s End-User Email Expression is a CEL expression over the verified claims, and Formal resolves its result to a Formal human user when the token is exchanged. The presets use claims.owner_email for Cursor and claims.requesting_user_email for Devin (cloud agent guide).

  • The session uses the machine user for credentials and the person as the end user for policy and audit; on resources with linked accounts, the Connector sends that person’s own linked account upstream
  • The OIDC docs say to build the expression only from claims the workload can’t choose; the person is the platform’s statement, not proof that they signed in
  • If the expression is set and the email matches no Formal user, Formal issues no token
  • At Cursor, Cloud Agents connect through a dedicated Formal identity with limited access, and end-user identity propagation adds the employee who started the task
  • We built end-user identity for BI tools like Metabase; cloud agents had the same shape, as described in how we give our own cloud agents production access with OIDC
control plane · token exchangeexample
run startcursor · owner_email=maya@acme.comexchange for machine user cursor-agentsALLOWED
run startcursor-agents for mayaend user resolved: maya@acme.comALLOWED
run startdevin · requesting_user_email=new@acme.comno Formal user with that emailBLOCKED
Record

Attribution on every request

Every query, command or API call through Formal is attributed to a user. For an agent run, the log entry carries the machine user, the end user and the token’s verified claims under user.oidc.claims, such as the Devin session ID or the Cursor repository. Search for everything one session did, or everything agents did for one engineer last week.

  • Control-plane audit events keep the integration and a bounded copy of the claims, never the raw JWT
  • The Access Graph draws the same logs in layers: humans, agents, machine users, Connectors and resources
  • It’s built from traffic that actually happened, so an identity holding access it never used won’t appear, and it doesn’t replace an access review
logs · searchexample
sam@acme.com> agents acting for leo@acme.com, last 7 days
machine userend userclaimrequest
devinleo@acme.comsession_idSELECT id FROM orders
cursor-agentsleo@acme.comrepo_urlgit push acme/app
devinleo@acme.comsession_idGET /v1/balance
3 rowsALLOWED
Approve

Example: a Devin session asks for the database

The Devin guide puts the pieces together. A policy blocks Devin’s machine user from the database by default. When a session needs data, it triggers a Formal workflow with its own short-lived OIDC token and says why it needs access and for how long. Formal maps the token to the devin machine user and to the engineer who started the session, then asks that engineer in Slack.

  • A yes creates a policy suspension scoped by two signed claims, the requester’s email and the session ID, so the block lifts for that requester and that Devin session only, until the requested duration runs out
  • The next session asks again; in Logs, the session shows the devin machine user, the engineer as end user and Devin’s claims
  • Just-in-time access with the agent as the requester and the person who launched it as the approver; Devin security and the JIT access explainer go further
slack · #data-accessexample
FormalAPP
devin for leo requests database access for this session
Machine user
devin
End user
leo@acme.com
Scope
requester email and session ID
Duration
as requested
leo approved for this Devin session only. The next session asks again.
APPROVED

No stored keys

Non-human identity security without stored keys

OIDC integrations swap the long-lived token for the one the platform already issues. Formal verifies the signature, issuer, audience and expiry, evaluates a claim condition, and runs the call as the integration’s machine user. Because most issuers serve many customers, the claim condition is what pins the trust to your organization. This one, for Cursor Cloud Agents, is from the cloud agent guide.

  • 15 built-in issuer presets, or any OIDC provider as a custom issuer
  • An OIDC-authenticated machine user calls CreateFederationToken and gets a Connector credential that expires at min(upstream OIDC JWT exp, now + 1 hour); API keys and human sessions can’t mint one
  • Connector policies (2.16.1 and later) read input.user.oidc.claims.*, to allow a session only from one repository and branch, one E2B project or one SPIFFE ID
  • SPIRE’s JWT-SVIDs expire after five minutes by default, and the SPIFFE ID arrives as sub
  • The Connector adds the database password, SSH key or API key itself as a native user, so the agent never holds it
  • Some paths still use a key: the Endpoint’s Kubernetes sidecar and its E2B template use a machine user API key you should rotate; on Amazon ECS the sidecar signs in with the task role over OIDC
  • Pipelines follow the same pattern, covered in CI/CD secrets management; GitHub Actions is usually the first trust teams set up
OIDC integrations docs ›
claim condition · cursortext
claims.team_id == "<CURSOR_TEAM_ID>" &&
claims.repo_url == "github.com/<ORGANIZATION>/<REPOSITORY>"

Next to your stack

Where Formal sits next to your IdP and NHI tools

Formal sits on the request path between agents and the systems they reach: it checks each request against the agent, the person it acts for and the token’s claims, holds the upstream credential and writes the log. What to know before you buy is in the last four rows.

  • Your identity provider

    Issues human identity. Formal reads it through SSO with Okta, Entra ID, Google Workspace, OneLogin or JumpCloud, plus SCIM, so policies use the groups you already manage.

    Human identity
  • Your NHI or secrets tool

    Inventories and rotates the credentials spread across your clouds.

    Inventory
  • Formal on the request path

    Checks each request, holds the upstream credential and writes the log.

    Every request
  • Only identities that connect through it

    Formal doesn’t discover service accounts, keys or certificates elsewhere, and native user credentials are rotated by hand, in one place.

    Limit
  • The Access Graph shows observed traffic

    It lists no permissions.

    Limit
  • Laptop agents need the Endpoint

    Telling a laptop agent from its engineer needs the Endpoint, with network rules on macOS and Linux.

    macOS and Linux
  • The person is the platform's assertion

    Pin each integration to your organization, and decide which agent platforms you trust to name your engineers.

    Trust decision

We’d begin with the agent platform your team already uses: one OIDC integration pinned to your team ID, the owner mapped as end user, and a Control Plane Permission that denies the agent’s machine user every Formal API except the ones the Endpoint uses to sign in and send logs. Every request that agent makes then has a person attached and no key to leak.

Works with

Works with your agent platforms and workloads

Trust the tokens your platforms already issue. OIDC integrations come with 15 built-in issuer presets, and any other OIDC provider works as a custom issuer (OIDC integrations docs). On laptops, where agents have no token of their own, the Endpoint identifies them by process.

Identities: human, machine and end users ›

Where it runs

One identity model, enforced by both proxies

Identities, OIDC integrations and policies live in the Control Plane. The Formal Endpoint applies them on laptops and in cloud agent VMs, and the Connector applies them in front of databases, Kubernetes, SSH hosts and APIs, so an agent’s request meets the same identity checks wherever it starts.

Formal Endpoint in cloud agents

The headless Debian package runs in Cursor Cloud Agent and Devin environments and signs in with the platform’s short-lived OIDC token (guide).

Formal Endpoint on laptops

Transparent Mode on macOS and Linux; roll it out to Macs with your MDM. Existing clients keep working without a base URL change (docs).

Formal Connector in your VPC

Linux on AMD64 or ARM64: AWS ECS Fargate behind a Network Load Balancer, or Helm on EKS, GKE, AKS or on-premises Kubernetes. In production, run 2 or more nodes behind a load balancer (deployment).

Your identity provider

People sign in with SSO, and SCIM keeps users and groups in sync.

Logs in your SIEM

Log integrations forward Formal logs to AWS S3, Google Cloud Storage, Azure Blob Storage, Datadog, Splunk or Panther.

Policy and configuration as code

Policies are written in Rego. Manage Formal with Terraform, Pulumi or the Kubernetes Operator.

Audited controls

Formal holds SOC 2 Type II and ISO/IEC 27001. The reports are on security.formal.ai.

In production

Technologies secured
10+
Resources secured
1,000+
Logs per week
40M+
Sessions per week
600K+
“We've limited the amount of data that those cloud agents can access and we're able to tie that back to the specific user who is using that cloud agent, which is a feature that I'm only aware of Formal having.”
Roy Xu
Roy Xu
Software Engineer, Security, Cursor
Read the Cursor story ›

FAQ

Questions about non-human identity security

Buying and fit

What is non-human identity management?

Non-human identity management is the lifecycle work for service accounts, API keys, certificates and workload identities: finding them, naming an owner, scoping access, rotating and offboarding. Machine identity management often means the certificate part of that job, issuing and renewing TLS certificates, which Formal doesn’t do. Formal covers the runtime part for identities that connect through it: who the caller is on each request, who it acts for and what it may reach.

AI agents

Do AI agents need their own credentials?

They need an identity of their own, separate from the engineer’s and from other agents, but it doesn’t have to be a stored secret. A cloud agent can present the token its platform signs for each run and trade it for a Formal credential that expires within the hour. Laptop agents are the exception: they ride on the engineer’s session, and the Endpoint tells them apart by process.

How do you tie an AI agent to a human owner?

Take the owner from a claim the agent platform signs, never from anything the agent writes, such as the reason it gives in an access request. Before you activate an integration, check that every Cursor owner or Devin requester has a Formal user with the same email: an owner who doesn’t resolve gets no token at all. A machine user acting for an end user explains the mapping.

What happens to an agent run with no person behind it?

Scheduled and webhook-triggered runs carry no requester claim. We’d give them a separate OIDC integration with the end-user expression left empty, mapped to a machine user with narrower access, so a missing claim never passes for a named engineer and those runs stay easy to find in the logs.

Product

Does Formal discover all non-human identities?

No. Formal sees the non-human identities that authenticate through it: machine users on the Connector and Control Plane, OIDC integrations, and agents the Endpoint detects. A service account that talks straight to AWS never shows up, and the Access Graph lists only identities that sent traffic. For a full inventory of keys and certificates across clouds and SaaS, run a discovery tool alongside Formal.

What is the difference between a machine user and a Native User in Formal?

A machine user is an identity: the agent, service or CI job that connects through Formal and that policies and logs refer to. A Native User isn’t an identity. It holds the credential the Connector uses to sign in to the resource, such as a Postgres password, an SSH key or an AWS role, which is why the agent itself never needs the database password.

Can Formal enforce least privilege for non-human identities?

For requests that go through Formal, yes. Policies can scope a machine user by its token claims (repository, branch, sandbox, session) and by the person it acts for, and an agent can start with no standing access and ask for it one session at a time. Formal doesn’t change roles granted inside your cloud accounts or SaaS apps, so keep those narrow too. Zero standing privileges covers the pattern.

Give one agent an identity of its own

Connect one cloud agent platform with OIDC, map each run to the engineer who started it, and see every request it makes.