Identity and authentication for AI systems and agents
In this lesson you will:
- Classify human and non-human identities in AI systems
- Design identity architectures for non-repudiation and verified accountability
- Choose machine-to-machine authentication protocols and token types
- Apply federation, MFA and SSO to AI platforms
- Manage secrets and keys for AI platforms
When an agent sends an email, updates a record or calls another agent, the questions every audit asks are: who did this, on whose behalf, with what authority? Identity architecture for AI exists to answer them reliably.
1. Human and non-human identities
| Category | Examples | Notes |
|---|---|---|
| Human users | Employees, customers, administrators, reviewers | SSO, MFA, lifecycle tied to HR or customer records |
| Workloads | Model servers, training jobs, pipelines | Workload identity; short-lived credentials |
| Agents | Assistants and autonomous agents | Each needs its own identity, an accountable human owner, and defined scope |
| Services | Vector databases, gateways, model provider accounts | Service accounts or managed identities |
| Tools / connectors | MCP servers, plugins, API integrations | Their own credentials, scoped per tool |
Common anti-patterns: agents running under a human's personal account; many agents sharing one service account; long-lived API keys copied between projects. All destroy accountability.
2. Non-repudiation and verified accountability
To attribute an agent's action, you need to know both the agent and the human (or process) it acted for.
- Distinct identity per agent (and per agent instance where useful).
- Delegated authorisation — the agent acts with a token that represents the user's authority, narrowed to the task, rather than the agent's own broad rights. OAuth 2.0 token exchange (on-behalf-of) patterns carry both the user ("subject") and the agent ("actor").
- Signed requests and audit logs that record user, agent, tool, parameters, result and time — tamper-evident and centrally collected.
- Human approvals recorded with the approver's identity, so high-impact actions trace to a person.
3. Machine-to-machine authentication
| Mechanism | Use | Notes |
|---|---|---|
| OAuth 2.0 client credentials | Service-to-service API access | Prefer short-lived access tokens; scope narrowly |
| Token exchange / on-behalf-of | Agent acting for a user | Preserves user identity in the chain |
| Mutual TLS (mTLS) | Service and agent authentication at the transport layer | Certificates bound to workload identity |
| Workload identity (e.g. SPIFFE-style IDs, cloud workload identity federation) | Workloads prove identity from their platform without stored secrets | Eliminates long-lived keys in code |
| Signed JWTs / proof-of-possession tokens | Bind tokens to a key so stolen tokens are harder to replay | Useful between agents |
| Static API keys | Legacy and many model providers | Store in vaults, rotate, restrict by IP/scope, monitor — and replace where possible |
4. Federation, MFA and SSO
- SSO for every AI tool and platform — notebooks, model consoles, vector-database admin UIs, agent builders — so access follows the identity lifecycle and is logged centrally.
- Phishing-resistant MFA for administrators of AI platforms, registry promoters and anyone who can change prompts, tools or guardrails.
- Federation across clouds and partners, so external agents and users authenticate with their own identity providers under agreed trust.
- Conditional access — device, location and risk signals for sensitive AI functions.
5. Secrets and keys for AI platforms
AI platforms multiply secrets: model-provider keys, embedding-service keys, vector-database credentials, OAuth client secrets for connectors, signing keys, dataset encryption keys.
- Central vault with access policies and audit.
- Short-lived, dynamically issued credentials wherever supported.
- Never in prompts, notebooks, code or images — inject at the tool-call boundary.
- Secret scanning in repositories, notebooks and logs (including prompt logs).
- Rotation on schedule and immediately on exposure; per-environment and per-project secrets so one leak has limited reach.
Worked example — redesigning a finance agent's identity
Before: an accounts-payable agent ran under a finance manager's personal account with a static API key to the ERP system stored in its configuration.
| Problem | Redesign |
|---|---|
| Actions appeared as the manager's — no way to tell human from agent | Agent has its own workload identity registered in the AI inventory, owned by the Finance Ops lead |
| Static ERP key with full write access | Token exchange: agent receives a short-lived token carrying the requesting clerk's identity, limited to invoice-matching scopes |
| No record of which clerk asked for what | Every tool call logged with user, agent, scope and invoice ID |
| Manager leaving the company would break the agent — or leave it running | Agent identity has its own lifecycle and reviewer, independent of any person's employment |
🔐 Security lens
If your logs can't distinguish "Priya approved this payment" from "the agent Priya was using approved this payment", you don't have non-repudiation — and you won't win the argument after an incident.
Key takeaways
- Classify identities: humans, workloads, agents, services and tools; agents need their own identities and owners.
- Non-repudiation needs per-agent identity, delegated (on-behalf-of) authorisation carrying user and actor, and tamper-evident logs.
- Prefer workload identity, mTLS and short-lived scoped tokens over static API keys.
- SSO and phishing-resistant MFA for AI platforms; federation for partners and external agents.
- Vault secrets, issue them dynamically, scan for leaks — and keep them out of model context.
Self-check
- What two identities should an on-behalf-of token carry when an agent acts for a user?
- Why is running an agent under a human's personal account a problem?
- Name two alternatives to static API keys for machine-to-machine authentication.