Skip to content

Human in the loop

A flow can stop and wait for a person to decide. The paused run becomes a durable job. It survives server restarts and continues on the branch the person chose.

Human Input (flow controls) pauses the flow and routes on the chosen action. Its fields:

Field What it does
Input (prompt) the content shown to the person for review
User Choices (decisions) the choices; each one becomes a branch output
Timeout (timeout) an answer after this window goes to the fallback path (when enabled) instead of the chosen action
Enable Fallback (enable_fallback) adds a fallback output, taken when the answer arrives after the timeout

An Agent pauses before calling a tool whose tools_metadata row has approval_actions. The card is titled Tool approval. When you answer, the agent resumes from its stored transcript.

When a run pauses, the Playground shows a card titled Human input required (or Tool approval) with one button per option. Click one. The run continues in the background on the same job, and the Playground keeps following its events. After you answer, the card shows Answered: and the choice. If the run was stopped before anyone answered, it says so.

  • A paused run is stored as a suspended job. The job holds the engine checkpoint and the run’s inputs and request variables, all encrypted with the server key.
  • The stream ends with a human_input_required event and no end event.
  • The request is stored as a chat message, so it appears in the session history.
  • Suspended jobs survive restarts. After WEFTRA_SUSPENDED_JOB_TTL seconds (default 7 days) they expire as timed_out.
  • A run can pause at most 100 times.

List the requests waiting for you:

GET /api/v2/workflows/pending?flow_id=<flow id>

Answer one:

POST /api/v2/workflows/{job_id}/resume
Content-Type: application/json
{"request_id": "<request id>", "decision": {"action_id": "<action id>"}}
Status Meaning
404 unknown job, or another user’s job
409 the job is not suspended, the request_id is stale, or it was already answered
422 the action_id is not one of the allowed decisions

Follow the resumed run with GET /api/v2/workflows/{job_id}/events. It replays the stored events, then follows the live log, with the same event numbering as before the pause. POST /api/v2/workflows/stop cancels a suspended job.

How each entry point reports a pause:

  • /api/v2/workflows in sync mode returns status: suspended with job_id and pending_request.
  • /api/v1/run answers 409 with {code: HUMAN_INPUT_REQUIRED, job_id, pending_request}.
  • A2A returns the task as input-required. A follow-up message that names an action (id or label) resumes it.
  • A pause inside a loop body is not supported.
  • A pause inside a cyclic graph is untested.
  • Visitors on a public playground cannot answer human-input requests.

Weftra is open source under Apache-2.0. Made by Liceron.