v1.0.0

Human in the loop

Updated 30 Nov 2026Edit this page

Pause a run for a person to approve, reject or edit a value with the Human Approval node, durably and across restarts.

The Human Approval node pauses a run until a person decides. The pause is durable: no thread, task or connection is held while it waits, and the run survives a server restart.

Example: draft and approve

Template Draft and approve (human in the loop):

  1. Topic → Text Template → LLM writes a customer announcement.
  2. Human Approval receives the draft (value). Settings: title, instructions for the reviewer, allow_edit (let the reviewer change the text), require_comment_on_reject (default on).
  3. The approved branch triggers the Published output (with the possibly edited value); the rejected branch triggers Rejection reason (with the comment).

Run it. The run ends with status waiting, the node shows waiting for you, and Chat shows Paused for approval.

Approving

  1. Open the Approvals tab (its badge counts pending approvals).
  2. Read the title, instructions and value.
  3. Optionally edit the value (if allow_edit), add a comment, and click Approve or Reject (a rejection needs a comment by default).
  4. The run resumes from its checkpoints: nodes that already finished are restored, not re-run. Outputs: value, decision (approved / rejected), comment, reviewer.

How it works

  • A node that declares can_suspend may raise a suspension with a request (what to show) and a response schema (what a valid answer looks like).
  • The engine marks the node waiting, lets independent branches finish, then ends the run as waiting. The request is stored as a wait (the approval inbox).
  • POST /api/runs/{id}/resume with responses validates each response against its schema (422 otherwise) and claims the run atomically (waiting → running), so a double click gets 409.
  • The plan is rebuilt from the run’s IR snapshot and original run targets; secrets are resolved again.
  • Cancel works on waiting runs; pending waits become cancelled.

Rules and limits

  • Human Approval cannot be inside a loop body (SUSPEND_IN_LOOP).
  • An Agent cannot yet pause before an individual tool call.
  • There is no approval expiry, reminders or assignee yet.
  • In an exported standalone app, an approval pause answers 409 (durable approvals need the AgenticMind server).

API

Endpoint Purpose
GET /api/projects/{id}/approvals?status=pending The approval inbox.
GET /api/runs/{run_id}/waits A run’s pause points (pending, answered, cancelled).
POST /api/runs/{run_id}/resume {"responses": {"<node_id>": {"decision": "approved", "comment": "", "value": "..."}}}

See Production AI systems for why durable suspension matters.