Blank white background with no objects or features visible.

We’re sharing complimentary access to the full Gartner Hype Cycle for AI Governance 2026. Get your copy →

Securing AI Agents with SPIFFE and SPIRE: Workload Identity for Autonomous Agents

By Ashish Dubey

Updated: October 27, 2026

Published: October 27, 2026

TL;DR:

The weakest link in most agent deployments is a long-lived token sitting in a config file. SPIFFE and SPIRE remove it by deriving identity from where the agent runs.

  • SPIFFE is a standard for workload identity; SPIRE is its reference implementation. Together they give each running agent an attested, short-lived credential instead of a secret someone mints and copies around.
  • The credential is an SVID — a SPIFFE Verifiable Identity Document — carrying a SPIFFE ID like spiffe://acme.com/ns/agents/sa/research-agent. It is issued only to a workload that matches a registered attestation policy, and it rotates automatically before expiry.
  • TrueFoundry treats the SVID as an inbound identity. Register SPIRE as an identity provider, register the agent as identity-provider-backed, and the agent presents its JWT-SVID in x-tfy-agent-authorization like any other agent token.
  • The gateway then resolves the SVID to a registered agent, checks whether it may act on the target and for the user, and forwards the call with the right outbound credential.
  • Revocation is a kill switch: deregister the workload entry and its instances stop receiving SVIDs at the next rotation. No secret to rotate, nothing to leak. (First-class SPIFFE binding on the agent spec is marked coming soon in the docs.)

Why a stored secret is the wrong foundation for an agent

An autonomous agent that holds a static API key or OAuth client secret has the same problem every service account has, only worse: the credential outlives the need for it, it gets copied into images and config files, and anyone — or any prompt-injected tool call — that reads it can impersonate the agent. The more agents and the more instances, the more copies of long-lived secrets you are tracking.

SPIFFE flips the model. Instead of presenting a secret to prove identity, a workload is attested by its environment and handed a fresh, short-lived credential bound to a stable identity. There is no static token to steal, and every running instance gets its own attested credential. This is the same shift from secrets to identity we describe for agents in general in what AI agent identity is.

How SPIFFE and SPIRE issue identity

SPIRE issues an SVID only after two attestation checks pass:

  • Node attestation proves which machine runs the workload — a Kubernetes projected service account token, an AWS instance identity document, or GCP instance metadata.
  • Workload attestation proves which process is calling — selectors such as the Kubernetes service account, namespace, and container image digest.

Only a workload that matches a registered entry on an attested node receives an SVID. The SVID comes in three shapes, and the practical fit for gateway calls today is the JWT-SVID:

SVID type What it is Used for
X.509-SVID An X.509 certificate with the SPIFFE ID in the SAN mTLS between workloads
JWT-SVID A signed JWT used as a bearer token in an Authorization-style header Gateway calls today
WIT-SVID A key-bound JWT (IETF WIMSE profile) requiring proof-of-possession Stronger, emerging

The acme.com portion of the SPIFFE ID is the trust domain. On Kubernetes, SPIRE trusts projected service account tokens and the agent reads its JWT-SVID from the SPIFFE Workload API at runtime — so no secret is ever written to a config file or baked into an image.

Attested workload identity, resolved to a governed agent at the gateway.

How the gateway resolves an SVID

To TrueFoundry, a JWT-SVID is just another identity-provider token. The agent is registered as identity-provider-backed — the same registration step every externally-issued agent identity uses:

Registering an agent as identity-provider-backed, so an external issuer (here, SPIRE) proves who it is. Source: TrueFoundry docs.

Each request then carries two tokens, exactly as in standard agent identity and on-behalf-of delegation:

Authorization: Bearer <USER_TOKEN>
x-tfy-agent-authorization: Bearer <JWT-SVID>

The gateway validates the SVID against SPIRE's JWKS, resolves the SPIFFE ID to the registered agent, checks whether that agent may reach the target and may act for the user, and forwards the call with the target's own outbound auth. The user's identity travels alongside the agent's the whole way.

Wiring it up

Three steps connect SPIRE to the gateway:

  1. Register SPIRE as an identity provider. Expose SPIRE's OIDC-compliant discovery endpoint and add it under Platform → Identity Providers with the issuer, audiences, and JWKS URI.
  2. Register the agent as identity-provider-backed, mapping the SPIFFE ID claim to the agent.
  3. Present the JWT-SVID to the gateway on each call, as above. The SPIRE agent rotates it before expiry, so the agent never faces credential expiry mid-task.

Access itself is still governed by collaborator grants — who may invoke the agent, whom it may act for, and which MCP servers it may reach — the model covered in fine-grained authorization and what MCP authorization is.

Where teams get this wrong

Treating the SVID as a replacement for authorization. Attestation proves who the workload is; it does not decide what it may do. You still need collaborator grants and policy at the gateway — identity and authorization are separate layers.

Over-broad attestation selectors. If workload attestation keys only on a namespace, every pod in that namespace can obtain the same SVID. Pin selectors to the service account and image digest so the identity means one workload.

Forgetting the user. An SVID identifies the agent, not the person it acts for. The user's token must still travel in Authorization so the downstream system can answer whose data was touched.

Assuming mTLS alone is governance. X.509-SVIDs secure the transport, but a governed call still needs the gateway to resolve identity, authorize the pair, and audit it.

Want agent identity with no secret to leak?

A worked example

A platform team runs agents on Kubernetes and refuses to ship another long-lived token. They stand up SPIRE, register an entry for research-agent keyed on its service account and image digest, and expose SPIRE's OIDC endpoint. In TrueFoundry they add SPIRE as an identity provider and register research-agent as identity-provider-backed, mapping its SPIFFE ID. At runtime each pod pulls a JWT-SVID from the Workload API and sends it with the user's token to the gateway, which validates it against SPIRE's JWKS, resolves it to the registered agent, and authorizes the call. When a workload is decommissioned, they deregister its entry and the SVIDs simply stop at the next rotation — no secret to revoke, no config to clean up.

Gotchas worth knowing

  • JWT-SVIDs are the practical fit today; WIT-SVIDs add proof-of-possession but require client changes. Start with JWT-SVID for gateway calls.
  • First-class SPIFFE binding on the agent spec is marked coming soon in the docs — today you bind via the identity-provider mapping. Check the current docs before a wide rollout.
  • Per-hop token exchange is rolling out; for multi-agent chains, confirm how delegation is stitched in your version.
  • The trust domain is a security boundary. Keep one trust domain per environment and do not share SPIRE signing material across them.
  • Node attestation depends on the platform. On managed Kubernetes, projected service account tokens are the usual evidence; confirm your cluster exposes them.

SPIFFE versus the alternatives

To see why attested identity matters, put it next to the two things teams reach for first. The difference is not cosmetic — it changes who can impersonate the agent and how fast you can shut a compromised one down.

Approach Where identity comes from Lifetime Revocation Who can impersonate it
Static API key A secret you mint and distribute Long-lived until rotated Rotate everywhere it was copied Anyone who reads the secret
Shared service account One directory principal for many agents Long-lived Disable the account — breaks every agent using it Anyone with the account's secret
SPIFFE/SPIRE SVID Runtime attestation of the workload Short-lived, auto-rotated Deregister the entry — per instance Only a workload that passes attestation

The static key and the shared account share one flaw: the credential is a bearer secret, so possession is identity. SPIFFE breaks that equation — possession of an SVID is worthless without passing attestation on an attested node, and the SVID expires on its own within minutes. There is nothing durable to steal.

The portable-trust sandwich

The docs describe the end-to-end model as a stack of four layers, each solving one problem, which is worth making explicit because it shows where SPIFFE stops and the gateway starts:

  1. Workload identity (the SVID) from runtime attestation — SPIRE proves the node and the process, then issues a short-lived credential bound to a stable SPIFFE ID.
  2. Resolution to the registered agent — the gateway validates the SVID against SPIRE's JWKS and maps the SPIFFE ID to the agent in its registry.
  3. Per-hop delegation via token exchange — the user travels as sub, the acting agent as act, and scope is narrowed to the next callee.
  4. A target-native credential where needed — an on-behalf-of token, or a gateway-held OAuth credential, so the downstream tool gets a format it already trusts.

It is called portable because the stable agent identity is derived from attestation, not from a cloud-specific secret — so the same identity holds whether the workload runs on one cluster today and another tomorrow. Layer one is pure SPIFFE/SPIRE; layers two to four are where the TrueFoundry Gateway does its work.

On Kubernetes, concretely

Kubernetes is the common case, and it is where the "no secret on disk" claim becomes real. SPIRE trusts the cluster's projected service account tokens as node-and-workload evidence, and the agent reads its JWT-SVID from the SPIFFE Workload API — a local socket — at runtime. Nothing is written to a file, baked into an image, or passed as an environment variable, so there is no artifact for a leaked image or a prompt-injected cat to expose. When the SVID nears expiry, the SPIRE agent fetches a fresh one transparently, so a long-running agent never stalls on an expired credential. Pin workload attestation selectors to the service account and the container image digest, not just the namespace, so one SVID means exactly one workload rather than every pod in the namespace.

Related reading

Conclusion

A stored secret is a liability that grows with every agent and every instance. SPIFFE and SPIRE replace it with identity that comes from attestation — short-lived, auto-rotated, and impossible to copy out of a config file. The TrueFoundry Gateway takes the SVID the agent earns at runtime, resolves it to a governed identity, and authorizes the call for the user it acts for.

The result is the thing security teams actually want from autonomous agents: an identity you can attest, authorize, audit, and revoke — without a single long-lived credential in sight.

Give every agent an attested identity and a clean audit trail.

Try now.

One gateway for all your models, MCP servers, and agents.
No credit card needed.

Start free
Table of Contents

One Gateway for Every LLM, Agent and MCP Server

Book a 30-min with our AI expert

Book a Demo

The fastest way to build, govern and scale your AI

Book Demo
Summarize with
ChatGPT logo by OpenAI
Perplexity AI logo
Blurry red snowflake on white background, symmetrical frosty design with soft edges and abstract shape.

Discover More

No items found.
October 27, 2026
|
5 min read

Governing Microsoft Foundry Agents: Identity-First Control for Hosted Agents

No items found.
October 27, 2026
|
5 min read

Claude vs ChatGPT for Enterprise: Security, Cost, and Control

No items found.
October 27, 2026
|
5 min read

Governing Microsoft Copilot Studio Agents: Identity, Access, and Audit at the Gateway

No items found.
October 27, 2026
|
5 min read

Securing AI Agents with SPIFFE and SPIRE: Workload Identity for Autonomous Agents

No items found.
No items found.

Recent Blogs

Black left pointing arrow symbol on white background, directional indicator.
Black left pointing arrow symbol on white background, directional indicator.

Frequently asked questions

What is SPIFFE/SPIRE for AI agents?

SPIFFE is an open standard for workload identity and SPIRE is its reference implementation. For AI agents, they issue a short-lived, attested credential (an SVID) based on where the agent runs, so the agent never holds a long-lived secret. TrueFoundry resolves that SVID to a registered agent identity and governs the call.

What is an SVID?

An SVID is a SPIFFE Verifiable Identity Document. It carries a SPIFFE ID such as spiffe://acme.com/ns/agents/sa/research-agent and comes as an X.509 certificate (for mTLS), a JWT (a bearer token for gateway calls), or a key-bound WIT-SVID. SPIRE issues it only to an attested workload and rotates it automatically.

How does the gateway use the SVID?

The agent sends its JWT-SVID in the x-tfy-agent-authorization header and the user's token in Authorization. The gateway validates the SVID against SPIRE's JWKS, resolves the SPIFFE ID to the registered agent, checks the agent's grants and delegation, and forwards the call with the target's outbound auth.

How do I revoke an agent's identity?

Deregister the workload entry in SPIRE. Its instances stop receiving SVIDs at the next rotation, which acts as a per-instance kill switch. There is no long-lived credential to chase down.

Does SPIFFE replace authorization?

No. SPIFFE proves identity; it does not decide what the agent may do. You still need collaborator grants and policy at the gateway to authorize which targets an agent may reach and which users it may act for.

Can I run this in my own cloud?

Yes. TrueFoundry’s data plane runs in your VPC or on-prem, so DSPy’s prompts and optimization data stay in your environment.

Take a quick product tour
Start Product Tour
Product Tour