Why per-process identity matters
Standard Kubernetes identity
One identity per pod.No visibility into which sub-agent made which call. Cost attribution is impossible. Access control is all-or-nothing at the pod level.
Hexr per-process identity
One identity per agent process.Per-role access control, cost tracking, and audit logs — all from a single pod.
SPIFFE ID format
Every agent process receives a SPIFFE ID following this pattern:| Component | Description | Example |
|---|---|---|
trust-domain | Your SPIRE trust domain | hexr.cloud |
tenant | Your tenant namespace | acme-corp |
agent-name | From @hexr_agent(name=...) | content-crew |
process-role | Sub-agent role within the agent | researcher |
How it works
The identity lifecycle runs in four stages — most of which happen automatically.Stage 1: Build-time discovery
hexr build performs AST analysis on your Python source to discover every agent role before any code runs:
Stage 2: Pod startup and registration
When the pod starts, the Auto-Registrar creates a SPIRE entry for each role:Kubernetes fires pod event
The Kubernetes API notifies the Auto-Registrar that a pod with
hexr.io/managed=true was created.Auto-Registrar reads contexts
Reads the process context ConfigMaps mounted in the pod. Each file describes one agent role (researcher, writer, editor).
SPIRE entries created per role
For each process role, the Auto-Registrar calls
SPIRE.CreateEntry:| Role | SPIFFE ID | Selectors |
|---|---|---|
| researcher | spiffe://hexr.cloud/agent/acme-corp/content-crew/researcher | k8s:pod-uid:{uid}, hexr:process-role:researcher |
| writer | spiffe://hexr.cloud/agent/acme-corp/content-crew/writer | k8s:pod-uid:{uid}, hexr:process-role:writer |
| editor | spiffe://hexr.cloud/agent/acme-corp/content-crew/editor | k8s:pod-uid:{uid}, hexr:process-role:editor |
Stage 3: Runtime marker files
When each agent process starts, the SDK automatically writes a marker file that identifies the process:/proc, and writes the enriched context:
Stage 4: SVID issuance
The agent process fetches its SVID from the SPIRE Workload API. The SDK handles this automatically:- mTLS — Envoy loads it via SDS for all encrypted communication
- JWT exchange — the Credential Injector verifies it before issuing cloud credentials
- Audit — every action is attributed to this specific process identity
What per-process identity gives you
Scoped cloud access per role
You can restrict each role to exactly the cloud services it needs:Per-agent cost attribution
Withhexr_llm(), every LLM call is tagged with the calling process’s SPIFFE ID — giving you accurate cost breakdowns per role:
Authenticated agent-to-agent communication
When agents communicate across pods, mTLS verifies both parties with their SPIFFE IDs — no API keys or tokens required:Security properties
| Property | Benefit |
|---|---|
| No shared credentials | Each process has its own short-lived X.509 certificate |
| Auto-rotation | SVIDs rotate every hour automatically — no manual rotation |
| Instant revocation | Delete the SPIRE entry and the identity is immediately invalid |
| Precise audit trail | Every operation is traced to a specific process, not just a pod |
| Lateral movement prevention | Process A cannot impersonate Process B — they have different SPIFFE IDs |
| Blast radius containment | A compromised process can only access its own scoped resources |