Skip to content

Instantly share code, notes, and snippets.

@rand
Last active October 20, 2026 21:49
Show Gist options
  • Select an option

  • Save rand/dda7008ca175c8a5fbd7c1e7d3df47e1 to your computer and use it in GitHub Desktop.

Select an option

Save rand/dda7008ca175c8a5fbd7c1e7d3df47e1 to your computer and use it in GitHub Desktop.

Agentic Resource Management: A Design Proposal

February 2026

Vision

Infrastructure should be as malleable as code. When the primary consumer of infrastructure is a machine operating at machine speed, the control plane must become a queryable, versioned, composable resource graph: forking is cheap, observation is structural, and the path from experiment to production is explicit, auditable, and governed. The goal is infrastructure that agents can safely explore at the speed they think, not infrastructure that forces them to wait at the speed humans used to.

Executive Summary

This proposal describes a resource management system designed from first principles for agentic development. The core abstraction is a versioned, queryable, reconciled resource graph where fork, overlay, promote, and observe are first-class operations.

The inner loop is delta-based: cheap overlays and copy-on-write branching, governed by optimistic concurrency control. The outer loop compacts into canonical snapshots for compliance and disaster recovery. Every resource carries its own telemetry stream, budget envelope, and security scope, making it structurally difficult to create ungoverned or unobservable infrastructure.

Agents interact with the graph through a two-operation Code Mode interface (search + execute) that keeps token cost fixed regardless of system complexity. This is the same pattern Cloudflare demonstrated for their 2,500-endpoint API: collapse 1.17 million tokens of tool definitions to roughly 1,000 by letting agents write code against a typed schema.

Merge semantics for stateful resources are explicitly opt-in and strategy-bound. Branching is easy. Merging is the dragon. The system is honest about that.


The Problem Statement

Agentic development turns "write code and deploy it" into "run many tight experimental loops that must touch real systems at machine speed." I've watched this transition break classical PaaS and IaC along five axes simultaneously, and the failures aren't incidental. They're structural.

The latency budget collapses. Humans tolerate minutes between intent and feedback. Agents operate on seconds. A 10-minute environment spin-up isn't "slow." It's structurally incompatible with the control loop, forcing context loss and cost spikes. Signadot's analysis is blunt: this mismatch is "fatal" for agent workflows. That tracks with what I've seen firsthand.

Concurrency explodes. "One engineer, one branch" becomes "N agents, N sandboxes, in parallel, possibly against the same service." Infrastructure surfaces that were cold-path become hot-path overnight. 100 agents needing 100 full staging environments is economically cursed.

Reversibility becomes load-bearing. Agents will do dumb things. Good agents will do occasionally catastrophic things. Cheap checkpointing, instant revert, and tamper-evident provenance trails move from nice-to-have to structural requirement. Replit's agent safety story (snapshots plus dev/prod split plus constrained DB access baked into the substrate) is an early signal of what "safety by default" needs to look like.

Telemetry becomes part of the programming model. If an agent can't cheaply get structured runtime feedback (errors, traces, cost signals), it regresses to vibes. I've written about this elsewhere: you need the feedback loop to be automatable, queryable, and keyed to the specific change that caused the signal. Dashboard archaeology doesn't cut it.

Context window cost constrains the control surface. Every infrastructure operation exposed to an agent as a separate tool consumes context tokens. A rich infrastructure API with dozens of typed operations can exhaust a significant fraction of the context window before the agent begins reasoning about its actual task. Cloudflare's Code Mode work demonstrates the scale of this problem: a naive MCP server for their 2,500-endpoint API would consume 1.17 million tokens; their Code Mode approach collapses it to roughly 1,000. The infrastructure control plane must be designed for O(1) token cost, not O(n) in the number of operations.

What follows is a proposal for a resource management system designed for this reality. Not a retrofit of Terraform with an MCP wrapper, but a rethinking of what infrastructure primitives want to be when the primary consumer is a machine.


Design Principles

Before the primitives, the principles that constrain them. These aren't aspirational. They're the load-bearing decisions that shape everything downstream.

Principle 1: Delta-then-converge, not full-state-apply. The write path should be fast, append-only deltas (patches against a typed resource graph). The read path should be a materialized view of current desired state. Periodically, the system compacts into a canonical snapshot. This is exactly like an LSM tree: optimized for write-heavy workloads with eventual read consistency. It's the fundamental departure from Terraform's plan/apply cycle, which is optimized for infrequent, human-paced, full-state reconciliation. Terraform is a compilation target, not a hot path.

Principle 2: Fork and promote are first-class verbs, not emergent behaviors. Branching an environment, overlaying a single service, promoting a change through lanes: these should be as natural as git branch and git merge, not hand-assembled from 47 YAML files and a prayer.

Principle 3: Every resource is born observable. Telemetry is not something you attach after the fact. Every sandbox, overlay, branch, and promotion carries a telemetry stream from creation. Structured, queryable, keyed by change delta. If you can't observe it, it shouldn't exist.

Principle 4: Security is structural, not aspirational. Scope attenuation, budget envelopes, TTLs, and egress controls are properties of the resource graph itself, not policies bolted on after deployment. The system should make it harder to create ungoverned infrastructure than governed infrastructure. I've written extensively about this in the context of agentic credential architecture. The same principles apply here.

Principle 5: Compositional over monolithic. Small, well-typed primitives that compose cleanly beat large opinionated stacks that work until they don't. But composition must happen within a coherent type system, not via stringly-typed YAML references.

Principle 6: Substrate-agnostic, substrate-aware. The logical resource graph should be independent of where things run (edge, ephemeral microVM, persistent container, GPU node, multi-cloud), but the system must be aware of substrate properties (latency, cost, durability, isolation guarantees) and make them queryable. Abstract over substrates, but don't pretend they're equivalent.

Principle 7: Honest about hard problems. Merge semantics for stateful resources are intractable in the general case. Suspend/resume doesn't work for all workloads. Cost prediction for non-deterministic workloads is approximate. The system's type system and API should make these limitations visible, not hide them behind optimistic abstractions that fail at runtime. If something is hard, say so in the types.

Principle 8: O(1) agent interface cost. The token cost of interacting with the infrastructure control plane must be constant regardless of the number of primitives, resource types, substrates, or operations. Agents discover capabilities progressively through schema search, not by loading the full type system into context. Adding new resource types or operations never increases context cost. This is the same progressive disclosure principle I use everywhere: don't front-load what can be discovered on demand.


Core Primitives

The system is built on eight composable primitives. Each is a typed node in the resource graph with well-defined lifecycle, security scope, and telemetry.

1. Sandbox

A Sandbox is an isolated execution boundary: the atom of compute in this system. It is not "a namespace" or "a container." It is a first-class object with defined properties.

Compute envelope. CPU, memory, GPU class, and duration limits. Expressed as a budget, not just a ceiling. The sandbox knows how much it has spent.

Isolation level. A declared property, not an implementation detail. Ranges from shared-namespace (cheapest, weakest) through container to microvm (strongest, Firecracker-class). The system selects substrate automatically based on declared isolation level and available infrastructure, but can be pinned.

Network policy. Default-deny egress with declarative allowlists. Ingress via the overlay routing layer only. No sandbox can talk to the internet or to other sandboxes without explicit declaration. This is the "credentials don't leave the sandbox" design target applied to networking.

Scoped credentials. Sandboxes receive credentials via a workload identity mechanism (SPIFFE/SPIRE or equivalent). A policy-aware credential broker issues short-lived, scope-attenuated tokens just-in-time to verified workload identities. An agent-spawned sandbox inherits at most the intersection of the spawning agent's scope and the sandbox's declared needs. Scope can only attenuate through delegation, never expand.

Telemetry stream. Every sandbox emits structured logs, traces, and metrics to a per-sandbox stream from the moment of creation. The stream is append-only and tamper-evident.

TTL and budget. Sandboxes are born mortal. Every sandbox has a TTL (default: short) and a cost budget. Exceeding either triggers graceful shutdown, not silent continuation. Durability is opt-in and explicit.

Suspend capability. A declared property. Sandboxes with suspendable = true can be snapshotted and suspended, releasing compute while preserving state. Sandboxes with GPU state, persistent network connections, or kernel-dependent workloads should declare suspendable = false and accept TTL-based termination or pay for idle compute. Resume times are substrate-dependent and should be treated as targets, not guarantees.

sandbox "agent-task-1247" {
  isolation    = "microvm"
  compute      = { cpu: 2, memory: "4Gi", gpu: null }
  ttl          = "30m"
  budget       = { max_cost: "$0.50" }
  network      = allow_egress(["api.stripe.com:443", "*.internal.svc"])
  credentials  = inherit(agent.scope, restrict_to(["db:read", "cache:rw"]))
  suspendable  = true
}

Lifecycle states: creating > ready > running > suspended > draining > terminated. Snapshots can be taken at any running state. A suspended sandbox has released compute but retains state as a snapshot. resume() returns it to running. A terminated sandbox's telemetry stream persists according to retention policy.

Substrate mapping. The system maintains a substrate registry mapping isolation levels and compute requirements to available infrastructure:

Isolation Substrate Cold Start Warm Resume Use Case
shared-namespace K8s pod in shared node <1s N/A Trusted code, high throughput
container Dedicated container, cgroup isolation 1-3s <2s Standard workloads
microvm Firecracker / Cloud Hypervisor <200ms (pre-warmed) <5s Untrusted code, hard multi-tenancy
gpu Dedicated GPU node, container or VM 5-30s (warm pool) Limited* ML inference, fine-tuning
edge Edge runtime (CF Workers, Deno Deploy) <50ms N/A Latency-sensitive, stateless

*GPU checkpoint/restore is substrate-dependent and not universally reliable. Workloads with active GPU state should declare suspendable = false.

GPU and edge substrates are first-class, not afterthoughts bolted onto a container-only model. A sandbox declaration with compute = { gpu: "A100" } transparently routes to GPU infrastructure with appropriate scheduling. The substrate registry is extensible: new substrate types (FPGA, TPU, confidential compute) slot in by implementing a standard provisioning interface.

2. Overlay

An Overlay is a partial replacement of a baseline environment: the mechanism that makes "forking" cheap for service fleets without duplicating everything.

Scope. Declares which services, configs, or routes are replaced. Everything not overlaid falls through to the baseline.

Routing. Integrates with the traffic layer via the routing trust model (see Networking). Test traffic hits the overlay; all other traffic hits baseline.

Composition. Overlays compose. You can overlay an overlay. Resolution order is explicit and deterministic: last-writer-wins within a priority band, or explicit priority declaration.

Async boundaries. Overlays must declare how they interact with asynchronous systems (message queues, event streams, background jobs). Synchronous request routing handles itself via signed selectors and context propagation. Async systems require explicit enrollment because the request context that carries the selector does not naturally survive serialization to a queue. If undeclared, the system's conservative default strips overlay selectors at async boundaries to prevent silent contamination of baseline consumers. See the Networking Model for the full propagation semantics.

Diff. An overlay always knows its delta from baseline. diff(overlay, baseline) returns a typed changeset.

overlay "test-new-checkout" {
  baseline = env.production@v("abc123")    # pinned to a specific version
  replace  = {
    "checkout-service" = { image: "checkout:experiment-42", config: { feature_x: true } }
  }
  route_when = overlay_selector("experiment-42")    # signed, not raw headers
  ttl        = "2h"
}

This is the primitive that makes the "100 agents, 100 experiments" scenario economically viable. You don't clone the world. You overlay the delta and route selectively.

Cross-cutting overlays can target multiple services simultaneously for testing coordinated changes:

overlay "new-auth-flow" {
  baseline = env.staging@v("def456")
  replace  = {
    "auth-service"    = { image: "auth:v2.1" }
    "api-gateway"     = { config: { auth_version: "v2" } }
    "user-service"    = { image: "user:v1.3-compat" }
  }
  route_when = overlay_selector("auth-v2")
}

Baseline versioning policy. Every overlay pins its baseline to a specific version or timestamp. The policy for baseline drift is explicit:

Policy Behavior Use Case
freeze Baseline is locked at fork time. Overlay evaluates against a fixed target. Experiments, statistical comparisons
auto-rebase Baseline tracks head. Overlay is continuously re-evaluated against current state. Development, feature branches
invalidate If baseline moves, overlay is flagged as stale and must be manually rebased. Compliance-sensitive changes

Default: freeze for experiments, auto-rebase for development overlays.

3. Branch

A Branch is a copy-on-write fork of a stateful resource: the mechanism for safely experimenting with data, queues, caches, and configuration without touching the source.

Scope. Databases, message queues, object stores, configuration stores, file systems.

Cost model. Copy-on-write. A branch costs nearly nothing at creation and accumulates cost proportional to divergence. This is the same economics that makes git branching viable: the expensive thing is divergence, not the fork itself.

Lineage. Every branch knows its parent, its fork point (version or timestamp), and its divergence. The resource graph tracks this as a DAG.

Resolution operations. Branches support promote, rebase, and (where explicitly opted-in) merge. The default and dominant operation is promote, which is replacement, not merge. See Stateful Resolution Semantics below.

branch "test-migration-47" {
  source     = db.production.users
  fork_point = @t("2026-02-20T10:00:00Z")
  ttl        = "4h"
  budget     = { max_storage_delta: "10Gi" }
  access     = sandbox("agent-task-1247")
}

Resource-specific branching:

Resource Type Branch Mechanism Merge Support
Postgres (Neon) Native COW branching promote only (schema migrations are one-way)
Postgres (RDS) Blue/green cloning promote via switchover
Message queues Branch-as-replay from point-in-time append_only merge strategy available
Object stores COW at prefix level (S3 versioning) last_writer_wins or promote
Configuration Overlay (inherit parent, override changes) promote or merge with explicit precedence
Caches Warm-copy or cold-start, per use case No merge. promote replaces.

Stateful resolution semantics. Three operations, not one. The system is deliberately honest about the hard problems here.

promote(branch -> parent) means "this branch becomes the new truth." The parent is replaced. This is the common case and the safe default. No conflict resolution needed. Pick a winner.

For development and staging databases, this is straightforward. For live production databases, it requires care. The parent continues accepting writes between fork and promote. Those writes are not present in the branch. Promoting the branch replaces the parent, and those interim writes are lost. Neon's own documentation is explicit about this: "any production data created or modified after the production snapshot will not be present after the restore."

The system addresses this through declared promotion prerequisites on the branch:

Prerequisite Behavior Use Case
quiesce Parent must enter read-only mode before promote executes. System rejects promote if parent is still accepting writes. Short maintenance windows, batch systems
replay(source) After promote, replay the parent's WAL/event stream from fork point to promote point against the new state. Event-sourced systems, append-heavy workloads
reconcile(fn) Run a user-supplied reconciliation function post-promote to backfill missed writes. Domain-specific, application-level logic
accept_loss Explicitly acknowledge that interim parent writes will be discarded. The system logs this decision in the lineage. Read-heavy workloads, test/staging promotion

Default: none. The system refuses to promote a branch whose parent has diverged since fork unless a prerequisite is declared. This is the same philosophy as merge: if you haven't told the system how to handle the hard part, the system won't pretend it can guess.

rebase(branch -> new_fork_point) means "update my branch to reflect what's happened to the parent since I forked." Critical for long-running experiments that would otherwise evaluate against stale state. Rebase may fail if the branch's mutations conflict with parent changes, in which case the system reports conflicts and the branch must be resolved manually or discarded.

merge(branch, target, strategy) is explicitly opt-in. A resource must declare a merge strategy to support merge at all. If no strategy is declared, merge is not available as an operation on that resource type. The API rejects it at call time, not at runtime. This is intentional. Merging stateful resources in the general case is intractable, and hiding that behind a hopeful API leads to runtime surprises.

Available merge strategies:

Strategy Semantics Applicable To
schema_only Merge schema changes, discard data divergence Database DDL
append_only Concatenate, no conflict possible Event logs, append-only tables
last_writer_wins Per-key resolution by timestamp KV stores, configuration
custom(fn) User-supplied merge function Domain-specific

If a resource type doesn't fit any of these strategies, the answer is promote. Pick a winner, not a blend.

4. Environment

An Environment is a named, versioned composition of sandboxes, overlays, and branches that together constitute a coherent running system. It is the unit of "what is deployed," but unlike traditional environments (dev, staging, prod), environments are cheap, programmatic, and potentially very numerous.

environment "agent-experiment-42" {
  base       = env.staging@v("ghi789")
  overlays   = [overlay.test-new-checkout]
  branches   = [branch.test-migration-47]
  sandboxes  = [sandbox.agent-task-1247]
  network    = mesh(base.network, restrict_egress(sandbox.agent-task-1247))
  telemetry  = aggregate(overlays.*.telemetry, branches.*.telemetry, sandboxes.*.telemetry)
}

Environments enforce dev/prod parity structurally. The base environment carries the same service definitions, dependency versions, and configuration shape as production. Overlays and branches modify values within that shape but cannot silently introduce structural drift. An environment that passes validation against the production schema is guaranteed to be structurally compatible.

Environment versioning. Every environment has an immutable version at every point in time. Deltas create new versions. The version log is the source of truth for "what was running when."

env.staging@v("abc123")     # specific version
env.staging@t("2026-02-20") # version at a point in time
env.staging@head            # current (mutable reference)

Environment hierarchy provides progressive trust:

Level Characteristics Agent Autonomy
ephemeral TTL-bound, auto-GC, no persistence guarantees Full. Agents create and destroy freely.
development Persistent, shared, branchable High. Agents can push changes, create branches.
staging Production-shaped, gated promotion Medium. Agents propose, gates approve.
production Full durability, audit, rollback guarantees Low. Agents propose, humans (or policy) approve.

5. Promotion Lane

A Promotion Lane defines the path a change takes from experiment to production, with explicit flow control at each stage.

Strategy. Canary, blue/green, shadow (traffic mirroring), progressive rollout, or instant.

Gates. Policy checks, test suites, human approval, cost thresholds, SLO validation.

Rollback. Automatic rollback on gate failure, with configurable sensitivity.

Lineage. Every promotion records the full chain: which delta, from which environment (at which version), through which gates, with what telemetry at each stage.

lane "checkout-to-prod" {
  stages = [
    { env: "staging",    strategy: "instant",
      gates: [test_suite("integration"), policy("security-scan")] },
    { env: "canary",     strategy: "canary",   traffic: "5%", duration: "15m",
      gates: [slo("p99_latency < 200ms"), slo("error_rate < 0.1%")] },
    { env: "production", strategy: "progressive", steps: ["25%", "50%", "100%"],
      gates: [human_approval(team: "platform"), slo("business_metric_stable")] }
  ]
  rollback = auto(on: "gate_failure", to: "last_known_good")
}

Promotion lanes make the path to production explicit and auditable. An agent can propose a change and push it through the lane; the lane's gates determine how far it gets without human intervention. This is "human-on-the-loop" rather than "human-in-the-loop." Engineers define the policy. The system enforces it. The agent doesn't need permission to try; it needs to pass the gates.

6. Telemetry Stream

A Telemetry Stream is not a monitoring add-on. It is a structural component of every resource in the graph. Built on OpenTelemetry as the wire format, with a layered cardinality model that prevents observability costs from scaling with experiment count.

The cardinality model. The system treats logs, traces, and metrics differently because they have fundamentally different cardinality economics:

Signal Cardinality Keyed By Retention
Traces High, per-request overlay_id, branch_id, sandbox_id, run_id Short (hours to days)
Logs High, per-event overlay_id, branch_id, sandbox_id, run_id Medium (days to weeks)
Metrics Low, aggregated environment, service, stage Long (weeks to months)

Metrics use a cardinality budget: a declared cap on the number of unique label combinations a resource is allowed to emit to the metrics tier. This prevents the "10,000 overlays × 50 services × 4 golden signals" explosion that wrecks dashboards and bills.

telemetry_stream "checkout-experiment" {
  resource           = overlay("test-new-checkout")
  cardinality_budget = { max_metric_series: 500 }

  traces  = { retention: "48h", sample_rate: 0.1 }
  logs    = { retention: "7d",  level: "warn" }
  metrics = {
    retention:  "30d",
    dimensions: ["environment", "service", "status_code"],   # stable, low-cardinality
    exemplars:  true      # link to high-cardinality traces for drill-down
  }
}

Drill-down from aggregated metrics to specific requests uses exemplar links: a metric data point carries a pointer to one or more representative traces, which carry the full overlay/branch/sandbox context. This gives you "error rate spiked in the checkout overlay" at the metrics tier, with one click to the specific failing request trace. No Slack archaeology required.

Automated experiment evaluation. Agents can define success criteria and programmatically determine whether a change improved things, closing the loop without human interpretation of dashboards. The feedback loop is the programming model.

7. Resource Graph

The Resource Graph is the queryable, versioned representation of all infrastructure state. It is the "single query surface" that answers "what's going on?"

Contents. The graph maintains six categories of state:

Desired state. The typed graph of all declared resources, their relationships, and their configuration. Versioned: every delta creates a new version.

Actual state. The reconciliation status of every resource. Is desired == actual? If not, what's the drift and what's the reconciler doing about it?

Lineage. The DAG of branches, overlays, and promotions. Who created what, when, from what parent (at which version), through what gate.

Telemetry index. Pointers into telemetry streams, keyed by resource and version. "Show me the error rate for this service at the version before the last change."

Policy state. Which policies apply to which resources, and which decisions those policies have made (approved, denied, with reason).

Cost state. Current and projected cost per resource, per environment, per agent, per team.

Concurrency model. The resource graph supports concurrent access from N agents with well-defined semantics.

Optimistic concurrency control. Every delta targets a specific graph version. If the graph has moved since the agent last read it, the delta is rejected with a conflict error. The agent must re-read current state and retry or rebase its delta.

apply_delta(env_id, patch, expected_version: "v42")
// if current version is v42: applied, new version v43
// if current version is v45: CONFLICT, current=v45, expected=v42

Typed conflict detection. Two deltas touching different resources or different fields of the same resource do not conflict. Two deltas modifying the same field of the same resource conflict. Conflict granularity is defined by the resource type's schema.

// These two deltas do NOT conflict (different resources):
agent_a: apply_delta({ "checkout-service": { replicas: 3 } }, expected_version: "v42")
agent_b: apply_delta({ "auth-service": { image: "auth:v2" } }, expected_version: "v42")

// These two deltas DO conflict (same field, same resource):
agent_a: apply_delta({ "checkout-service": { replicas: 3 } }, expected_version: "v42")
agent_b: apply_delta({ "checkout-service": { replicas: 5 } }, expected_version: "v42")

Idempotency keys. Every tool call from an agent carries a client-generated idempotency key. Retries are safe. Duplicates are deduplicated. This is critical because agents will retry on transient failures, and "applied the same delta twice" is a common failure mode that should be structurally impossible.

apply_delta(env_id, patch, idempotency_key: "agent-12-task-47-step-3")
// first call: applied
// retry with same key: returns previous result, no re-application

8. Experiment

An Experiment is a structured primitive built on overlays, branches, telemetry, and promotion lanes. Not "use those things manually and hope for the best," but a first-class object that coordinates them.

experiment "checkout-redesign" {
  hypothesis   = "New checkout flow reduces cart abandonment by >5%"
  control      = env.production@v("abc123")    # frozen baseline
  treatment    = overlay("new-checkout-flow")
  allocation   = { strategy: "header-based", traffic: "10%" }
  metrics      = ["cart_abandonment_rate", "conversion_rate", "p99_latency"]
  duration     = "7d"
  auto_resolve = {
    promote_if  = metric("cart_abandonment_rate").delta < -5%
                  AND metric("p99_latency").delta < 10%
    rollback_if = metric("error_rate") > 1%
    else        = "human_review"
  }
}

Baselines are always version-pinned. The experiment evaluates the overlay against a frozen snapshot of production, not a moving target. If production changes during the experiment, the system flags this but does not invalidate the experiment unless the invalidate baseline drift policy is set.

Multi-armed experiments compose naturally:

experiment "payment-provider" {
  variants = {
    "stripe-v3"  = overlay("stripe-v3-integration")
    "adyen"      = overlay("adyen-integration")
    "control"    = baseline
  }
  allocation = { strategy: "weighted", weights: { stripe-v3: 33%, adyen: 33%, control: 34% } }
  metrics    = ["payment_success_rate", "latency", "cost_per_transaction"]
}

Agent Interface Model

The eight primitives and the resource graph constitute the system's internal architecture. The agent interface is how an AI agent actually interacts with that architecture, and it is subject to a hard constraint that shapes everything: context window cost.

A naive approach (one MCP tool per operation, with full typed schemas) would consume tens of thousands of tokens before the agent even begins reasoning about its actual task. Cloudflare's Code Mode work demonstrates both the problem and the solution. Their 2,500-endpoint API would require 1.17 million tokens as conventional MCP tools. Collapsed to search() + execute() with code-as-plan, the cost is roughly 1,000 tokens regardless of API surface area.

The resource graph adopts the same pattern: two meta-operations that compose the full primitive set through code. This is the same progressive disclosure principle I apply everywhere: don't front-load what can be discovered on demand.

search(code) : Progressive Schema Discovery

The agent writes code against the resource graph's type schema to discover available resources, operations, capabilities, and constraints. The full schema never enters the context window. The agent queries what it needs for the current task.

// "What databases in staging support branching?"
search(async (schema) => {
  return schema.resources
    .where({ type: "database", environment: "staging" })
    .select(["name", "provider", "supports_branch", "branch_strategies"])
})

// "What substrates have GPU capabilities in us-east?"
search(async (schema) => {
  return schema.substrates
    .where({ region: "us-east-*", capabilities: includes("gpu.*") })
    .select(["name", "capabilities", "cost_model", "warm_pool_size"])
})

// "What promotion gates are available for production lanes?"
search(async (schema) => {
  return schema.gate_types
    .select(["name", "description", "parameters"])
})

The search operation runs in a read-only sandbox (V8 isolate or equivalent) with no side effects. It can inspect the schema, query current graph state, and examine telemetry indices, but cannot modify anything.

execute(code) : Operation Chaining as Plan

The agent writes code that chains multiple graph operations into a single execution plan. This is more token-efficient than separate tool calls, reduces round-trip latency, and lets the agent express intent as a coherent plan rather than a sequence of disconnected steps.

// "Branch the database, create a sandbox, apply an overlay, run tests, evaluate"
execute(async (graph) => {
  const branch = await graph.branch({
    source: "db.staging.users",
    fork_point: "now",
    ttl: "2h"
  })

  const sandbox = await graph.sandbox({
    isolation: "microvm",
    compute: { cpu: 2, memory: "4Gi" },
    ttl: "1h",
    credentials: restrict(agent.scope, { [branch.id]: "rw" })
  })

  const overlay = await graph.overlay({
    baseline: "env.staging@head",
    replace: { "user-service": { image: "user:migration-v3" } },
    route_when: overlay_selector("migration-test")
  })

  const run = await graph.run(sandbox.id, {
    command: "python run_migration.py && python run_tests.py",
  })

  const telemetry = await graph.stream(run.id, {
    metrics: ["error_rate", "p99_latency"],
    window: "5m",
    compare: "env.staging@v(current)"
  })

  return { branch, sandbox, overlay, run, telemetry }
})

Execution semantics. Operations within an execute block run sequentially by default. Each operation returns its result (or error) before the next begins. If any operation fails, subsequent operations do not execute, and the agent receives the partial result plus the error. This is "fail-fast with partial results," not implicit transactions. Where transactional semantics are needed (e.g., "create overlay and branch together or neither"), the agent wraps those operations in an explicit graph.atomic([...]) block, which rolls back all enclosed operations on any failure.

Resource limits. The execute sandbox enforces three hard ceilings, all checked synchronously on the hot path rather than by the async budget controller:

CPU time limit. Wall-clock time is irrelevant (the block may be waiting on graph operations). CPU time is what matters. The isolate uses OS-level CPU time tracking (CLOCK_THREAD_CPUTIME_ID) with a signal-based kill, the same mechanism Cloudflare uses for Workers. Default: 5 seconds of CPU time. Exceeding it terminates execution and returns partial results.

Operation count limit. Each graph mutation (create, update, delete) increments a counter. When the counter hits the ceiling, subsequent mutations are rejected. This is the gas meter: it prevents a hallucinating agent from issuing while(true) { graph.sandbox({...}) } and saturating the write path before the async budget controller notices. Default: 100 operations per execute block.

Output size limit. The return value of an execute block is bounded. An agent cannot use the block to exfiltrate large amounts of graph state. Default: 1MB.

Isolation. The execute sandbox has the same security properties as any other sandbox in the system: default-deny egress, scoped credentials, no filesystem, no environment variable access. The agent's code can call graph operations but cannot make arbitrary network requests or access resources outside its scope. Same V8 isolate model that Cloudflare uses for Code Mode, applied to infrastructure operations rather than API calls.

Token budget. The entire agent interface (both tools plus their schemas) consumes a fixed token count regardless of how many primitives, resource types, substrates, or operations the system supports. Adding a new resource type or a new substrate does not increase context cost. The agent discovers new capabilities through search, not through expanded tool definitions.

Why Code-as-Plan, Not Structured Tool Calls

Three reasons, in order of importance.

Composability. An agent doing "branch, sandbox, overlay, test, evaluate" should express that as a single coherent plan, not five disconnected tool calls with five round trips. The plan carries its own logic: conditionals, error handling, data flow between steps. This is qualitatively richer than a flat list of operations.

Progressive disclosure. The agent doesn't need to know the full type system of all resource types, all substrate capabilities, all branch strategies, and all policy rules upfront. It searches for what's relevant to its current task. "What databases support branching?" is a runtime query, not a context-window tax.

Future-proofing. When the system adds new primitives (branchable queues, new substrate types, new gate types), no MCP tool definitions need updating. The agent discovers them through search and uses them through execute. The protocol surface is stable even as the system's capabilities grow. This is a crucial property for a system that will evolve faster than its consumers can update.


Networking Model

Networking in agentic infrastructure must handle two problems simultaneously: overlay routing (getting test traffic to the right experiment) and security isolation (preventing sandboxes from accessing what they shouldn't).

Overlay Routing and the Routing Trust Model

Traffic routing between overlays uses request context propagation. But routing headers are a security boundary, not just a traffic management convenience. If you can spoof an overlay header, you can route production traffic through experimental code. The system enforces a routing trust model with three hard rules.

Rule 1: Overlay selectors are injected only at trusted ingress. External requests never carry overlay selectors. The system injects them at the ingress gateway based on allocation rules (experiment traffic percentage, explicit opt-in, etc.). Selectors are signed tokens, not raw headers. A valid selector is cryptographically bound to a specific overlay and has an expiration time.

# At trusted ingress:
overlay_selector = sign({
  overlay:      "test-new-checkout",
  expires:      now() + 1h,
  allocated_by: experiment("checkout-redesign")
}, ingress_key)

# Injected as: x-overlay-selector: <signed_token>

Rule 2: Propagation is allowlisted. Only services explicitly participating in an overlay propagate the selector downstream. Non-participating services strip the selector. This prevents "context bleed" where an overlay selector accidentally leaks into unrelated request chains.

overlay "test-new-checkout" {
  participants = ["api-gateway", "checkout-service", "payment-service"]
  # All other services strip the selector if they encounter it
}

Rule 3: Selectors are stripped at egress boundaries. Overlay selectors never leave the mesh. External API calls, webhook callbacks, and cross-mesh traffic have selectors stripped before transmission. This prevents both information leakage and the possibility of external systems interpreting or replaying selectors.

Rule 4: Async boundaries require explicit enrollment. The three rules above work cleanly for synchronous request/response (HTTP, gRPC). Asynchronous boundaries (message queues, event streams, background jobs, webhooks) break the propagation model because the selector lives in request context that doesn't naturally survive serialization to a queue. If an overlaid checkout service produces a Kafka message and the selector is lost, a baseline consumer processes experimental data, silently contaminating production state.

The system handles this by treating async systems as declared participants with their own propagation semantics:

overlay "test-new-checkout" {
  participants = ["api-gateway", "checkout-service", "payment-service"]
  async_boundaries = [
    { system: "kafka", topic: "order-events",
      propagation: "header",          # inject selector into message headers
      consumer_filter: "selector"     # consumers route by selector presence
    },
    { system: "cron", job: "nightly-reconciliation",
      propagation: "skip"             # this job should not see overlay data
    }
  ]
}

Propagation through message headers is the mechanism. Kafka, SQS, and most modern message brokers support message-level headers (Kafka since 0.11, SQS via message attributes). The overlay controller injects the signed selector into message headers at produce time, and overlay-aware consumers filter or route by selector presence. This is the same pattern OpenTelemetry uses for distributed trace propagation across async boundaries, extended to overlay routing.

Three propagation modes for async boundaries:

Mode Behavior Use Case
header Selector injected into message headers. Overlay-aware consumers route accordingly. Event-driven services participating in the experiment
fork_topic Messages with overlay selectors are routed to a shadow topic/queue. Baseline consumers never see them. High-isolation experiments, systems where consumer filtering is impractical
skip Messages produced by overlaid services are not propagated to this async system. Background jobs, analytics pipelines that should only process baseline data

Default: skip. If an async boundary is not declared as a participant, the overlay controller strips or drops selectors at the producer boundary. This is the conservative default: silent contamination of baseline consumers is worse than missing experimental messages from an async pipeline. Teams must explicitly opt in to async propagation, and the system validates that consumers on the other end are overlay-aware before allowing header mode.

Network Isolation

Each sandbox declares its network policy as a property:

Default-deny egress. Nothing leaves a sandbox unless explicitly allowed. Critical for agents running untrusted or experimental code.

Scoped internal access. A sandbox can declare which internal services it needs (by service name, not IP). The mesh enforces this.

No lateral movement. Sandboxes cannot reach other sandboxes unless explicitly linked via an environment declaration.

Cross-Substrate Networking

For multi-region, multi-cloud, and edge deployments:

Locality-aware routing. Overlays can be pinned to regions or edge locations. Traffic routing respects locality constraints.

Cross-substrate connectivity. An edge sandbox can call a cloud-hosted service through the mesh, with the graph tracking the cross-substrate dependency. mTLS is enforced across all substrate boundaries.

Latency budget awareness. The graph knows the latency between substrates. An environment spanning edge and cloud can flag when cross-substrate calls would exceed SLO budgets.

Service Mesh Integration

The system does not mandate a specific mesh implementation but requires mesh capabilities: mTLS between all services (including overlaid versions), signed-token-based routing with controlled propagation, per-request telemetry injection, and rate limiting and circuit breaking per overlay.

In practice, this maps to Istio, Linkerd, or Envoy-based service meshes. But the interface is the overlay declaration and routing trust model, not mesh configuration YAML. The mesh is an implementation detail, not a design decision.


Autoscaling Model

Autoscaling in agentic infrastructure differs from traditional autoscaling because the workload pattern is fundamentally different: many short-lived, bursty experiments rather than sustained traffic.

Warm Pools

For sandboxes requiring fast start (which is most of them), the system maintains warm pools of pre-provisioned resources at each isolation level:

MicroVM pool. Pre-booted Firecracker VMs with base images. Claiming one takes <200ms.

Container pool. Pre-pulled images on warm nodes. Start time <1s.

GPU pool. Pre-allocated GPU slots (expensive, so pool size is tightly managed). Start time <5s from warm.

Pool sizes are managed by a predictive autoscaler that observes agent activity patterns and pre-provisions accordingly. The pool is shared across all agents. Individual agents don't need to think about warm-up.

Overlay-Aware Scaling

Within a running environment, services autoscale based on standard signals (CPU, memory, request rate, queue depth). But with an addition: if an overlay is receiving 5% canary traffic, the overlaid service scales independently from the baseline, proportional to its actual load. The overlay's scale-to-zero threshold is separate from the baseline's. Experimental traffic shouldn't keep baseline capacity warm, and vice versa.

Budget-Bounded Scaling

All autoscaling respects budget envelopes. A sandbox that has spent its budget doesn't scale; it sheds load or terminates. An environment with a cost ceiling hits a wall, not an infinite bill. This is structural: the autoscaler checks budget before scaling, not after. If you can't afford it, it doesn't happen.

Idle Suspension and Resume

Sandboxes and environments that are idle can be snapshotted and suspended, releasing compute resources:

sandbox.suspend()   // snapshot + release compute
sandbox.resume()    // restore from snapshot

Suspend/resume is a declared capability, not a universal guarantee. The system respects the suspendable flag on each sandbox. Workloads with active GPU state, open persistent connections, or kernel-version-sensitive checkpoints should not declare themselves suspendable. Resume times are substrate-dependent: microVMs with clean state resume in seconds; containers with large memory footprints take longer. The platform reports actual resume times as telemetry, not as guarantees.


Security Model

Security is structural, not advisory. The system enforces security properties through the type system and resource graph, not through documentation that agents might ignore. I've written about the credential architecture in detail separately; this section covers how those principles manifest in the resource graph.

Scope Attenuation

Every entity in the system (human, agent, sandbox, service) has a scope: a set of permissions expressed as capabilities. The fundamental rule: you can only grant a subset of what you have. An agent with read-write access to the users database can create a sandbox with read-only access, but cannot create one with admin access. Scope can only attenuate through delegation, never expand. This is monotonic attenuation, the same principle that makes capability-based security systems work.

agent.scope = { db.users: "rw", db.analytics: "r", service.checkout: "deploy" }

// This works (subset of agent's scope):
sandbox.credentials = restrict(agent.scope, { db.users: "r" })

// This fails at creation time (not a subset):
sandbox.credentials = { db.users: "admin" }  // ERROR: scope escalation

Credential Architecture

Credentials follow a workload identity + just-in-time broker architecture:

  1. Every sandbox receives a workload identity (SPIFFE/SPIRE model): a cryptographic identity bound to the sandbox's lifecycle.
  2. A policy-aware credential broker issues short-lived, scope-attenuated tokens to verified workload identities, just-in-time for each access. Credentials are ephemeral by default: minutes, not days.
  3. Action-schema-aware gateways sit in front of sensitive resources, validating that each request matches the sandbox's declared access pattern. Not just "can access database" but "can execute SELECT on these tables."
  4. Tokens are bound to the workload identity and expire with the sandbox. They cannot be extracted and replayed from a different context.

The design target is credentials that don't leave the sandbox. The mechanism is defense in depth: short-lived tokens + workload identity binding + gateway enforcement + default-deny egress. Any one layer can fail and the others still contain the blast radius.

Delegation Lineage

Every action in the system records its delegation chain: which human authorized which agent, which agent created which sandbox, which sandbox modified which resource. This chain is immutable and tamper-evident. Audit queries can trace from any infrastructure change back to the human who authorized the agent that made it.

graph.lineage(change("db-migration-47"))
// human:rand authorized agent:claude-code-session-12
//   agent created sandbox:agent-task-1247
//     sandbox executed migration via branch:test-migration-47
//       branch promoted to staging via lane:checkout-to-prod
//         gate:security-scan passed, gate:human-approval pending

If you can't trace an action back to its authorizing human through the full delegation chain, your audit capability is theater.

Policy Enforcement Outside the Reasoning Loop

Following AWS AgentCore's model: security policies are enforced deterministically, outside the LLM reasoning loop. It doesn't matter how cleverly an agent phrases a request. The policy layer evaluates the action, not the intent.

Policies are expressed declaratively and attached to the resource graph:

policy "no-public-databases" {
  deny {
    resource  = "branch.*"
    condition = network.egress.includes("0.0.0.0/0")
    message   = "Database branches cannot have public egress"
  }
}

policy "agent-cost-limit" {
  deny {
    actor     = "agent.*"
    condition = actor.cost_accrued > "$50/hour"
    message   = "Agent hourly cost limit exceeded"
  }
}

policy "overlay-blast-radius" {
  deny {
    resource  = "overlay.*"
    condition = overlay.traffic_percentage > 10% AND actor.type == "agent"
    message   = "Agents cannot create overlays serving >10% of traffic"
  }
}

Blast Radius Containment

Every resource has a declared blast radius: the maximum impact of its failure or compromise.

Ephemeral sandboxes: blast radius is the sandbox itself. Development branches: blast radius is the branch's data, no production impact. Staging overlays: blast radius is staged traffic, production unaffected. Production promotions: blast radius is the promotion strategy's scope (5% canary, specific region, etc.).

The system enforces that an agent cannot create resources with a blast radius larger than its authorization scope.


Multi-Substrate and Hybrid Deployments

The resource graph is substrate-agnostic but substrate-aware. Resources declare their requirements; the system maps them to available substrates.

Substrate Registry

The platform maintains a registry of available compute substrates with their properties:

substrate "aws-us-east-1" {
  type         = "cloud"
  provider     = "aws"
  region       = "us-east-1"
  capabilities = ["container", "microvm", "gpu.a100", "gpu.h100"]
  cost_model   = aws_pricing("us-east-1")
  latency      = { from: "aws-us-west-2": "67ms", from: "edge-cloudflare": "12ms" }
}

substrate "edge-cloudflare" {
  type         = "edge"
  provider     = "cloudflare"
  capabilities = ["isolate"]
  cost_model   = cloudflare_pricing()
  constraints  = { max_cpu_time: "30s", max_memory: "128Mi", no_persistent_state: true }
}

substrate "on-prem-gpu-cluster" {
  type         = "on-prem"
  capabilities = ["gpu.a100", "container"]
  cost_model   = fixed_cost("$0.00/hr")  # already paid for
  constraints  = { network: "vpn-only", compliance: ["hipaa", "sox"] }
}

Placement Policy

Resources can declare placement preferences or requirements:

sandbox "inference-worker" {
  compute    = { gpu: "A100", memory: "32Gi" }
  placement  = {
    prefer   = substrate.where(type == "on-prem")     # use what we own first
    fallback = substrate.where(provider == "aws")      # burst to cloud
    require  = substrate.where(compliance.includes("hipaa"))  # hard constraint
  }
}

The scheduler resolves placement at creation time, respecting constraints, preferences, and current capacity. Cross-substrate deployments (edge function calling cloud-hosted API calling on-prem GPU) are expressed in the resource graph as dependencies; the networking layer handles connectivity.

Portability via Abstraction

Services in the resource graph are defined in terms of what they need, not where they run:

service "recommendation-engine" {
  runtime    = "python:3.12"
  compute    = { cpu: 4, memory: "8Gi", gpu: "any" }
  depends_on = [db.recommendations, cache.user_prefs]
  scaling    = { min: 1, max: 20, metric: "queue_depth" }
}

The platform resolves gpu: "any" to a specific substrate, db.recommendations to a specific database provider, and wires the networking. The service definition is portable across substrates without modification.


The Reconciliation Engine

At the heart of the system is a continuous reconciliation engine: Kubernetes-style controllers operating over the resource graph, not just over pods.

Write Path (Fast)

  1. Agent emits a delta via execute(code), which calls apply_delta(env_id, patch, expected_version, idempotency_key).
  2. Delta is validated: type-checked against the resource schema, policy-checked against applicable policies, version-checked against expected graph version.
  3. If type/policy checks pass but version conflicts, the delta is rejected with CONFLICT and the current version. The agent re-reads and retries.
  4. If all checks pass, delta is appended to the version log and desired state is updated atomically.
  5. Reconciliation job is created and returned immediately. The caller does not block on convergence.

This is the hot path. It must be fast. Sub-second for simple deltas.

Reconciliation Loop (Continuous)

Controllers watch the resource graph for desired/actual divergence and continuously drive toward convergence:

Service controller. Ensures the correct image and config are deployed for each service in each overlay.

Overlay controller. Configures routing rules, signed selectors, and propagation allowlists for active overlays.

Branch controller. Manages copy-on-write state for branched resources and tracks divergence.

Network controller. Maintains mesh configuration, mTLS certificates, and egress policies.

Budget controller. Monitors cost accrual and enforces limits. Triggers graceful shutdown when budgets are exceeded.

Telemetry controller. Ensures streams are active, cardinality budgets are respected, and exemplar links are functional.

GC controller. Cleans up expired TTLs, exceeded budgets, orphaned resources, and terminated sandbox telemetry beyond retention.

Compaction (Periodic)

On a configurable schedule (or on-demand), the system compacts the current desired state into a canonical snapshot: a complete, self-contained declaration of the infrastructure. This snapshot can be exported as Terraform, Pulumi, or CloudFormation for portability and disaster recovery; stored in version control for audit and compliance; or used as the basis for a clean rebuild in a new substrate.

The compacted output is a machine-generated artifact, not a return path to human-maintained IaC. Think of it as a database dump: complete, deterministic, and useful for recovery, not something an engineer opens in an editor and iterates on. The resource graph is the live control plane; the compacted snapshot is the cold backup. Terraform remains a compilation target, not the hot path.


Non-Goals

Explicitly out of scope for this design. Defining negative space is as important as defining what you're building.

Replacing Kubernetes. The system orchestrates over Kubernetes (and other substrates), not in place of it. K8s remains a viable substrate for containers; the resource graph is the layer above.

General-purpose CI/CD. The system supports the inner loop (fast deltas, overlays, experiments) and the promotion path. Build pipelines, artifact registries, and source control remain external systems.

Full-stack environment cloning. The entire design is predicated on not cloning full environments. Overlays and branches exist to make full cloning unnecessary.

Solving stateful merge in the general case. The system provides the plumbing (promote, rebase, strategy-bound merge) but does not pretend that arbitrary stateful merges are possible. Domain-specific merge strategies are the user's responsibility. This is a hard problem; hiding it behind a friendly API makes it worse, not better.

Being the MCP server for everything. The resource graph is the single query surface for infrastructure. It is not the interface to source control, issue trackers, documentation, or other non-infrastructure systems. Those remain separate MCP servers. The composition problem (agents needing many services) is handled by MCP gateway patterns, not by absorbing the world into the resource graph.


Build Order

To avoid building "Kubernetes 2: now with more feelings," the implementation is staged to prove the core loop before expanding.

Phase 1: The Inner Loop

Prove the delta-observe cycle.

  1. Sandbox primitive with TTL, budget, scoped identity (SPIFFE), and a hard telemetry contract. Born-observable from day one. This is not deferrable.
  2. Overlay primitive with the full routing trust model (signed selectors, propagation allowlists, egress stripping).
  3. Queryable resource graph as the single source of "what exists, what changed, what is it costing, what is broken." With optimistic concurrency control and idempotency keys.
  4. Agent interface via search + execute Code Mode. Two MCP tools, O(1) tokens, full graph access.
  5. Promotion lanes with deterministic policy gates.

This phase proves: an agent can fork, modify, observe, and promote a change safely and cheaply.

Phase 2: Stateful Branching

Extend to data.

  1. Branch primitive for Postgres (Neon integration) with promote and rebase. No merge until a strategy is declared.
  2. Experiment primitive with version-pinned baselines and automated evaluation.

This phase proves: an agent can safely experiment with data, not just code.

Phase 3: Multi-Substrate and Scale

  1. Substrate registry and placement policy for GPU, edge, and multi-cloud support.
  2. Suspend/resume for substrates that support it (microVM first).
  3. Branch generalization to queues, caches, and configuration.
  4. Compaction for outer-loop snapshots, compliance, and DR.

This phase proves: the system works across heterogeneous infrastructure at organizational scale.


How This Evolves

Near-term (6-12 months)

Sandbox and overlay primitives solidify as the industry converges. E2B, Daytona, Fly.io Sprites, and Google Agent Sandbox are all converging on similar abstractions. Standardization will likely emerge first at the tooling and control-plane interface layer (MCP and related protocols), with sandbox substrates remaining differentiated (containers vs. microVMs vs. edge). A lowest-common-denominator sandbox lifecycle API is plausible but will be pushed by large platforms (Google, AWS) rather than emerging organically from the Agentic AI Foundation, which is currently focused on protocol interoperability. NIST's AI Agent Standards Initiative may become the boring but decisive forcing function for interoperability and security requirements.

The Code Mode pattern (two-tool, code-as-plan interfaces for large API surfaces) will likely become standard practice for infrastructure MCP servers. Cloudflare's work, Anthropic's programmatic tool calling, and Block's Goose implementation all point in the same direction: agents interacting with infrastructure through typed code executed in sandboxed isolates, not through exhaustive tool enumerations.

Medium-term (12-24 months)

Branching moves up the stack from databases (Neon, PlanetScale) to queues, caches, and configuration. IaC bifurcates formally into inner loop (deltas, overlays, fast reconcile) and outer loop (compacted snapshots, compliance, DR). Terraform remains useful as a compilation target, not as the hot path.

The agent interface model (search + execute over a typed graph) extends beyond infrastructure to compose with other service graphs: observability platforms, incident management, cost optimization. The resource graph becomes one node in a larger "agentic service mesh" where agents can discover and chain operations across systems through a uniform code-as-plan interface.

Longer-term (24-36 months)

The resource graph becomes the primary interface for infrastructure. Not kubectl, not the AWS console, not Terraform CLI. A queryable, version-controlled graph that humans and agents both interact with through typed APIs. Infrastructure stops being "something you configure" and becomes "something you query and evolve," more like a database than a control panel.


What Makes This Hard

Intellectual honesty demands acknowledging the hard problems this design doesn't fully solve. Hiding them behind optimistic framing is how you get runtime surprises.

Stateful merge semantics. Branching databases is elegant; merging them is often impossible in the general case. The system makes this visible: merge is opt-in, strategy-bound, and unavailable by default. Even promote, the safe default, has sharp edges for live databases: the transaction gap between fork and promote means interim writes are lost unless the promotion prerequisite (quiesce, replay, reconcile, or explicit accept_loss) is declared. The system refuses to promote silently, but defining the right prerequisite for a given domain remains the user's problem.

Cross-environment consistency during promotion. When promoting a change that spans multiple services, databases, and configuration, achieving atomicity across all of them is a distributed systems problem with no general solution. The system can provide transaction-like semantics (two-phase promote), but failures during promotion require explicit rollback strategies.

Async overlay isolation. The routing trust model works cleanly for synchronous request/response. Async boundaries (Kafka, SQS, cron jobs, webhooks) require explicit enrollment and propagation configuration. The system provides the mechanisms (header injection, topic forking, skip), but correctly identifying all async boundaries in a complex service graph is a human mapping problem. Undiscovered async pathways can silently contaminate baseline state with experimental data, or silently drop experimental messages that the experiment needed to observe. The conservative default (strip at undeclared boundaries) prevents contamination but can cause experiments to produce incomplete results if async participants aren't declared.

Cost prediction for non-deterministic workloads. Agent workloads are inherently unpredictable. No two runs create identical resource consumption patterns. Budget envelopes provide ceilings, but predicting cost before execution remains approximate at best. You can bound it; you can't predict it.

Trust calibration. How much autonomy should an agent have? Too little and you've built a very expensive approval queue. Too much and you're one prompt injection away from deleting production. The promotion lane model provides the framework, but tuning the gates for each organization's risk tolerance is a human judgment problem, not a systems design problem.

The bootstrap problem. This system is complex. The path from "existing Kubernetes cluster with Terraform" to "fully realized agentic resource graph" needs a pragmatic migration story. The phased build order addresses this (start with sandboxes and overlays as the beachhead, add branching and the full graph incrementally), but the migration cost is real and shouldn't be underestimated.

Observability cost scaling. Even with cardinality budgets, the sheer volume of traces and logs from hundreds of concurrent agent experiments creates storage and query pressure. The telemetry model is designed to manage this (short retention for high-cardinality signals, exemplar links for drill-down), but operational tuning of retention policies, sampling rates, and storage tiers will be an ongoing concern.

Code Mode safety at scale. The search + execute interface runs agent-generated code in sandboxed isolates. The isolate's resource limits (CPU time, operation count, output size) provide synchronous defense against runaway execution. But the limits are per-block, not per-session. An agent that issues many sequential execute blocks, each under the operation limit, can still accumulate significant resource creation over time. The budget controller handles this at a longer timescale, but the gap between "each block is individually bounded" and "the aggregate behavior is bounded" requires both mechanisms working in concert. The policy layer must be equally effective whether an agent issues one operation or chains fifty in a single execute block, and whether it executes one block or fifty in a session.


This document is a design proposal, not a specification. The primitives are chosen for composability and extensibility; the specific syntax and APIs are illustrative. The goal is to identify the right abstractions. The implementation can vary by substrate, scale, and organizational context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment