Execution

Runtime state tracking for an executing plan, including node progress and agent assignments.

Overview

Executions track the runtime state of a plan being executed. They record which nodes are in progress, completed, or blocked, and can track which agents are assigned to each node. Executions are typically created when a plan is started, and updated as execution progresses.

Schema

yaml
apiVersion: planspec.io/v1alpha1
kind: Execution
metadata:
  name: string          # Required, unique identifier
  namespace: string     # Required, resource namespace
  labels: object        # Optional, key-value pairs
  annotations: object   # Optional, metadata
spec:
  planRef:              # Required, reference to the plan being executed
    name: string        # Name of the plan
  goalRef:              # Optional, reference to the goal
    name: string        # Name of the goal
  bindingRef:           # Optional, reference to binding rules
    name: string        # Name of the binding
  nodeBindings:         # Optional, per-node binding overrides
    <nodeId>: object    # Node-specific binding configuration
  runtimeRef:           # Optional, reference to runtime environment
    name: string        # Name of the runtime
  parameters: object    # Optional, execution parameters
  context: object[]     # Optional, contextual attachments
status:
  phase: string         # Execution phase
  runId: string         # Unique run identifier
  reason: string        # Reason for current phase
  message: string       # Human-readable status message
  queuedTime: string    # When execution was queued
  startTime: string     # When execution started
  completionTime: string  # When execution completed
  lastPhaseTransitionTime: string  # Last phase change
  specHash: string      # Hash of the spec for tracking changes
  nodeStatuses:         # Per-node execution states (keyed by node ID)
    <nodeId>:
      phase: string     # Node execution phase
      startTime: string # When node started
      completionTime: string  # When node completed
      attempt: number   # Current attempt number
      outputs: object   # Node outputs
      message: string   # Status message
      extensions: object  # Extension data
  artifacts: object[]   # Execution artifacts
  conditions: object[]  # Status conditions
  extensions: object    # Extension data

Fields

Spec Fields

FieldTypeRequiredDescription
planRefobjectYesReference to the plan being executed
planRef.namestringYesName of the plan
goalRefobjectNoReference to the goal this execution achieves
goalRef.namestringYes*Name of the goal (*if goalRef provided)
bindingRefobjectNoReference to binding rules for capability resolution
bindingRef.namestringYes*Name of the binding (*if bindingRef provided)
nodeBindingsobjectNoPer-node binding overrides (keyed by node ID)
runtimeRefobjectNoReference to the runtime environment
runtimeRef.namestringYes*Name of the runtime (*if runtimeRef provided)
parametersobjectNoExecution parameters passed to nodes
contextobject[]NoContextual attachments for execution

Status Fields

FieldTypeDescription
phasestringOverall execution phase
runIdstringUnique identifier for this run
reasonstringMachine-readable reason for current phase
messagestringHuman-readable status message
queuedTimestringWhen execution was queued (ISO 8601)
startTimestringWhen execution started (ISO 8601)
completionTimestringWhen execution completed (ISO 8601)
lastPhaseTransitionTimestringLast phase transition timestamp
specHashstringHash of the execution spec
nodeStatusesobjectPer-node states, keyed by node ID
artifactsobject[]Artifacts produced during execution
conditionsobject[]Status conditions with details
extensionsobjectExtension data

Execution Phases

PhaseDescription
PendingExecution created but not started
RunningExecution in progress
BlockedExecution blocked (e.g., waiting for gate approval)
SucceededAll nodes completed successfully
FailedExecution failed
CancelledExecution was cancelled

Node Status Fields

FieldTypeDescription
phasestringNode execution phase
startTimestringWhen node execution started
completionTimestringWhen node execution completed
attemptnumberCurrent attempt number (for retries)
outputsobjectOutputs produced by the node
messagestringStatus message for the node
extensionsobjectNode-specific extension data

Node Phases

PhaseDescription
PendingNode not yet started
RunningNode currently executing
BlockedNode blocked by dependencies or gate
SucceededNode completed successfully
FailedNode execution failed
SkippedNode was skipped (conditional execution)
CancelledNode was cancelled

Example

yaml
apiVersion: planspec.io/v1alpha1
kind: Execution
metadata:
  name: user-auth-execution-001
  namespace: default
  labels:
    plan: user-auth-implementation
    environment: development
spec:
  planRef:
    name: user-auth-implementation
  goalRef:
    name: user-authentication
  bindingRef:
    name: development-bindings
  parameters:
    environment: development
    debug: true
status:
  phase: Running
  runId: "run-abc123"
  startTime: "2024-01-15T10:00:00Z"
  nodeStatuses:
    setup-database:
      phase: Succeeded
      startTime: "2024-01-15T10:00:00Z"
      completionTime: "2024-01-15T10:15:00Z"
      attempt: 1
      outputs:
        tableCreated: true
    implement-signup:
      phase: Running
      startTime: "2024-01-15T10:15:00Z"
      attempt: 1
    implement-login:
      phase: Running
      startTime: "2024-01-15T10:15:00Z"
      attempt: 1
    security-review:
      phase: Blocked
      message: "Waiting for dependent nodes to complete"
    implement-refresh:
      phase: Pending

JSON Schema

The full JSON Schema is available at: Execution Schema

Next Steps

  • Plan - Define the plan to execute
  • Gate - Add approval checkpoints to executions
  • Binding - Configure capability resolution