Skip to content

AI agent subsystem

Run autonomous coding agents as first-class Kubernetes resources. Describe the work, pick a runtime, launch a run. The controller does the rest.

ai-agent-subsystem turns “run a coding agent” into a declarative Kubernetes operation. You describe what the agent should do (a recipe), where it runs (a runtime template), and which run you want (parameters). A controller reconciles each run into a Kubernetes Job, supervises it, streams its output, and records the result on the resource’s status. Kubernetes stays the single source of truth.

It is a clean-sheet, standalone rebuild of an internal subsystem, written in D as a statically linked monorepo with no runtime dependencies.

Everything is built from three Custom Resources that reference each other in a chain:

flowchart LR
    AD["AgentDefinition<br/>the recipe"] -->|agentDefRef| ST["Station<br/>the runtime"]
    ST -->|stationRef| AG["Agent<br/>one run"]
    AG -->|controller creates| JB["Job → Pod"]
    classDef ad fill:#2f5fd8,color:#fff,stroke:#16224f;
    classDef st fill:#3f7be0,color:#fff,stroke:#16224f;
    classDef ag fill:#5b93ec,color:#fff,stroke:#16224f;
    class AD ad
    class ST st
    class AG ag

AgentDefinition

The recipe: prompt template, model, allowed tools, permissions, and output sinks.

Station

The runtime: a Pod template plus a recipe reference and run-history limits.

Agent

One run: a Station reference, parameters, and a status that tracks the lifecycle.

Controller

Watches Agents, builds Jobs, patches status, and prunes old runs.