Vega
Vega Capability Protocol

Capability lifecycle

The current Capability lifecycle is the Python Provider lifecycle. VCP does not define remote registration, discovery, availability events, heartbeats, or deregistration messages.

Concepts

  • Package validation: standalone validation of a package before Runtime use.
  • Provider initialization: initialize(context) prepares a loaded Provider.
  • Readiness: BaseCapabilityProvider is ready after successful initialization.
  • Health: health_check() reports Provider condition without side effects.
  • Shutdown: shutdown() releases Provider resources and stops execution.

Lifecycle

New
Initializing
Ready
Stopping
Stopped
Stopped / Failed → Initializing on re-init · Initializing → Failed on exception · Ready → Ready across execute or health_check

The Runtime validates a package, loads the declared Python entrypoint, enables and initializes the Provider, then evaluates its health. execute is valid only when the base Provider is ready. A failed initialization does not retain its initialization context. Shutdown cancels background tasks created through create_background_task before invoking on_shutdown.

Execution lifecycle

The SDK does not expose a remote execution state machine. During one direct execution call, a Provider MAY report progress through the injected reporter and then returns a result or raises an error. Runtime persistence and external task state are Runtime concerns, not a Provider wire contract.

sequence
Runtime → Provider : execute(request, context)
Provider → Provider : validate request and inputs
Provider → Runtime : progress callback (zero or more)
alt completed
Provider → Runtime : result
else failed or cancelled
Provider → Runtime : CapabilityError

Cancellation and recovery

The Runtime supplies a cancellation token and may call the optional CancellableProvider.cancel. The Provider SHOULD stop safely and raise CancellationCapabilityError when cooperative cancellation is observed.

Recovery is optional. A Provider that implements RecoveryCapableProvider can answer probe_execution(execution_id, external_ref) with observed facts. It MUST use unknown or unavailable when it cannot establish a fact and MUST NOT replay a non-idempotent action merely because the Runtime restarted.