Skip to content

MiddlewareInterruptible

Defined in: src/middleware/stages.ts:39

Interface for middleware contexts that support interrupts. Unlike the hook/tool Interruptible, middleware interrupts return a wrapper object to allow non-breaking additions in the future.

interrupt<T>(params): MiddlewareInterruptResult<T>;

Defined in: src/middleware/stages.ts:51

Request a human-in-the-loop interrupt.

On first execution (no prior response), throws InterruptError to halt the agent. On resume (after the user provides a response), returns the response wrapped in MiddlewareInterruptResult.

Type ParameterDefault type
TJSONValue
ParameterTypeDescription
paramsInterruptParamsInterrupt parameters (name, optional reason, optional preemptive response)

MiddlewareInterruptResult<T>

The user’s response wrapped in { response: T }

InterruptError when no response has been provided yet