Interrupts (Human-in-the-Loop)
Interrupts let your AG-UI agent pause mid-run and hand control to a human. The agent proposes an action, the run freezes, your Angular UI shows an approval dialog, the user decides, and the agent resumes with the human's decision. This guide covers the AG-UI adapter specifics. For the broader conceptual model — lifecycle stages, timeout strategies, typed payloads — see the LangGraph interrupts guide.
#The Wire Format
AG-UI interrupts arrive as a CUSTOM event with name: "on_interrupt":
Two things to note:
- The
valueis a JSON string, not an object. Theag-ui-langgraphPython package serializes the interrupt payload viadump_json_safebefore emitting the event. - The adapter
JSON.parses the string automatically. Consumers always see the structured object — you never need to parse it yourself.
Structuring the payload: Use a kind field so <chat-approval-card matchKind="…"> can match the right interrupt:
#Reading the Interrupt in Your Component
injectAgent() exposes a interrupt() signal that is populated whenever the adapter receives an on_interrupt CUSTOM event. Pair it with <chat-approval-card> from @threadplane/chat to render an approval dialog without manual event wiring:
matchKind filters on interrupt().value.kind. The card renders only when the active interrupt matches — other interrupt kinds are ignored.
#Resuming
Call agent.submit({ resume }) with your decision object:
Under the hood, submit({ resume }) calls runAgent({ forwardedProps: { command: { resume } } }). The server receives forwarded_props.command.resume — the convention the ag-ui-langgraph package reads to resume the LangGraph checkpoint.
In your LangGraph node, interrupt({...}) returns the resume value directly. You do not need to unwrap forwarded_props yourself — ag-ui-langgraph does that before resuming the graph.
#End-to-End Example
cockpit/ag-ui/interrupts is a complete Angular + Python example: a refund-authorization agent that drafts a refund, pauses for operator approval, and issues (or cancels) based on the decision.
Angular component (cockpit/ag-ui/interrupts/angular/src/app/interrupts.component.ts):
Python graph (cockpit/ag-ui/interrupts/python/src/graph.py) uses ag-ui-langgraph to front a standard LangGraph graph:
The LangGraphAgent wrapper handles streaming the CUSTOM on_interrupt event and reading forwarded_props.command.resume on resume. Refer to ag-ui-langgraph on PyPI for installation and configuration.
#Cross-Adapter Parity
The consumer Angular code is byte-identical except the injectAgent import:
<chat-approval-card>, the interrupt() signal, and submit({ resume }) are part of the runtime-neutral Agent contract from @threadplane/chat. Switching adapters is a provider change, not a component rewrite. See the LangGraph interrupts guide for the full HITL pattern including multi-step approvals, typed payloads, and timeout strategies.