Pod Structure
When you runhexr deploy, your agent becomes a Kubernetes Pod with three containers, or four when the agent sets a2a=True. There is no init container: the SDK is baked into the image at hexr build time.
- Containers
- Pod Manifest
Image build: SDK baked in
The SDK is installed into the image at
hexr build time, from the wheel
in .hexr/. Version match with the build is guaranteed because it is the
same wheel, not a re-resolution at pod start. No init container, no
shared volume.agent · :8080
Your Python code. Runs your
@hexr_agent-decorated function. Listens on :8080
for inbound A2A bridge calls. Connects to SPIRE Workload API for SVID.envoy-sidecar · :15001 / :15006
mTLS proxy. Terminates inbound TLS on
:15006, initiates outbound mTLS on :15001.
Loads X.509-SVIDs via SPIRE SDS. Routes /.well-known/* and /a2a traffic.a2a-sidecar · :8090
Agent communication. JSON-RPC 2.0 dispatch (
message/send, message/stream,
tasks/get, tasks/cancel). Task state persisted in Valkey with SETNX idempotency.pid-mapper · hostPID: true
Identity mapper. Reads
/proc with host PID namespace access. Maps container PIDs
to host PIDs. Writes enriched process context JSON for SPIRE workload attestation.Container Details
1. Agent Container
Your Python code with the Hexr SDK. This is the only container you write code for.2. Envoy Sidecar
Transparent mTLS proxy. Handles all network traffic in and out of the pod.Envoy uses
syscall.Exec PID inheritance — the envoy process “becomes” the proxy
while maintaining the correct PID for SPIRE attestation. This is a novel technique
described in the Hexr patent application.3. A2A Sidecar
Implements the Agent-to-Agent protocol for inter-agent communication.4. PID Mapper
Maps container PIDs to host PIDs for per-process SPIFFE identity.Agent writes marker
When the agent process starts, the SDK writes a marker file to
/tmp/hexr-context/:PID Mapper translates
The PID Mapper reads
/proc to map the container PID (42) to the host PID (83721).
Writes the enriched JSON to /host-hexr-context/.File Collector forwards
The File Collector DaemonSet reads from the hostPath volume and forwards the context
to the Auto-Registrar via gRPC.
Auto-Registrar creates entry
The Auto-Registrar calls SPIRE Server’s
CreateEntry API with per-process selectors
(k8s:pod-uid, hexr:process-role).SVID issued
The agent process fetches its X.509-SVID from the SPIRE Workload API, receiving a
certificate with its per-process SPIFFE ID.
Shared Volumes
Three volumes connect the containers:How the SDK gets into the pod
It is already there.hexr build downloads the hexr-sdk wheel into .hexr/
and the generated Dockerfile installs it into the image:
site-packages volume.
Baking the SDK in means the version in the pod is the exact wheel hexr build
resolved, so it cannot drift between build and run, and a pod cannot fail to
start because a package index is unreachable. That failure would otherwise land
at scale-up time rather than at build time.
Network Flow
How ahexr_tool("aws_s3") call flows through the pod:
Agent calls hexr_tool('aws_s3')
SDK checks L1 in-memory cache, then L2 Valkey cache. Both miss.
Agent → Envoy (localhost)
Agent sends
POST /exchange to the Envoy sidecar over localhost (plaintext, same pod).Envoy → Credential Injector (mTLS)
Envoy initiates mutual TLS to the Credential Injector in
hexr-system,
attaching the agent’s X.509-SVID as the client certificate.Credential Injector verifies + checks OPA
CI verifies the JWT-SVID via SPIRE Workload API, then queries OPA:
“Can this SPIFFE ID access
aws_s3?”STS exchange
CI calls
AssumeRoleWithWebIdentity on AWS STS, presenting the JWT-SVID
as the web identity token. AWS trusts Hexr’s OIDC endpoint.Credentials returned + cached
Temporary AWS credentials (15min TTL) flow back through Envoy to the agent.
Stored in L1 + L2 cache. SDK creates an authenticated
boto3 S3 client.