Skip to main content
Human-in-the-loop (HITL) lets you pause agent execution at specific points to get user input before continuing. This is essential for tool approval, content review, or any workflow that needs human judgment.

How it works

  1. Your graph calls interrupt() at a decision point
  2. The run pauses and the thread status becomes "interrupted"
  3. Your application retrieves the interrupt payload (what the agent wants to do)
  4. The user decides what to do (approve, edit, reject, respond)
  5. You resume the run with a command that tells the agent how to proceed

Quick example

Define a graph with an approval gate

Wire it into the graph

Register in aegra.json

Client-side flow

1. Start a run that triggers an interrupt

2. Resume with approval

3. Resume with edits

4. Respond directly

5. Ignore the tool call

Interrupt before/after nodes

You can also set interrupt points without modifying the graph code, using the interrupt_before and interrupt_after parameters on the run:
Use "*" to interrupt before/after every node:

Checking interrupt status

Response types

Important notes

When resuming an interrupted run, use command instead of input. The input and command fields are mutually exclusive — you can’t send both.
  • Interrupts work transparently across subgraph boundaries
  • The thread status changes to "interrupted" when paused and "idle" when completed
  • You can inspect the interrupt payload in thread state to show the user what the agent wants to do
  • Multiple sequential interrupts are supported in a single run