Human-in-the-Loop

Stop the current model turn of a live agent stage (the stage stage names, or the run's one live agent stage) and keep its session. With text, the text is the stage's next input; without, the stage waits for the next steer message before starting another model turn. The control is forwarded to the run's worker, and the worker's answer is this response: 202 with outcome: delivered (and the stage's label) once the worker stopped the turn, 409 with the refusal's code when the worker or Petri refused it (a stage with no model turn in flight, such as an agent between turns or a human gate; a stage that is not running; no live agent stage, or several unnamed), and 202 with outcome: pending when the worker gave no answer within the wait (5 s). A refused interrupt is also a run.notice record on the run's event stream under the same code (no_live_turn, no_such_stage, interrupt_refused). A delivered interrupt is the stage's control.requested record with $interrupt, followed by an attractor.turn.interrupted progress record.

post/api/v1/runs/{id}/interrupt

Request

  • The document declares no server URL.
  • Auth
    • HTTP bearer
    • or API key in cookie __fabro_session

Path parameters

idstring required

Unique run identifier (ULID).

Request body

stagestring

The agent stage to interrupt: its stage identifier (node_id@visit) or its node name. Omit it to interrupt the run's one live agent stage.

textstring

The stage's next input once its turn is stopped. Omit it to let the stage wait for the next steer message.

Example request

{
  "stage": "code@2",
  "text": "Stop and summarize what you have so far."
}

Response

Interrupt forwarded to the worker: delivered, or pending when the worker gave no answer within the wait.

outcome'delivered' | 'pending' required

What became of a forwarded control: delivered once the worker delivered it to its stage; pending when the worker gave no answer within the wait, in which case the run's event stream says what became of it (a run.notice record on refusal).

stagestring

The label of the stage the control was delivered to (node@visit, or node/e<execution>@visit); absent when the outcome is pending.

Changes