@cavell/kit API
    Preparing search index...

    Function useInterrupt

    • Handles agent interrupts with optional filtering, preprocessing, and resume behavior.

      Supports both the AG-UI standard interrupt flow (RUN_FINISHED with outcome.type === "interrupt") and the legacy custom-event flow (on_interrupt). For standard interrupts, render receives interrupt (the primary one) and interrupts (the full open set); call resolve(payload) to resume or cancel() to cancel. Resuming addresses the targeted interrupt and, once every open interrupt is addressed, submits a single spec resume array via copilotkit.runAgent.

      • renderInChat: true (default): the element is published into <CopilotChat>; returns void.
      • renderInChat: false: the hook returns the interrupt element for manual placement.

      Type Parameters

      • TResult = never
      • TRenderInChat extends InterruptRenderInChat = undefined

      Parameters

      Returns UseInterruptReturn<TRenderInChat>

      useInterrupt({
      render: ({ interrupt, resolve, cancel }) => (
      <div>
      <p>{interrupt?.message}</p>
      <button onClick={() => resolve({ approved: true })}>Approve</button>
      <button onClick={() => cancel()}>Cancel</button>
      </div>
      ),
      });