ArkTeam

ArkTeam is the unified execution primitive for pipeline DAGs, dynamic delegation, and cross-team composition in ark-operator.

API: arkonis.dev/v1alpha1 Kind: ArkTeam Scope: Namespaced

ArkTeam defines a team of agents and how they work together. The execution mode is determined by which fields you set:

ModeWhenAnalogy
Pipelinespec.pipeline is setCI workflow — steps run in DAG order
DynamicNo spec.pipeline, roles use canDelegateOrg chart — agents decide at runtime who to call
MixedBoth setPipeline with per-step sub-delegation

Each time a pipeline ArkTeam is triggered, the operator creates an ArkRun — an immutable execution record that holds step outputs, token usage, and timestamps. The ArkTeam is the template; the ArkRun is what ran.


Quick examples

Pipeline (sequential DAG)

apiVersion: arkonis.dev/v1alpha1
kind: ArkTeam
metadata:
  name: blog-pipeline
  namespace: my-org
spec:
  output: "{{ .steps.editor.output }}"
  roles:
    - name: researcher
      model: llama3.2
      systemPrompt: "Research the topic thoroughly."
    - name: writer
      model: llama3.2
      systemPrompt: "Write a blog post from the research."
    - name: editor
      model: llama3.2
      systemPrompt: "Edit and polish the post."
  pipeline:
    - role: researcher
      inputs:
        prompt: "{{ .input.topic }}"
    - role: writer
      dependsOn: [researcher]
      inputs:
        research: "{{ .steps.researcher.output }}"
    - role: editor
      dependsOn: [writer]
      inputs:
        draft: "{{ .steps.writer.output }}"

Dynamic delegation (autonomous team)

apiVersion: arkonis.dev/v1alpha1
kind: ArkTeam
metadata:
  name: startup-team
  namespace: my-org
spec:
  entry: pm
  roles:
    - name: pm
      model: llama3.2
      systemPrompt: "You are the PM. Coordinate the team."
      canDelegate: [engineer, designer]
    - name: engineer
      arkAgent: engineer-agent
      canDelegate: []
    - name: designer
      arkAgent: designer-agent
      canDelegate: []

Roles

A role is a named position in the team. Each role is exactly one of three types:

A) Inline — the operator auto-creates an ArkAgent named {team}-{role}:

roles:
  - name: researcher
    model: llama3.2
    systemPrompt: "Research the topic thoroughly."
    limits:
      maxTokensPerCall: 8000

B) Reference to an existing ArkAgent:

roles:
  - name: writer
    arkAgent: my-writer-agent

C) Reference to another ArkTeam (cross-team composition — pipeline mode only):

roles:
  - name: legal-review
    arkTeam: legal-team   # the entire legal-team runs as a single step

Template expressions

Inputs and outputs are wired together with Go templates. The template context is populated as steps complete.

ExpressionResolves to
{{ .input.<key> }}Value from spec.input or the trigger payload
{{ .steps.<name>.output }}Raw output string from a completed pipeline step
{{ .steps.<name>.data.<field> }}Typed field from a step with outputSchema
{{ .roles.<name>.output }}Output from a dynamic role (dynamic mode only)

Role names must not contain hyphens — Go templates use .steps.<name> as a field accessor.


Conditional steps

Skip a step based on a previous step’s output:

- role: escalate
  dependsOn: [triage]
  if: "{{ .steps.triage.data.severity }}"
  inputs:
    issue: "{{ .steps.triage.output }}"

Loop steps

Repeat a step until a condition is met (or max iterations is reached):

- role: refine
  dependsOn: [draft]
  loop:
    condition: "{{ not .steps.refine.data.approved }}"
    maxIterations: 5
  inputs:
    draft: "{{ .steps.refine.output }}"

Typed output schemas

Instruct an agent to respond in a specific JSON format. Downstream steps access fields via .data.<field>:

- role: triage
  outputSchema: |
    {"type":"object","properties":{"severity":{"type":"string"},"summary":{"type":"string"}}}
  inputs:
    prompt: "Triage: {{ .input.issue }}"
- role: escalate
  dependsOn: [triage]
  if: "{{ eq .steps.triage.data.severity \"high\" }}"
  inputs:
    summary: "{{ .steps.triage.data.summary }}"

Run history

Each trigger creates a new ArkRun. Control how many are retained:

spec:
  successfulRunsHistoryLimit: 10   # default
  failedRunsHistoryLimit: 3        # default
  runRetainFor: "168h"             # also delete runs older than 7 days

Cross-team composition

# Sub-team handles legal review
apiVersion: arkonis.dev/v1alpha1
kind: ArkTeam
metadata:
  name: legal-team
  namespace: my-org
spec:
  entry: counsel
  roles:
    - name: counsel
      arkAgent: legal-counsel-agent
      canDelegate: [paralegal]
    - name: paralegal
      arkAgent: paralegal-agent
---
# Parent team references legal-team as a step
apiVersion: arkonis.dev/v1alpha1
kind: ArkTeam
metadata:
  name: product-team
  namespace: my-org
spec:
  output: "{{ .steps.legalreview.output }}"
  roles:
    - name: pm
      arkAgent: pm-agent
    - name: legalreview
      arkTeam: legal-team
  pipeline:
    - role: pm
      inputs:
        feature: "{{ .input.feature }}"
    - role: legalreview
      dependsOn: [pm]
      inputs:
        document: "{{ .steps.pm.output }}"

Spec reference

spec

FieldTypeRequiredDefaultDescription
roles[]RoleSpecyesNamed roles. Each is an inline agent, an ArkAgent ref, or an ArkTeam ref.
entrystringdynamic modeName of the role that receives the initial task. Required when spec.pipeline is absent.
outputstringnoGo template expression producing the team’s final result.
inputmap[string]stringnoDefault input values used when the team is triggered without explicit input.
pipeline[]PipelineStepnoDAG steps. Absent = dynamic delegation mode.
timeoutSecondsintno0Wall-clock timeout for the entire run. Zero means no timeout.
maxTokensintno0Hard token budget across all roles per run. Zero means no limit.
limits.maxDailyTokensint64no0Rolling 24-hour token cap. Scales all role replicas to 0 when hit; auto-resumes when the window rotates.
successfulRunsHistoryLimitint32no10Number of successful ArkRun records to retain.
failedRunsHistoryLimitint32no3Number of failed ArkRun records to retain.
runRetainFordurationnoMaximum age for completed ArkRun records. Example: "168h" (7 days).
notifyRefLocalObjectReferencenoName of an ArkNotify policy for team events.

spec.roles[] — inline role

FieldTypeDescription
namestringUnique role name within the team. No hyphens — used in template expressions.
modelstringLLM model ID.
systemPromptstringInline system prompt.
systemPromptRefSystemPromptSourceReference to a ConfigMap or Secret key.
mcpServers[]MCPServerSpecMCP tool servers. Same structure as ArkAgent.spec.mcpServers.
tools[]WebhookToolSpecInline HTTP webhook tools.
replicasintNumber of parallel workers on this role’s queue.
limitsAgentLimitsPer-call token limit, timeout, and concurrency.
canDelegate[]stringRoles this role may delegate to at runtime.

spec.roles[] — ArkAgent reference role

FieldTypeDescription
namestringUnique role name.
arkAgentstringName of an existing ArkAgent in the same namespace.
canDelegate[]stringRoles this role may delegate to.

spec.roles[] — ArkTeam reference role

FieldTypeDescription
namestringUnique role name.
arkTeamstringName of another ArkTeam. The entire sub-team runs as a single step.

canDelegate values

ValueMeaning
omit or []Pure worker — no delegate() tool injected.
["role-a", "role-b"]Can only delegate to these roles. Validated at deploy time.
["*"]Fully autonomous — can delegate to any role in the team.

spec.pipeline[]

FieldTypeRequiredDescription
rolestringyesName of a role in spec.roles.
inputsmap[string]stringnoKey-value inputs. Values are Go template expressions.
dependsOn[]stringnoStep role names that must complete before this step runs.
ifstringnoGo template expression. Step is skipped when falsy.
loopLoopSpecnoRepeat this step until the condition is false or max iterations reached.
outputSchemastringnoJSON Schema (raw string). Enables {{ .steps.<name>.data.<field> }}.

spec.pipeline[].loop

FieldTypeDefaultDescription
conditionstringGo template expression. Repeats while truthy.
maxIterationsint10Hard cap. Range: 1–100.

status

ArkTeam.status reflects infrastructure state. Step-level execution detail lives on the ArkRun.

FieldTypeDescription
phasestringPending | Ready | Running | Succeeded | Failed
lastRunNamestringName of the most recently created ArkRun.
lastRunPhasestringPhase of the most recent ArkRun.
roles[]RoleStatusInfrastructure state per role.
entryRolestringEntry role name (dynamic mode).
serviceNamestringAuto-created ArkService name (dynamic mode).
observedGenerationint64The .metadata.generation this status reflects.
conditions[]ConditionReady.

status.roles[]

FieldTypeDescription
namestringRole name.
readyReplicasint32Agent pods currently passing readiness checks.
desiredReplicasint32Configured replica count for this role.
managedArkAgentstringName of the auto-created ArkAgent for inline roles.

See also