AgentStreamContext
Defined in: src/middleware/stages.ts:129
Context passed to agent-stream-stage middleware. Wraps the entire agent output stream at the outermost interception point.
Extends
Section titled “Extends”Properties
Section titled “Properties”readonly agent: LocalAgent;Defined in: src/middleware/stages.ts:131
The agent instance (escape hatch for advanced use cases).
readonly args: InvokeArgs;Defined in: src/middleware/stages.ts:133
The invocation arguments passed to agent.stream().
options?
Section titled “options?”readonly optional options?: InvokeOptions;Defined in: src/middleware/stages.ts:135
Per-invocation options (cancel signal, structured output, etc.).
Methods
Section titled “Methods”interrupt()
Section titled “interrupt()”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 Parameters
Section titled “Type Parameters”| Type Parameter | Default type |
|---|---|
T | JSONValue |
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
params | InterruptParams | Interrupt parameters (name, optional reason, optional preemptive response) |
Returns
Section titled “Returns”The user’s response wrapped in { response: T }
Throws
Section titled “Throws”InterruptError when no response has been provided yet