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.
Ways to pause a run
Section titled “Ways to pause a run”The Human Input component
Section titled “The Human Input component”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 |
Agent tool approval
Section titled “Agent tool approval”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.
Answer in the Playground
Section titled “Answer in the Playground”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.
How it works on the server
Section titled “How it works on the server”- A paused run is stored as a
suspendedjob. 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_requiredevent and noendevent. - The request is stored as a chat message, so it appears in the session history.
- Suspended jobs survive restarts. After
WEFTRA_SUSPENDED_JOB_TTLseconds (default 7 days) they expire astimed_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}/resumeContent-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/workflowsin sync mode returnsstatus: suspendedwithjob_idandpending_request./api/v1/runanswers 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.
Limits
Section titled “Limits”- 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.