Building an Enterprise Agent Harness on AX, Agent Substrate and Kubernetes
November 21, 2026

Building an Enterprise Agent Harness on AX, Agent Substrate and Kubernetes

Building an Enterprise Agent Harness on AX, Agent Substrate and Kubernetes

1. The problem

"Agent harness" is the term everyone is using right now, and it means many things to many people. What pushed me to pin it down was Google's announcement of Agent Compute Engine (ACE) in October 2026, a managed agent runtime that is not available yet. The same announcement pointed to Agent Substrate, a separate open-source runtime with the same design, which you can run on your own Kubernetes clusters today.

I have been putting AI agents into production from the tenant side: hosting them on GKE and Cloud Run, and using model services, LLM gateways and tools that someone else ran. The same four problems kept coming up: deploying agents, managing long-running agents (process agents that run a workflow with asynchronous steps), security and guardrails, and access to models. After repeated conversations about what an agent harness actually is, I wanted to understand it from the other side, moving from building agents on a platform to building the platform itself.

The point of this post is not AX or Substrate. Every component here can be replaced with something else. What matters is what each one does, and how they come together to cover what a mature enterprise agent harness has to handle. Google's open-source AX and Agent Substrate are a good, open way to fill those roles today, so I use them to make it concrete. My advice to an architect starting out runs through all of it: be clear about what the platform is responsible for, then build it as building blocks, in phases. You won't build everything at once, and both the needs and the technology will change, so build what you need first, but make it extensible.

The YAML in this post is written against the upstream docs for AX v0.4.0-rc.1 and Agent Substrate v1.0.1.

2. Why an enterprise needs a harness

The shortest useful definition, and one you will see quoted a lot, is:

Agent = Model + Harness

The model reasons. Everything else is harness: the loop that calls the model, the tools it can use, the context it sees, the retries, the limits. At its simplest, a harness is a few hundred lines of Python around one model. At the other end, it applies across the whole application layer as a cross-cutting concern, the way identity or logging does. Either way, the harness is a control boundary. A horse harness adds no strength to the horse; it directs the strength it already has and stops it bolting. An agent harness does the same for a model: it decides where the model's capability goes and what it is allowed to reach.

A powerful model on its own is not a capability. What turns it into one is the harness around it: the tools, workflows, controls, data and environments that shape how it is used. Three considerations follow, and they apply to any enterprise agent:

  • What a model can see is a risk decision, not a configuration detail.
  • Guardrails in the model are only one part of the controls. The rest sits around the model: access, network isolation, environment separation and monitoring.
  • Avoid early dependence on a single technology or supplier. That argues for a modular harness where each part can be swapped.

Agents add two pressures that a single model call does not. They are neither microservices nor batch jobs: they are stateful, bursty, and spend most of their lives waiting, seconds of compute then minutes on a model, a tool, a person or the next asynchronous step. One pod per agent pays for that waiting and loses state on a redeploy. And they act: they call internal systems with credentials and spend money on tokens, so someone has to be able to say which agent did what, for whom, and at what cost.

So when I say enterprise agent harness, I mean that control boundary at fleet scope: thousands of agents from different teams, running untrusted code, calling internal systems, spending money, and needing to be explained to an auditor afterwards. I add one requirement of my own: it has to scale, and it has to be open for extension, not closed. Every enterprise already has an identity provider, an LLM gateway or the beginnings of one, an observability stack, and policy tooling. A harness that cannot plug into those becomes another silo.

3. The solution: a harness built from roles

An enterprise agent harness is a set of roles, not a product. A control plane decides what runs. A runtime runs it safely and cheaply. Kubernetes provides the machines. Around them, we add an LLM gateway as the only route to models, a telemetry and trajectory store that records what agents did, and a catalogue and policy layer that decides what is allowed to run at all.

Google's launch article for Agent Executor splits the control plane and runtime this way, and the split still holds. AX sits logically above Substrate but is deployed beside it, each with its own PostgreSQL. AX calls the Substrate API to create, suspend, resume and delete agents. Requests to agents never pass through AX: they go through Substrate's router, which wakes a suspended agent if it needs to.

Every role is required; no single product is. Substrate also works without AX, through kubectl ate, other projects such as kagent, or your own control plane, and the gateway, telemetry and policy pieces are deliberately your own choices. I use AX and Substrate here because they fill the control-plane and runtime roles well today.

Enterprise agent harness component stack

4. Components

Each role, what it does, and the frameworks that can fill it:

The roles in an enterprise agent harness

5. Implementation

Five steps, one for each part of the harness. Each step covers what we get from AX and Substrate today and what we add.

Step 1: Deploy agents through one control plane

Without a shared runtime, every team ships agents differently: duplicated effort and no standard path to production. Agents are slow to start useful work, because repositories are re-cloned and dependencies reinstalled on every run. And nobody can say who runs which agents with which models and tools, which is how audits fail and shadow agents appear.

What we get. AX gives every team the same API and CLI. Builders declare three things: a Task (what runs), a Workspace (what it needs on disk and which tools it can call), and a Model (which provider and model). A fourth kind, Gateway, declares where the task can send traffic. Tasks are grouped into atespaces, which map naturally onto teams.

# Written against the AX v0.4.0-rc.1 docs.
apiVersion: ax.io/v1alpha1
kind: Workspace
metadata:
  name: payments-repo
  atespace: team-payments
spec:
  setup:
    git:
      - name: payments-service
        repo: "https://github.com/example-org/payments-service.git"
        ref: "main"
---
apiVersion: ax.io/v1alpha1
kind: Task
metadata:
  name: triage-flaky-tests
  atespace: team-payments
  labels:
    team: payments
    cost-centre: cc-4410
spec:
  profile:
    image: "registry.example.com/agents/triage@sha256:..."   # Substrate requires a digest
    resources:
      limits: { cpu: "1", memory: "1Gi" }
  commands: ["python", "/opt/agent/run.py"]
  workspace:
    name: payments-repo
  gateway:
    name: payments-egress
  goal:
    text: "Find the cause of the flaky integration tests and propose a fix."

New tasks start suspended. ax resume task triage-flaky-tests -a team-payments starts one, ax suspend checkpoints it, and ax get tasks lists them. Workspaces also support pre-warmed snapshots, so a task that matches its workspace's profile can start from a prepared filesystem instead of cloning and installing again.

What we add. Substrate checks every API call against OpenFGA, an open-source authorisation engine built into its API server and always on, with owner, editor and viewer roles per atespace. That is the access-control base. On top of it, keep an approved catalogue of Models, Workspaces and Gateways in Git. Agent builders submit task specs as pull requests, and Platform Ops apply them once CI policy passes. The policy has to run in CI, or in a platform API you put in front of ax-server, because AX stores its resources itself, not in Kubernetes, so a Kubernetes admission controller won't see them.

That platform API matters for another reason. AX's SECURITY.md is direct about it: the ax-server API currently has no authentication or authorization, and atespaces are not a tenant isolation boundary. Keep ax-server private, behind your own platform API or an authenticating proxy.

Result: one way to run agents across teams, with a reviewed path from builder to production.

Step 2: Run long-running agents on a runtime that suspends them

With a pod per agent, an idle agent still holds a full container. Its state lives in memory, so a redeploy or eviction loses work that may have been running for hours.

What we get. When an agent goes idle, Substrate snapshots its full state and gives the machine back to the pool. When a request arrives for it, the router wakes it on any available worker. Google's figure for the density gain is up to 10x; that is Google's claim, not a measurement. The same mechanism makes long-running work survive a node going away, because the state is in the snapshot, not in a pod's memory.

The most important thing the deployment view shows is that agents are not pods. Many agents share a few pre-warmed worker pods, each agent in its own sandbox. That one design choice is where most of the density and cost argument comes from.

AX and Agent Substrate on Kubernetes

What it saves. As a worked example with labelled assumptions: 1,000 agents, each needing 1 vCPU while active, active about 10% of the time. One pod per agent reserves about 1,000 vCPU around the clock. Suspended actors need about 100 vCPU of active demand on average, or roughly 150 vCPU with 50% headroom for bursts. That is the shape of the saving, not a measured result. It leaves out snapshot storage, resume latency and the cost of the control planes.

Agent harness cost model

What you design for. A suspend and resume can land in the middle of a tool call, so make tools safe to retry.

Result: you pay for agents while they work, not while they wait, and a multi-hour task survives infrastructure changes.

Step 3: Contain every agent and block breaches

Agents run untrusted code, often with open network access and secrets in reach, so one agent can leak data or damage systems. They call APIs with shared keys, so a downstream system sees a service account, not an agent. And they can be hijacked by instructions hidden in what they read: prompt injection arrives in user input, but also inside web pages, files and tool results the agent reads mid-task.

What we get: containment. Agent Substrate runs each agent in its own sandbox, not just a container: gVisor on GKE, or a microVM where the nodes support it. Network access is denied unless explicitly allowed, and since v0.4.0-rc.1 AX lets you declare that allowlist per task with a Gateway. A task with no gateway has no external network access at all.

apiVersion: ax.io/v1alpha1
kind: Gateway
metadata:
  name: payments-egress
  atespace: team-payments
spec:
  egress:
    - https:
        hostnames: ["github.com", "api.github.com"]
    - http:
        hostnames: ["llm-gateway.llm-gateway.svc.cluster.local"]
        ports: { numbers: [4000] }

A misbehaving agent can be quarantined: cut off from the network and stopped. AX applies the task's CPU and memory limits to the sandbox.

Every Substrate agent also gets its own short-lived, verifiable identity (a SPIFFE certificate, plus signed JWTs on request). The egress gateway can present it on outbound calls, so a downstream API can tell exactly which agent is calling.

Secrets work the same way. The agent sends a placeholder; the egress gateway swaps in the real credential outside the sandbox. The agent never holds the key, so it can't leak it, log it, or capture it in a snapshot.

# Inside a Gateway's spec.egress
- https:
    hostnames: ["api.github.com"]
    effects:
      replaceHeaders:
        - header: Authorization
          prefix: "Bearer "
          credentialUri: "ate-secret://k8s.io/default/agent-creds/github-token/token"

Together, these mean an injected instruction can only use what the task was given: the hosts in its Gateway, and no secrets.

What we add. My rule for guardrails is simple: a request that breaches a guardrail is blocked. It is not queued for a person to approve, and a guardrail check that cannot run counts as a breach. The agent gets an error and the attempt is logged against its identity. People approve what an agent may do before it runs, through review of its task spec; at runtime, guardrails and policy block anything outside that, with no one in the loop.

Containment is the first layer. Detection alone is not enough, because prompt-injection detection is probabilistic and the hardest cases arrive indirectly, inside content the agent reads. The second layer is screening every model call in the LLM gateway, in Step 4.

Two gaps remain on the security side:

  • Delegated user identity. Substrate's identity is per agent, not per user. If an agent has to act on behalf of a specific person, that is an OAuth token exchange you build into the harness or gateway.
  • Separation between teams. Substrate's security doc lists network policies and quotas between atespaces as in progress. Until they land, use dedicated worker pools and Kubernetes NetworkPolicy per team.

Result: an agent that goes wrong can only reach what you listed, on a machine boundary stronger than a container, holding no secrets, and identifiable on every call it makes.

Step 4: Put an LLM gateway in front of every model

Every team stores its own keys and model IDs, so rotating a key during an incident is a hunt. Spend is unpredictable and unattributed: one looping agent can burn a month's budget overnight, costs can't be charged back, and every task runs on the most expensive model. For most agent fleets, tokens cost more than compute.

What we get. AX's Model resource gives you central configuration: the provider, model ID and secret reference live in one place, so rotating a key or pinning a model version is one ax apply. That is where upstream stops. Task token and timeout budgets are on AX's roadmap; model routing is not on either project's roadmap. An AX Model binds one provider and one model, and it has no endpoint field, so you can't point it at a gateway.

What we add: an LLM gateway. Put an LLM gateway inside the cluster and make it the only model endpoint agents can reach. Allow only its hostname in each task's Gateway (as in Step 3), and set the agent's base URL to it in spec.env. Because agents can reach no model except through it, the gateway sees every call, and it becomes the one place that owns four jobs:

  • Budgets and attribution. Per-team budgets that act as a circuit breaker, token metrics, and cost attribution.
  • Routing. Cheaper models where they're good enough, fallback when a provider fails.
  • Guardrails. It sees every model call, including the ones that carry tool results back to the model, which is where indirect injection enters. That makes it the single place to check for injection and jailbreaks, mask personal data going in, check responses for data leaking out, and allow only approved models.
  • Loop detection. Neither of the options below documents detection of an agent stuck repeating the same tool call, so expect to build that check yourself, on the gateway's token metrics or in the harness.

Two open-source options cover most of this today. LiteLLM's proxy has team budgets, provider budget caps and router fallbacks, and ships guardrail hooks that run before and after each call, including Presidio for personal-data masking and integrations with hosted detectors such as Lakera. Its built-in prompt-injection check is off by default, and pattern matching only catches phrasings someone anticipated, so plug in a classifier-based detector for injection. If your agents reach MCP tools through LiteLLM, it can also allowlist servers and individual tools per team and key; tools an agent calls directly are governed by its Gateway instead. Envoy AI Gateway has token-based quotas and rate limits keyed by user and model, and lists provider fallback.

# Illustrative LiteLLM proxy config; check field names against your LiteLLM version.
guardrails:
  - guardrail_name: block-prompt-injection
    litellm_params:
      guardrail: lakera_v2        # or another classifier-based detector
      mode: pre_call              # check before the model sees the request
      default_on: true            # applies to every request, not opt-in
  - guardrail_name: mask-personal-data
    litellm_params:
      guardrail: presidio
      mode: pre_call
      default_on: true
  - guardrail_name: check-responses
    litellm_params:
      guardrail: presidio
      mode: post_call             # check what comes back before the agent sees it
      default_on: true

On GKE, Google's Model Armor can also screen prompts and responses for injection, jailbreaks and sensitive data. Its documentation notes that it does not cover the intermediate steps between the first prompt and the final response, which is most of what an agent does, so check that before relying on it for agents.

Many enterprises already run an LLM gateway. This is where the harness plugs into it rather than replacing it.

Result: one place to rotate keys, cap spend, route to the right model, and block model calls that breach a guardrail. With containment from Step 3, a hijacked agent hits two walls, and neither depends on a person being awake.

Step 5: Record what agents do

A trajectory is the step-by-step record of an agent's run: its prompts, the model's responses, and every tool call with its result. The trajectory store is where you keep those records so you can search and replay them.

Across all four problems, one question decides whether compliance signs off and whether chargeback works: what did this agent do, for whom, and why? Of everything we add, this is the piece I would build first.

What we get. Substrate gives you a good foundation: lifecycle audit events tied to agent identity, exported over OTLP, logs labelled across suspend and resume, and platform metrics. AX v0.4.0-rc.1 adds its own OpenTelemetry for API and Substrate calls. Neither records what the agent actually did: the prompts, the model responses, the tool calls. That record is on AX's roadmap as "Telemetry and Trajectory Collection", not shipped.

What we add. Instrument the agent yourself and send the trajectory to the same backend as Substrate's events. The key is the correlation fields: AX exposes the agent's Substrate UID on the task, and Substrate records it as ate.actor.uid, so you can join a tool call to the lifecycle event that suspended it.

# Illustrative trajectory instrumentation; attribute names follow the
# OpenTelemetry GenAI semantic conventions where they exist.
import os
from opentelemetry import trace

tracer = trace.get_tracer("agent.trajectory")

# Your own variables, set in the Task's spec.env (not set by AX).
TASK = os.environ.get("TASK_NAME", "unknown")
TEAM = os.environ.get("TEAM", "unknown")

def traced_tool_call(tool_name: str, args: dict, call):
    with tracer.start_as_current_span(f"execute_tool {tool_name}") as span:
        span.set_attribute("gen_ai.tool.name", tool_name)
        span.set_attribute("ax.task", TASK)
        span.set_attribute("team", TEAM)
        result = call(**args)
        span.set_attribute("tool.result.size", len(str(result)))
        return result

Carry the same team and cost-centre labels from the Task into the trajectory spans and the gateway's token metrics, and chargeback becomes a query. The trajectory is also how you debug: reproducing an agent's run means replaying it, which is another reason to record it from day one.

Then build the fleet view: tasks by team and state, recent trajectories, crashes, and suspend/resume over time. Neither project ships one today. AX Studio is a web app for a local cluster only, and the closest thing to a picture of agents sharing pods is the small web UI in Substrate's Claude Code multiplex demo. For a real fleet, build the view on your observability stack from the telemetry both projects export, and expect an upstream UI to replace it eventually.

Result: an answer to "what did this agent do, for whom, and why?", and chargeback from the same data.

Trade-offs and gotchas

Building versus a managed service. ACE is announced but not available yet, so for now the choice is between building your own harness and using one of the managed agent services that exist today, including Google's managed Gemini agent offerings. Those are easier to set up, someone else runs them, and they may fit your existing enterprise better. The cost is control. I would build, for control over models, residency and provider; integration with the platforms you already run; on-premises workloads that can't go to a managed cloud service; visibility and spend control you own; and the understanding you only get from building it. Count the people when you compare: running AX, Substrate, PostgreSQL, an LLM gateway and an observability pipeline yourself is real operations work. Building now also keeps a later move open, because ACE and Substrate share a design.

Every component is replaceable. The projects in this stack are young and moving fast, and the open-source and managed options around them will keep changing. Design for that: keep your agents harness-agnostic, and keep your enterprise layer (visibility, gateway, policy) outside any single component. Then a change in one part means swapping that part, not rebuilding the platform.

Smaller things that bite. Pin versions while the APIs are still in alpha (AX is v1alpha1), and keep spec.debug: true out of production: it allows arbitrary command execution in the sandbox.

What we build is a bridge. Trajectories, the fleet view, budgets and routing, governance, team separation, delegated identity and API authentication are all gaps upstream today. Design each piece so it can be retired when the roadmap lands.

6. Summary

  • An enterprise agent harness is a set of roles, not a product: a control plane, a runtime, an LLM gateway, a trajectory store and a policy layer, each doing one job and each replaceable.
  • AX and Agent Substrate fill the control plane and runtime today: one way to run agents, a sandbox per agent, per-agent identity, secrets kept out of agents, and cheap suspend and resume.
  • We add the rest: the LLM gateway, trajectory recording, and the catalogue and policy, designed to be retired as upstream catches up.
  • People approve before runtime; guardrails block at runtime. Review the task spec, then let policy and guardrails stop anything outside it.

To start, stand up Substrate and AX on one non-production cluster with ax-server kept private, put an LLM gateway in front of every model call, instrument agents for trajectories, and move one real workload across to measure density, resume time and token spend.

Resources & References

Versions referenced in this post: AX v0.4.0-rc.1 and Agent Substrate v1.0.1 (November 2026).