Interface: AgentStreamResult
@providerprotocol/agents / index / AgentStreamResult
Interface: AgentStreamResult
Section titled “Interface: AgentStreamResult”Defined in: src/execution/types.ts:284
Streaming result from agent execution providing async iteration and final result access.
AgentStreamResult implements the async iterator protocol for consuming stream events, provides a promise for the final result, and includes an abort method for cancellation.
Example
Section titled “Example”const stream = agent.stream('What is 2+2?');
// Consume events as they arrivefor await (const event of stream) { handleEvent(event);}
// Get the final result after stream completesconst result = await stream.result;console.log(result.turn.response.text);
// Or abort earlystream.abort();Properties
Section titled “Properties”result
Section titled “result”result:
Promise<GenerateResult>
Defined in: src/execution/types.ts:288
Promise that resolves to the final result after stream completes
Methods
Section titled “Methods”[asyncIterator]()
Section titled “[asyncIterator]()”[asyncIterator]():
AsyncIterator<AgentStreamEvent>
Defined in: src/execution/types.ts:286
Async iterator for consuming stream events
Returns
Section titled “Returns”AsyncIterator<AgentStreamEvent>
abort()
Section titled “abort()”abort():
void
Defined in: src/execution/types.ts:290
Abort the stream and cancel execution
Returns
Section titled “Returns”void