Skip to content

Interface: AgentStreamResult

@providerprotocol/agents


@providerprotocol/agents / index / 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.

const stream = agent.stream('What is 2+2?');
// Consume events as they arrive
for await (const event of stream) {
handleEvent(event);
}
// Get the final result after stream completes
const result = await stream.result;
console.log(result.turn.response.text);
// Or abort early
stream.abort();

result: Promise<GenerateResult>

Defined in: src/execution/types.ts:288

Promise that resolves to the final result after stream completes

[asyncIterator](): AsyncIterator<AgentStreamEvent>

Defined in: src/execution/types.ts:286

Async iterator for consuming stream events

AsyncIterator<AgentStreamEvent>


abort(): void

Defined in: src/execution/types.ts:290

Abort the stream and cancel execution

void