Architecture overview

How declarative resources, the operator, the execution engine, and external dependencies fit together.

Why these boundaries exist

A prompt-only agent bundles identity, workflow, tool authority, model choice, and storage into one opaque loop. Kaigents separates them so teams can review desired state in Kubernetes, move the expensive execution to a runner, route model calls to a service they control, and retain evidence of tool and workflow decisions. These are architectural reasons, not a claim that every product concept in the PRD is already installed by the public chart.

Begin with the domain model for definitions versus executions, then the control-plane, tool-plane, context and memory, and workflow-engine pages for each boundary in detail.

Control plane

Agents, Teams, Tasks, Processes, and Runs are namespaced Kubernetes resources. The operator watches desired state, resolves references, and coordinates execution. Tool, MCPServer, and ModelEndpoint resources describe the capabilities used by an Agent. Kubernetes RBAC and namespaces govern access to these resources; a model prompt is not an authorization boundary.

The chart currently installs v1alpha1 CRDs. An Agent supplies systemPrompt, optional modelEndpointRef and modelName, tools and allowedTools; a Run specifies a target of kind Agent or Team in the same namespace. Tasks and ordered Process steps are separate definitions, not valid Run target kinds in the current chart schema.

Execution plane

The Rust engine handles context budgeting, run timelines, model calls, and MCP tool invocation. The context manager keeps system instructions and task state in core context, fits recalled and archival entries into the budget, and can prefer a local model with sufficient context window. Selection and routing are policies; they do not make a model more accurate by themselves.

The MCP tool plane discovers contracts from registered clients and records correlated ToolInvoked, ToolFinished, and ToolFailed events. Calls have timeouts and bounded output. Separately, an allowlisted tool-call path checks proposed tool names against configured bindings. Enforce permissions at the tool service too: a registered tool contract is not a substitute for user or tenant authorization.

Long-running work

The Go Temporal adapter executes Work Items as activities and exposes a queryable workflow phase, current step, results, and rework count. Activities have bounded retries; a gated step waits for an approval or rework signal. Persisted workflow state allows an interrupted run to resume, subject to the health and persistence of Temporal and its dependencies.

A retried activity can repeat an external side effect. Idempotency keys, approval for high-impact actions, and safe retry policies belong at the integration boundary.

Data and observability

S3-compatible storage holds large artifacts; Run status can carry artifact names, URIs, sizes, and hashes instead of inlining output. The broader platform has document, vector, and graph stores for state and memory; configure the dependencies needed by the features you use and define retention and access policies for each store.

Inspect Run conditions and correlated timeline events alongside structured component logs and metrics when diagnosing failures. Model or tool output may be sensitive; restrict what is recorded and who can view operational data.

Follow the execution path

  • Define an Agent, a compatible ModelEndpoint, and only the MCP servers and Tools that this workload needs.
  • Create a Run targeting an Agent or Team. For reusable multi-step work, define Tasks and Process steps and configure the execution path supported by your deployment.
  • Inspect Run status, the tool timeline, and any approval wait before retrying. Verify the installed chart and runtime version if a documented capability is unavailable.

Read the source

The public Kaigents repository contains the chart CRD schemas under charts/kaigents-operator/crds, additional source-side schemas under operator/manifests/crds, Rust runtime components under engine/crates/kaigents-core/src and engine/crates/kaigents-memory/src, and the Go Temporal workflow under temporal-adapter/internal/workflow. Use the installed chart schemas as the Kubernetes API contract rather than inferring deployable features from an architectural diagram.