Skip to main content
Use this when the decision should be visible and editable as a flowchart, and may use any node: a BRANCH, an HTTP_REQUEST, an LLM_CALL or a decision plugin. For each event you list, the server starts the workflow with the event and reads how it ended. Prerequisites: Ask for input (the approvals session) and Assign a supervisor. Defining a session and a supervisor needs an ADMIN key; add -H "X-API-Key: $YUKTA_API_KEY" to every curl if your server has keys. This guide follows example 17.

Steps

1

Write the decision workflow in an internal session

A session tagged "yukta.internal": "true" is internal: hidden from the default lists, and its own events never reach a supervisor. The workflow begins at SUPERVISOR_SIGNAL and ends in SUPERVISOR_DECISION nodes. Save as session.json:
session.json
The signal’s payload holds the event, with secrets masked, and for an input request the request (id, spec.risk, spec.kind, spec.prompt…). How the run ends decides what happens:A command the contract cannot read fails the run instead of being dropped. AnswerInput, EscalateInput, PauseWorkflow, ResumeWorkflow, PauseNode, ResumeNode and SetPriority can always be mapped; StopWorkflow, StopNode, SkipNode, Restart, RestartFromNode, SetLimits and SetBreakpoint only when allowedCommands names them.
2

Save the supervisor

supervisor.json
3

Give it something to own

The supervisor answers only requests of what it owns, and never one raised by a run it started.
4

Trigger a request

Start the deploy workflow from Ask for input, whose request has risk LOW:

Verify it worked

The run goes on without anyone answering, and ends in the deployed terminal.
The request is ANSWERED by the supervisor with the rationale from the workflow, the decision shows outcome applied, and the supervisors session appears only with includeInternal=true. Change the request to risk MEDIUM and start again: the workflow ends with ESCALATE, the request becomes ESCALATED with your reason as advice, and it waits for the next tier or a person. A HIGH request is never answered by a supervisor, whatever the workflow says.

Variations

  • A section supervisor. section-supervisor.json in the example owns only workflow:my-session/my-workflow//build.*, runs a one-node section-triage workflow that always ends ESCALATE, and reports to low-risk-workflow via "parents": Build a hierarchy.
  • Make the decision with a model. Put an LLM_CALL, or an MCP_TOOL_CALL that reads other runs with a VIEWER key, in front of the decision node (Call an LLM).
  • Observing internal sessions. Events of internal sessions never reach a supervisor unless its settings set observeInternal: true and it owns that session. Supervisors nested deeper than yukta.supervisor.max-depth (2) are refused.
  • Their own slots. Supervisor runs hold one of yukta.supervisor.reserved-slots (4) slots, so a saturated server still runs them and they cannot starve normal work. A run that finds none within its timeout is skipped.
  • Trusted authors. Only admins can define sessions, and a workflow can call any endpoint it holds a key for, so write these workflows as trusted code.