Skip to main content
Human-in-the-Loop (HITL) enables you to maintain control over agent executions. Pause runs for external processing, recover from errors, or cancel and resume operations as needed.

Cancel Run

Cancel running agent executions and resume from the cut-off point.

Durable Execution

Automatic recovery from errors with state persistence across restarts.

External Tool Execution

Pause agents for external tool processing and resume with results.

User Confirmation

Pause for user approval or rejection of tool calls, then resume.

User Input

Pause for user-provided field values, then resume with filled inputs.

Dynamic User Input

Let the agent request user-provided fields at runtime via get_user_input.

Key Concepts

Run Identification

Every agent execution has a unique run_id that enables:
  • State persistence across process restarts
  • Cross-process resumption with new agent instances
  • Tracking and debugging of execution flows

Continuation Methods

Use continue_run_async() to resume paused or errored runs:
  • By run_id: Load state from persistent storage (cross-process safe)
  • By task: Use in-memory context (same-process continuation)

Important Notes

  • HITL continuation (continue_run_async) only supports direct call mode
  • Streaming mode is not supported for continuation
  • For cross-process resumption, always use persistent storage (e.g., SqliteDatabase)