Skip to main content
Pause a Functional API entrypoint with interrupt and resume with Command. For concepts, see the Functional API overview. For interrupt payloads and resume shapes, see Interrupts. Persistence requires a checkpointer and a thread_id.

Pause for feedback

Create three tasks:
  1. Append "bar".
  2. Pause for human input. When resuming, append that input.
  3. Append "qux".
Compose them in an entrypoint. interrupt runs inside human_feedback after step_1 has finished. Those results are persisted, so step_1 does not run again after resume. Identify the run with thread_id. Drive the stream until it pauses, print the interrupt payload, then resume.
The Command resume value is the data human_feedback expects. After resume, the run continues through step_3 and returns foo bar baz qux.

Review tool calls

To review tool calls before execution, call interrupt from a helper. Execution pauses until you resume with Command. Given a tool call, choose one of:
  • Accept the tool call
  • Revise the tool call and continue
  • Generate a custom tool message (for example, instruct the model to re-format its tool call)
Wire the helper into an entrypoint. Accepted or revised calls run through call_tool. Feedback becomes a ToolMessage and skips execution. Prior task results, here the first model call, stay on the thread after the interrupt. call_model and call_tool below are stand-ins. Replace them with your model and tools. For more, see Add memory with the Functional API. The entrypoint restores prior messages from the checkpointer with getPreviousState.

See also