Skip to content

agent-orca CRDs ​

agent-orca uses fifteen Custom Resource Definitions (CRDs) that form a layered model: from raw LLM endpoints at the bottom to long-running agent services at the top.


CRD Overview ​

Objects created in the UI are owned by the UI, and objects a GitOps tool tracks are owned by Git. Argo CD, Flux and Helm writes to UI-owned objects are denied by a webhook. See GitOps and the UI.

graph TD
    MP[ModelProvider<br/>Registers and authenticates into an LLM endpoint] --> MS[ModelSelector<br/>Routes across providers]
    T[Tool<br/>Capability unit] --> A[Agent<br/>Reusable template]
    MS --> A
    KB[KnowledgeBase<br/>RAG vector store + ingestion] --> A
    A --> AR[AgentRun<br/>One-time execution]
    A --> AD[AgentDeployment<br/>Long-running service]
    A --> AW[AgentWorkflow<br/>Declarative DAG of steps]
    SCH[AgentSchedule<br/>Starts runs on a clock] -->|creates on each tick| AR
    GP[GuardrailPolicy<br/>Content filtering] --> A
    MCPS[MCPServer<br/>External MCP servers] -->|creates| T
    SC[SandboxClass<br/>Admin-set sandbox profile] -->|constrains| A
    TC[TenantConfig<br/>External auth, quotas, visibility] -.->|scopes access to| A
    RB[RoutingBenchmark<br/>Shadow-samples and judges routing] -->|measures| A
    RB -->|evidence for| RR[RoutingRecommendation<br/>Reviewed ModelSelector patch]
    RR -->|patches| MS

    AD -->|each input message spawns| AR
    AR -->|agent-type tool spawns child| AR
    AW -->|controller creates one per step| AR

    AR -->|spawns| Pod1[Pod<br/>agent + model-router sidecar]
    AD -->|manages| Dep[Deployment<br/>agent + model-router replicas]

    Pod1 -->|checkpoints state| CS[(Checkpoint Store)]
    Dep -->|checkpoints state| CS
    KB -->|auto-deploys| QD[(Qdrant)]
    AR -->|archives completed runs| PG[(PostgreSQL)]
    Pod1 -->|recall / retain memory| HS[(Hindsight)]
    Pod1 -->|runtime.sandbox| OS[OpenShell sandbox]

    classDef crd fill:#dbeafe,stroke:#2563eb,color:#1e3a8a
    classDef infra fill:#f3f4f6,stroke:#6b7280,color:#374151
    class MP,MS,T,A,AR,AD,AW,KB,GP,MCPS,SC,TC,RB,RR,SCH crd
    class Pod1,Dep,CS,QD,PG,HS,OS infra

1. ModelProvider ​

Purpose: Registers a single LLM endpoint (e.g., a specific Claude or GPT-4 model) with its credentials, cost, and capabilities.

Key fields:

FieldDescription
litellmModelLiteLLM model string, e.g. anthropic/claude-sonnet-4-6
baseURLOptional API endpoint override for self-hosted models (e.g. http://ollama.svc:11434)
credentialsRefSecretKeyRef pointing to the API key
capabilitiesTags: reasoning, code, vision, fast, long-context, cheap, embedding
constraintsContext window, max output tokens, cost per million tokens
latencyProfilefast, medium, or slow

Status: Sets a ready boolean and re-validates every 5 minutes.

yaml
apiVersion: agentorca.agentorca.io/v1alpha1
kind: ModelProvider
metadata:
  name: claude-sonnet
spec:
  litellmModel: anthropic/claude-sonnet-4-6
  credentialsRef:
    name: anthropic-secret
    key: ANTHROPIC_API_KEY
  capabilities: [reasoning, code, vision]
  latencyProfile: medium
  constraints:
    costPerMillionInputTokens: "3.00"
    costPerMillionOutputTokens: "15.00"

2. ModelSelector ​

Purpose: Routes LLM calls across one or more ModelProviders using weights, fallback chains, capability routing, and optional LLM-based meta-routing.

Key fields:

FieldDescription
strategyrule-based (default), llm-meta, hybrid, or switchyard
providersList of {name, weight} for probabilistic routing
fallbackChainOrdered providers to try on 429/5xx errors
budgetCapMax USD spend perRun and/or perDay
capabilityRoutingMap of capability tag → provider name. The keys capable, efficient, judge and subagent.<group> are roles for switchyard, not keyword tags
metaRouterConfig for the LLM that decides routing (llm-meta/hybrid)
switchyardThe Switchyard algorithm spec for strategy: switchyard; required for it and rejected otherwise. See Switchyard routing

Status: conditions (ProvidersResolved, SwitchyardValid, Ready), observedGeneration, and activeProviders (the selector's providers that exist and are Ready).

yaml
apiVersion: agentorca.agentorca.io/v1alpha1
kind: ModelSelector
metadata:
  name: default
spec:
  strategy: rule-based
  providers:
    - name: claude-sonnet
      weight: 70
    - name: openai-gpt4o
      weight: 30
  fallbackChain: [openai-gpt4o, claude-sonnet]
  budgetCap:
    perRun: "0.50"
  capabilityRouting:
    reasoning: claude-sonnet
    fast: openai-gpt4o

3. Tool ​

Purpose: Defines a capability that an agent can invoke — a function, another agent, an MCP server, or a WASM module.

Types:

TypeDescriptionRequired
regularOCI image run as a pod or sidecarociRef
agentAnother Agent exposed as a toolagentRef
mcpModel Context Protocol servermcpConfig
wasmWASM module run inside model-routerociRef

Execution modes:

ModeIsolationLatencyState
podHigh — fresh pod per callHighStateless
sidecarMedium — shares agent podLowStateful
wasmLow — in-processVery lowStateless

Key fields:

FieldDescription
schemaJSON Schema description, input, output shown to the LLM
networkEgressAllowlisted outbound hosts/ports
sideEffectread, write or actuate: what a call changes, so a GuardrailPolicy can require approval before it runs. See Tool side effects
cloudAuthTool-specific cloud identity (GCP/AWS/Azure)
yaml
apiVersion: agentorca.agentorca.io/v1alpha1
kind: Tool
metadata:
  name: web-search
spec:
  type: regular
  executionMode: sidecar
  ociRef: ghcr.io/myorg/web-search-tool:latest
  schema:
    description: Search the web for current information
    input:
      type: object
      properties:
        query: {type: string}
  networkEgress:
    - host: "*.googleapis.com"
      port: 443

4. Agent ​

Purpose: A reusable, versioned agent template. Binds together a runtime image, a model routing strategy, and a set of tools.

Key fields:

FieldDescription
modelSelectorRefWhich ModelSelector to use for LLM calls
toolsNames of Tool resources available to this agent
systemPromptSystem instruction prepended to every conversation
runtime.ociRefOCI image (must be Cosign-signed)
runtime.frameworkopenai-compatible, autogen, semantic-kernel, langgraph, shim
runtime.shimTargetHostname to intercept when framework=shim
runtime.sandboxRun the agent in an NVIDIA OpenShell sandbox with a shell, exec and policy-controlled egress (see openshell-sandbox.md)
runtime.localToolsLet the agent process run the tools it declares (e.g. a shell in its sandbox): the router returns their calls with finish_reason: tool_calls and takes the results on the next request (see agent-run-tools.md)
runtime.harnessMarks the agent process as a coding-agent CLI (claude-code) so the operator reads its output stream into the run's trace: tool calls and results, token usage and subscription use. The CLI must run with --output-format stream-json --verbose. Requires runtime.sandbox (see claude-code-subscription.md)
shellGive the agent a sandbox_exec tool that runs shell commands in a per-run OpenShell sandbox governed by the named SandboxClass (see sandbox-shell.md): classRef, image, workDir, maxTimeoutSeconds
runtime.sandbox.classRefA cluster-scoped SandboxClass: egress presets and rules, filesystem, resource defaults, placement and minimum enforcement the Agent adds to but cannot weaken, and the credentials (GitHub token, API keys) its sandboxes can use but never read
memory.checkpointEveryLLM turns between checkpoints (default: 1)
memory.resumeWindowSecondsState retention after failure (default: 3600)
memory.archiveOnCompletionPromote checkpoint to object storage on success
memory.episodicSummaryEverySummarize conversation every N turns to compress context (0 disables)
memory.summaryModelSelectorRefModelSelector for summarization calls (defaults to agent's own)
memory.longTermMemoryRefKnowledgeBase name for persistent cross-session memory
memory.hindsightOpt-in hindsight memory: recall before each LLM call and retain each turn, in one bank per Agent (bankIdTemplate, default {namespace}--{agent-name}), up to recallBudget memories (default 5) within recallMaxTokens (default 1024). Off unless set; enabled defaults to true once the block is present
knowledgeBasesKnowledgeBase names; injects _rag_search / _rag_ingest tools
guardrailPolicyRefGuardrailPolicy name for input/output content filtering
cloudAuthCloud identity for the agent's SA (GCP/AWS/Azure)

Framework tiers:

TierFrameworkHow the model endpoint is injected
1openai-compatibleOPENAI_BASE_URL=http://localhost:8080
2autogen / semantic-kernelOAI_CONFIG_LIST via init container
3langgraphLANGGRAPH_CHECKPOINT_URL
Shimshim/etc/hosts interception of shimTarget

What the controller does: Creates and manages a stable ServiceAccount (agentorca-agent-<name>) and annotates it for cloud identity federation.

yaml
apiVersion: agentorca.agentorca.io/v1alpha1
kind: Agent
metadata:
  name: hello-agent
spec:
  modelSelectorRef: default
  tools: [web-search]
  systemPrompt: "You are a helpful assistant."
  runtime:
    ociRef: ghcr.io/myorg/my-agent:latest
    framework: openai-compatible
  memory:
    checkpointEvery: 5
    resumeWindowSeconds: 3600
    archiveOnCompletion: true

5. AgentRun ​

Purpose: A single, one-shot execution of an Agent. The primary way to run an agent for a specific task.

Key fields:

FieldDescription
agentRefName of the Agent to run
inputTask description passed via AGENTORC_INPUT
timeoutMax duration (default: 5 min)
callbacksWebhook URLs for onComplete / onFailed
restartPolicy.maxRetriesRetry count on failure (default: 3)
parentRunRefParent AgentRun when this is spawned as a sub-agent tool
priorRunRefPrevious AgentRun in a chat session; loads its conversation checkpoint for continuation
safeguardsLoop detection limits. Defaults apply when unset: maxRepeatedToolCalls 50 (same tool + identical arguments), maxConsecutiveNoopTurns 15 (not for chat runs), toolFrequencyCap off. A negative value disables a check. A trip fails the run without retrying it.
budgetA cap on the run's model spend in USD (maxUSD). A warning at warnAtPercent (default 80); at the cap the run fails (onExceeded: fail, the default) or pauses until an approver raises the cap (onExceeded: pause). See Run budgets. Unlike the ModelSelector's budgetCap, which only steers routing toward cheaper models, this one is enforced.
egressResult egress sink configuration (optional)

Egress configuration (optional):

When spec.egress is set, the controller publishes the final EgressResult to the specified sink when the AgentRun reaches a terminal phase (Succeeded, Failed, or HandedOff). This is useful for streaming results to downstream systems (e.g., a chat backend, analytics pipeline, or event bus).

FieldDescription
typekafka, pubsub, or redis
topicTopic/stream name (Kafka topic, Pub/Sub topic, or Redis stream key)
projectIDGCP project ID (Pub/Sub only)
brokersKafka broker addresses (Kafka only)
addressRedis address (Redis only)
secretRefSecretKeyRef pointing to sink credentials

Secret key conventions:

SinkSecret keys
Kafkasasl-username, sasl-password, sasl-mechanism, tls-cert, tls-key, tls-ca
Pub/Subcredentials (service account JSON blob)
Redispassword
yaml
apiVersion: agentorca.agentorca.io/v1alpha1
kind: AgentRun
metadata:
  name: hello-run
spec:
  agentRef: hello-agent
  input: "Say hello to the world"
  egress:
    type: kafka
    topic: agent-results
    brokers:
      - kafka-cluster-kafka-bootstrap.kafka:9092
    secretRef:
      name: kafka-creds
      key: sasl-password
      namespace: default

Metrics:

MetricDescription
agentorca_egress_published_totalCounter of successfully published results
agentorca_egress_failed_totalCounter of failed publishes

Phase lifecycle:

stateDiagram-v2
    [*] --> Pending: AgentRun created
    Pending --> Running: Pod + RBAC + NetworkPolicy created
    Running --> Succeeded: Pod exits 0
    Running --> Failed: Pod exits non-0 AND retries exhausted
    Failed --> Pending: Retry (restartCount < maxRetries)
    Running --> HandedOff: Agent delegates to another agent
    Running --> WaitingForInput: Agent calls _clarify
    WaitingForInput --> [*]: Continuation AgentRun created on human answer
    Succeeded --> [*]
    HandedOff --> [*]
    Failed --> [*]: max retries reached

What the reconciler creates per run:

graph LR
    AR[AgentRun] -->|creates| Pod
    AR -->|creates| Role
    AR -->|creates| RoleBinding
    AR -->|creates| CRB[ClusterRoleBinding<br/>TokenReviewer]
    AR -->|creates| NP[NetworkPolicy]
    AR -->|creates| CM[RouterConfig<br/>ConfigMap]
    AR -->|creates| TS[TokenSecret]

    Pod -->|contains| AC[agent container]
    Pod -->|contains| MR[model-router<br/>sidecar :8080/:8081/:8082]

    style AR fill:#dbeafe,stroke:#2563eb

Status fields of note:

FieldDescription
phaseCurrent lifecycle phase
spendUSDCumulative USD spend for this run
outputNot written on new runs: the answer is kept in the state store and the archived run, and the API returns it. Set only on older runs and on a run whose answer could not be stored (clipped to 10 KB)
routingDecisionsThe most recent 100 model selection choices (provider, strategy, reason, confidence, decision ID, deciding path, task stage). routingDecisionsTotal counts every decision, including those that rolled off.
childRunRefsSub-agent AgentRuns spawned via tools
checkpointRefStorage key for conversation state
clarifyQuestionQuestion posed to the human when phase is WaitingForInput
clarifyAnswerHuman's response submitted via the UI
continuationRunRefFollow-up AgentRun created after the human answers
loopDetectedSet when a safeguard (loop detection) tripped and halted the run
failureReasonHuman-readable reason the run failed

6. AgentDeployment ​

Purpose: Keeps an agent running continuously, accepting a stream of inputs from a chat API, message queue, or pubsub topic.

Key fields:

FieldDescription
agentRefAgent template to deploy
replicasPod replicas (default: 1)
inputSource.typechat (default), queue, pubsub, or loop
inputSource.configProvider-specific config (Redis, Kafka, etc.)
restartPolicy.minBackoffSecondsMin restart delay (default: 5s)
restartPolicy.maxBackoffSecondsMax restart delay (default: 300s)
restartPolicy.maxConsecutiveFailuresPause threshold (default: 10, 0=unlimited)
checkpointTTLCheckpoint retention (default: 30 days)
warmPoolSizePre-warmed idle pods to keep ready (default: 1, set to 0 to disable)
maxRequestsPerPodRequest cap before a warm pod is recycled (default: 0 = reuse indefinitely)
warmPodMaxAgeMax age of a warm pod before recycle (default: 0 / indefinite; set to a positive duration to opt into age recycling — pods are recycled once they exceed this age)
recycleOnConfigDriftRecycle warm pods when the router config changes (default: true; set false to keep pods alive across config changes)

Phase lifecycle:

stateDiagram-v2
    [*] --> Creating: AgentDeployment created
    Creating --> Running: Deployment ready
    Running --> Failed: Pod crash
    Failed --> Running: Backoff + restart
    Running --> Paused: consecutiveFailures > threshold
    Paused --> Running: Manual intervention

Warm pod recycling (observability): A warm pod is recycled — and the reason emitted as a WarmPodRecycled Kubernetes Event on the deployment (kubectl describe deployment <name>), plus recorded in status.warmPoolLastRecycleReason / status.warmPoolLastRecycleAt) — when any of the following fires:

  • terminal-phase — the pod's process exited (PodSucceeded/PodFailed).
  • token-age-expired — the pod exceeded warmPodMaxAge (only fires when a positive warmPodMaxAge is set; default is indefinite, so this never fires unless the user opts in).
  • stale-config — the router config hash changed (agent/providers/tools/KBs/guardrails); skip by setting recycleOnConfigDrift: false.
  • request-cap-<N> — the pod served maxRequestsPerPod runs.

Note on HTTP/chat-mode warm pods: when the agent's HTTP handler responds, the run is marked complete and the pod is returned to the idle pool for reuse (not destroyed), so warm pods survive across chat turns. The model-router waits up to 30 minutes (configurable via httpInput.timeoutSeconds) for the agent's HTTP handler to respond — the previous 60s hard-cap was too short for long-trajectory tasks and could kill an in-progress session.

Warm pods run indefinitely by default (no age recycle). To keep a warm pod truly independent of config changes too, set recycleOnConfigDrift: false (with the default maxRequestsPerPod: 0). The pod is then only recycled if its agent process exits, it hits the request cap, you delete it, or you opt into age recycling via a positive warmPodMaxAge.


7. KnowledgeBase ​

Purpose: Provides native RAG (Retrieval-Augmented Generation) by managing a vector store, embedding pipeline, and document ingestion. Auto-deploys a namespace-shared Qdrant instance.

Key fields:

FieldDescription
vectorStore.providerqdrant (only supported provider)
vectorStore.collectionNameQdrant collection name (defaults to CR name)
vectorStore.storageSizePVC size for Qdrant (default 10Gi)
embedding.modelSelectorRefModelSelector for /v1/embeddings calls
embedding.dimensionsVector size (must match model, e.g. 768 or 1536)
embedding.chunkSizeTokens per chunk (default 512)
embedding.chunkOverlapOverlap tokens between chunks (default 64)
ingestion.configMapRefsConfigMaps to ingest as documents
ingestion.urlsURLs to fetch and ingest
ingestion.s3S3-compatible object storage source (bucket, prefix, region, endpoint, secretRef)
ingestion.mcpMCP servers to fetch documents from via Jobs
ingestion.networkEgressExtra egress ports allowed for ingestion Job pods
ingestion.syncIntervalSecondsPeriodic re-ingestion (0 = one-shot)

What the controller does:

  1. Auto-deploys a namespace-shared Qdrant StatefulSet + headless Service
  2. Creates the collection with the configured dimensions and cosine distance
  3. Launches mcp-ingester Kubernetes Jobs for all ingestion (ConfigMaps, URLs, S3, MCP) — the Jobs detect document types (PDF, DOCX, PPTX, XLSX, HTML, text), extract text, chunk, embed, and write vectors directly to Qdrant, keeping ingestion CPU work out of the operator
  4. Ensures the ingester ServiceAccount/Role/RoleBinding and an egress NetworkPolicy for ingestion Job pods in the KB's namespace (additive, so it is safe in namespaces without default-deny and required in namespaces with it)
  5. Sets status.ready = true with document/chunk counts

Agent integration: Add KnowledgeBase names to Agent.spec.knowledgeBases. The operator injects _rag_search and _rag_ingest as built-in tools.

yaml
apiVersion: agentorca.agentorca.io/v1alpha1
kind: KnowledgeBase
metadata:
  name: project-docs
spec:
  vectorStore:
    storageSize: "5Gi"
  embedding:
    modelSelectorRef: local-embeddings
    dimensions: 768
    chunkSize: 256
  ingestion:
    configMapRefs:
      - name: documentation

See docs/rag.md for the full RAG guide including local development setup.


8. GuardrailPolicy ​

Purpose: Defines content filtering rules applied by the model-router sidecar to agent inputs (user messages before reaching the LLM) and outputs (LLM responses before reaching the caller). Referenced from Agent.spec.guardrailPolicyRef.

Key fields:

FieldDescription
inputFiltersFilters applied to every user message before it is sent to the LLM
outputFiltersFilters applied to every LLM response before it is returned to the agent/caller
toolApprovalWhat each tool side-effect class needs before a call runs: none, approve or deny, with approver groups and a timeout. actuate tools need approval by default. See Tool side effects

Each filter has:

FieldDescription
nameHuman-readable identifier (appears in logs)
typeregex, keyword-blocklist, or topic-validation
actionredact (replace match), block (reject message), or warn (log and allow)
patternsFor regex: list of {name, pattern, replacement} entries
keywordsFor keyword-blocklist: inline list of strings
allowedTopicsFor topic-validation: list of topic strings (simple keyword overlap)
blockMessageMessage returned to caller when action: block

How it is applied: The controller reads agent.spec.guardrailPolicyRef, fetches the GuardrailPolicy CR, and serialises it into the router ConfigMap as guardrails. On startup the model-router builds a GuardrailPipeline from that config. Every request passes through ApplyInput before the LLM call and ApplyOutput before the response is returned. If any filter blocks, the router returns 400 with the blockMessage.

Wiring in Agent:

yaml
apiVersion: agentorca.agentorca.io/v1alpha1
kind: Agent
metadata:
  name: ehr-meds-agent
spec:
  modelSelectorRef: ehr-clinical
  guardrailPolicyRef: ehr-phi-redact   # <── references GuardrailPolicy below
  ...

PHI redaction example :

yaml
apiVersion: agentorca.agentorca.io/v1alpha1
kind: GuardrailPolicy
metadata:
  name: ehr-phi-redact
spec:
  inputFilters:
    - name: phi-redact
      type: regex
      action: redact
      patterns:
        - name: ssn
          pattern: '\b\d{3}-\d{2}-\d{4}\b'
          replacement: "[SSN REDACTED]"
        - name: mrn
          pattern: '\bMRN[:\s#]*\d{4,10}\b'
          replacement: "[MRN REDACTED]"
        - name: dob
          pattern: '\b(0?[1-9]|1[0-2])/(0?[1-9]|[12]\d|3[01])/(\d{2}|\d{4})\b'
          replacement: "[DOB REDACTED]"
        - name: npi
          pattern: '\bNPI[:\s#]*\d{10}\b'
          replacement: "[NPI REDACTED]"
  outputFilters:
    - name: phi-redact
      type: regex
      action: redact
      patterns:      # same patterns — enforced independently on output
        - name: ssn
          pattern: '\b\d{3}-\d{2}-\d{4}\b'
          replacement: "[SSN REDACTED]"
        - name: mrn
          pattern: '\bMRN[:\s#]*\d{4,10}\b'
          replacement: "[MRN REDACTED]"
        - name: dob
          pattern: '\b(0?[1-9]|1[0-2])/(0?[1-9]|[12]\d|3[01])/(\d{2}|\d{4})\b'
          replacement: "[DOB REDACTED]"
        - name: npi
          pattern: '\bNPI[:\s#]*\d{10}\b'
          replacement: "[NPI REDACTED]"

Why both input and output filters? Input filtering enforces data minimisation — PHI never reaches the LLM. Output filtering catches PHI the LLM may reconstruct or hallucinate from other context. The two are independent enforcement boundaries.


9. AgentWorkflow ​

Purpose: A declarative DAG of steps. The controller creates one AgentRun per agent step, runs container and approval steps itself, and enforces a budget across the whole workflow. See agentworkflow.md.

Key fields:

FieldDescription
modeworkflow (default) runs. template is validated but never run; workflows are created from it with fromTemplate
parametersTyped inputs of a template (type, required, default, enum, pattern, maxLength)
fromTemplateTemplate name plus parameters to instantiate
stepsSteps with name, type (agent, container or approval), agentRef, input, dependsOn, CEL condition, timeout, callbacks and an optional loop
sandboxA shared sandbox (image, classRef, repo, ref, branch, push) that steps can run in
budgetCapSpend cap across all steps
timeout, onStepFailureWhole-workflow deadline and failure policy
adaptivePolicyLets agents propose extra steps: maxDynamicSteps, allowedAgentRefs, allowLoops, maxLoopIterations, requireApprovalForUnlisted

10. MCPServer ​

Purpose: Declares an external Model Context Protocol server and creates a child Tool for each tool it exposes. See mcp-access-control.md.

FieldDescription
transportstdio (sidecar), http or sse
url / ociRefWhere an HTTP/SSE server lives, or the image for a stdio server
args, env, envFromProcess arguments and environment
authBearer-token or OAuth authentication for HTTP/SSE servers
toolsDeclared tools (name, description, inputSchema); discoverability, includePatterns and excludePatterns control discovery
allowedAgentsAgents allowed to use the server
networkEgress, resourcesNetwork rules and resource limits
allowAppsAllow MCP apps

Status reports ready, discovering, toolCount and conditions.


11. TenantConfig ​

Purpose: Enterprise authentication and authorization for the ACP API and External Task API. It sets which agents and namespaces a tenant can see and use.

Each tenant also gets a generated ID (status.tenantID) that isolates its objects and data. See Tenant isolation.

FieldDescription
authModeissued (OAuth2 client credentials) or federated (OIDC)
issuedclientID and clientSecretRef
federatedissuerURL, clientID, matchClaim/matchValue, redirectURI, scopes and claimMappings (user ID, groups, email)
allowedNamespacesNamespaces the tenant may reach
allowedAgentsAgents visible to the tenant. Discovery is limited to this list
rateLimitrequestsPerMinute and concurrentRuns
budgetPerDayUSDDaily spend cap

12. SandboxClass ​

Purpose: A reusable, cluster-scoped sandbox profile set by cluster admins for Agents with runtime.sandbox (see openshell-sandbox.md). Agents cannot weaken it.

FieldDescription
namespaceSelectorNamespaces whose Agents may use the class. Empty means all
enforcementMinimum network enforcement. With enforce, an Agent cannot weaken it to audit
egressPresetsVetted read-only host lists (pypi, crates, maven, github-read, mise, and others)
egressExtra rules: host, port, binaries, paths
filesystem, resourcesFilesystem policy and resource limits
nodeSelector, tolerations, runtimeClassName, priorityClassNamePlacement
approvalProposed rules for unlisted hosts: approverGroups, timeout, autoApprove rules
credentialsSecrets sandboxes may use without holding. The sandbox sees a placeholder and the supervisor swaps in the real value only on the bound endpoint. Sources: githubApp or secretRef. Max 16

13. RoutingBenchmark ​

Purpose: Measures whether routing choices are worth their cost. It replays a sample of an Agent's calls on another model, has a judge compare the two answers, and accumulates evidence per Agent across runs, deployments and workflow steps.

FieldDescription
agentRefs / agentSelectorAgents to benchmark. One is required; an empty selector matches every Agent
modereportOnly (default) or proposeApply, which raises an approval request and needs approverGroups
shadowShadow sampling: enabled, sampleRate, arms, providers, maxPerRun, maxPerHour, excludeRunSelector, includeToolTurns
judgeproviderRef, positionSwap, rubric, maxTokens. Required when shadow sampling is on
budgetperDayUSD and perRunUSD caps on shadow spend
evaluationwindow, interval, minSamples, groupBy, confidenceLevel, nonInferiorityMargin
thresholdsminNetWinDelta, maxUSDPerNetWin, deadProviderErrorRate
storeTranscriptsKeep sampled transcripts

Status reports sampled calls, judged pairs, judge inconsistency, spend today, budgetExhausted, matched Agents and per-category results.


14. RoutingRecommendation ​

Purpose: A change to a ModelSelector that benchmark and passive evidence support. The operator proposes it; a person decides. Everything except action is immutable.

FieldDescription
selectorRefThe ModelSelector it concerns
benchmarkRefSource benchmark. Empty when it rests on passive data alone
detectoroverspend, underpowered, threshold, deadProvider or strategySwitch
agent, categoryWhat the finding is about. Empty for the selector as a whole
summary, reason, caveatHuman-readable explanation
patch / rollbackPatchThe change and the patch that undoes it
baseGenerationThe ModelSelector generation it was made against
actionnone, requestApply or rollback. The only mutable field

Status phase is one of Proposed, PendingApproval, Applied, Rejected, Stale, Superseded, RolledBack or Expired. After an apply, postApply.verdict is Confirmed, Regressed, Inconclusive or NotAssessed.


15. AgentSchedule ​

Purpose: Starts an agent on a clock, like a Kubernetes CronJob starts a Job. Each tick creates an ordinary AgentRun that the schedule owns. Short name asched. See Scheduled runs.

FieldDescription
agentRefThe Agent to run, in the schedule's namespace. Exactly one of agentRef and workflowTemplateRef
workflowTemplateRefAn AgentWorkflow with mode: template. Each tick creates a workflow from it
scheduleFive-field cron expression, or @hourly, @daily, @weekly, @monthly
timeZoneIANA name, default UTC. A wall-clock time in a daylight-saving gap is skipped; one that occurs twice fires once
input / parametersThe run input, or the template parameters. {{schedule.time}}, {{schedule.date}} and {{schedule.name}} are the only placeholders
concurrencyPolicyForbid (default), Allow or Replace
startingDeadlineSecondsHow late a missed tick may still start. Default 3600
successfulRunsHistoryLimit, failedRunsHistoryLimitFinished runs kept. Default 7 each
suspendStops new runs. Runs in flight are untouched
timeout, budget, safeguards, resultCopied onto every created run
spendA cap for the schedule as a whole, per day and per month

Status carries lastScheduleTime, nextScheduleTime, active, consecutiveFailures, the last ten skipped ticks, spend today and this month, and the conditions Ready, Suspended, BudgetExhausted, TargetMissing and Degraded.


How They All Fit Together ​

flowchart TD
    subgraph Configuration["Configuration Layer"]
        MP1[ModelProvider A]
        MP2[ModelProvider B]
        T1[Tool: web-search]
        T2[Tool: sub-agent]
    end

    subgraph Routing["Routing Layer"]
        MS[ModelSelector<br/>weights + fallback + budget]
    end

    subgraph Template["Template Layer"]
        A[Agent]
    end

    subgraph Execution["Execution Layer"]
        AR[AgentRun<br/>one-shot task]
        AD[AgentDeployment<br/>always-on service]
    end

    subgraph Runtime["Runtime per pod"]
        AC[Agent Container<br/>framework code]
        MR[model-router sidecar<br/>:8080 OpenAI<br/>:8081 executor<br/>:8082 Gemini]
    end

    MP1 & MP2 --> MS
    T1 & T2 --> A
    MS --> A
    A --> AR & AD
    AD -->|each chat/queue msg spawns| AR
    AR -->|agent-type tool spawns child| AR
    AR & AD -->|reconciler spawns| AC & MR
    AC -->|OPENAI_BASE_URL=localhost:8080| MR
    MR -->|routes to| MP1 & MP2
    MR -->|executes| T1 & T2
    MR -->|checkpoints| CS[(Checkpoint Store)]

Request flow for a single AgentRun ​

sequenceDiagram
    participant User
    participant K8s as Kubernetes API
    participant R as AgentRunReconciler
    participant Pod as Agent Pod
    participant MR as model-router sidecar
    participant LLM as LLM Provider

    User->>K8s: kubectl apply AgentRun
    K8s->>R: reconcile loop triggered
    R->>K8s: create Role, RoleBinding, NetworkPolicy
    R->>K8s: create RouterConfig ConfigMap
    R->>K8s: create TokenSecret
    R->>K8s: create Pod (agent + sidecar)
    K8s->>Pod: schedule Pod

    loop agent execution
        Pod->>MR: POST /v1/chat/completions
        MR->>MR: TokenReview (validate SA token)
        MR->>MR: select provider via ModelSelector strategy
        MR->>LLM: forward request
        LLM-->>MR: response
        MR->>MR: checkpoint conversation state
        MR-->>Pod: return response
    end

    Pod-->>K8s: exit 0
    K8s->>R: reconcile (pod completed)
    R->>K8s: update AgentRun status (Succeeded, spend, output)
    R->>K8s: cleanup ClusterRoleBinding, TracingPolicy

Security Model ​

Ownership of UI-managed kinds, and how Git and the UI avoid overwriting each other, is covered in GitOps and the UI. Tenant boundaries are in Tenant isolation.

Every AgentRun/AgentDeployment enforces:

  • Pod Security: restricted PSA profile
  • Network isolation: default-deny NetworkPolicy; egress only to allowlisted tool hosts
  • Short-lived tokens: projected ServiceAccount tokens with 15-minute TTL
  • Image signing: OCI images verified by Cosign before execution
  • Optional syscall auditing: Tetragon TracingPolicy attached per run
  • Optional sandboxing: agents with runtime.sandbox run in an OpenShell sandbox (Landlock, seccomp, per-host L7 egress) instead of a pod
  • Cloud identity federation: GCP Workload Identity, AWS IRSA, Azure Workload Identity via SA annotations

Quick Reference ​

CRDScopeLifespanOwned by
ModelProviderCluster-wide configPermanentPlatform team
ModelSelectorCluster-wide configPermanentPlatform team
ToolCluster-wide configPermanentPlatform/app team
AgentTemplatePermanentApp team
AgentRunExecutionUntil deletedApp / controller
AgentDeploymentExecutionUntil deletedApp team
AgentWorkflowOrchestrationUntil deletedApp team
KnowledgeBaseRAG configPermanentApp team
GuardrailPolicyContent filteringPermanentPlatform/security team
MCPServerTool sourcePermanentPlatform/app team
TenantConfigExternal auth and quotasPermanentPlatform team
SandboxClassCluster-scoped sandbox profilePermanentPlatform team
RoutingBenchmarkRouting evaluationPermanentPlatform team
RoutingRecommendationProposed ModelSelector changeUntil decidedOperator creates; platform team decides
AgentScheduleStarts runs on a clockUntil deletedApp team

Released under the Apache 2.0 License.