Skip to main content

Why Per-Process?

Most Kubernetes identity systems assign one identity per pod (or at best, per container). Hexr goes further: every agent process gets its own SPIFFE ID. This matters because:
  • Multi-agent frameworks (CrewAI, LangChain) run multiple agents in one process tree
  • Sub-agents (researcher, writer, editor) need distinct identities for access control
  • Audit trails need to know which specific agent made which API call
  • Cost attribution needs per-agent LLM token tracking

Standard K8s Identity

One identity per pod/container.
No visibility into which sub-agent made which call. Cost attribution impossible.

Hexr Identity (Per-Process)

One identity per agent process.
Per-role access control, cost tracking, and audit logs.

SPIFFE ID Format

Every agent process receives a SPIFFE ID following this pattern:
Examples:

How It Works

The identity lifecycle has four stages:

Stage 1: Build-Time Discovery

hexr build performs AST analysis on your Python source code to discover all agents:
Each process context file contains the template for SPIRE registration:

Stage 2: Pod Startup & Registration

When the pod starts, the Auto-Registrar creates SPIRE entries:

Kubernetes fires pod event

Kubernetes API notifies the Auto-Registrar that a pod with hexr.io/managed=true was created.

Auto-Registrar reads contexts

Reads process context ConfigMaps mounted in the pod. Each file describes one agent role (researcher, writer, editor, etc.).

SPIRE entries created

For each process role, the Auto-Registrar calls SPIRE.CreateEntry:

Stage 3: Runtime Marker Files

When the agent process starts, the SDK writes a marker file:
The PID mapper reads this marker, maps the container PID to the host PID using /proc, and writes the enriched context:

Stage 4: SVID Issuance

The agent process fetches its SVID from the SPIRE Workload API:
This SVID is used for:
  • mTLS — Envoy loads it via SDS for encrypted communication
  • JWT exchange — Credential Injector verifies it for cloud credential access
  • Audit — Every action is attributed to this specific process identity

Identity in Practice

Cloud Credential Scoping

Each process identity can be scoped to specific cloud resources:

Multi-Agent Cost Attribution

With hexr_llm(), every LLM call is tagged with the calling process’s SPIFFE ID:

A2A Communication Identity

When agents communicate across pods, mTLS ensures both parties have verified identities:

Security Implications