Skip to main content
Human-in-the-Loop lets you insert human review checkpoints during agent execution. When the agent is about to call tools, you can pause for user confirmation before proceeding.

Two Pause Points

Agent execution has two phases: “reasoning” and “acting”. You can pause at either point: Pause after reasoning: After the model decides which tools to call, but before execution. You can see the tool names and parameters, letting users decide whether to allow execution. Pause after acting: After tool execution completes, but before the next reasoning iteration. You can see the results, letting users decide whether to continue.

Example: Confirming Sensitive Operations

This example shows how to require user confirmation before executing sensitive operations like deleting files or sending emails:

Handling Pause and Resume

When the agent pauses, the returned message contains the pending tool information. Display it to the user and decide next steps based on their choice:

Quick Reference

Pause methods:
  • PostReasoningEvent.stopAgent() — Pause after reasoning
  • PostActingEvent.stopAgent() — Pause after acting
Resume methods:
  • agent.call() — Continue executing pending tools
  • agent.call(toolResultMsg) — Provide custom tool result and continue
Check pause reason:
  • response.getGenerateReason() returns REASONING_STOP_REQUESTED or ACTING_STOP_REQUESTED