Skip to main content

Supervisor contract reference

This is contract version 1: the operations, signals, directives, causes and outcomes between a supervisor and its engine. Within a major version changes are additive only; a client must ignore fields and signal kinds it does not know. GET /api/supervisor-contract and the MCP tool get_supervisor_contract return the version and the operation names. Every response of the agent API carries the header Yukta-Supervisor-Contract: 1.

Layers

A supervisor has exactly one engine. An engine has no handle to the dispatcher, the stores or any core bean.

Command channels

A start has the workflow as its target, so the run-level owner of that workflow decides it. The default supervisor’s engine is operator-gateway: the REST, MCP, CLI and UI endpoints unchanged. With yukta.supervisor.default.enabled=false an unowned unit cannot be controlled by anyone.

Delegation

A supervisor lists parents. A parent never sends commands for its children’s units; it answers what is delegated to it. The default timeout per parent is 30 seconds. A refusal from any parent asked is final. When no parent is left, the request goes to the person tier (the input inbox). Delegation depth is at most 4.

Signals

What an engine receives, limited to what its supervisor owns.

Directives

What an engine returns. The supervisor checks each before it has effect.
Every directive has an idempotency key; a repeat with the same key returns the first outcome.

Causes

A command caused by tick or initiative needs a reason, the command in the supervisor’s initiative list, and stays under maxInitiativePerMinute (default 10). Dry run applies and the audit flags it.

Outcomes

One outcome per target:

Selectors

A target may be execution:<id>, workflow:<id>, node:<ids> or owned.running. The server expands a selector to at most 200 owned executions, applies and audits each separately, and returns a result per target.

Read operations

Limited to what the supervisor owns, redacted and paged.

Act operations

Each is checked against ownership, allowedCommands, rate, risk and dry run. Run-level commands apply to the supervisor’s run units, node commands to its nodes, server commands to the server unit. run.resumeHeld resumes only the runs this supervisor paused (the hold ledger); the ledger lives in the supervisor’s state and an entry ends with its execution.

Delivery and timing

  • Event delivery is best effort with a visible gap (EventsMissed).
  • Commands for one run are applied in order.
  • A Review is answered within yukta.supervisor.review-timeout (default 5s). On a timeout a stop is allowed and any other command is refused.
  • An engine that fails is resubscribed with backoff and never touches a run.
  • A supervisor never sees the outcomes of its own commands; internal sessions are hidden.

Refusals

CLI exit code 6 signals a supervisor refusal.

Compatibility

Within major version 1 changes are additive: new operations, signals, directives, causes, outcomes, fields and codes. A breaking change means version 2, served beside version 1 for at least one minor release.