Interface: AgencyStreamResult
Defined in: packages/agentos/src/api/types.ts:1026
Public stream result returned by agency().stream(...).
This exposes both low-latency raw streaming and finalized post-processing results so callers can choose the right trade-off for their UI or runtime.
Prefer:
textStreamfor raw token-by-token UXfullStreamfor structured lifecycle eventstextorfinalTextStreamfor the finalized approved answer
textStream may differ from the finalized answer when output guardrails or
beforeReturn HITL rewrite the result. finalTextStream and text always
reflect the finalized post-processing output.
Example
const stream = team.stream('Summarize HTTP/3 rollout risks.');
for await (const chunk of stream.textStream) {
process.stdout.write(chunk); // raw live output
}
for await (const approved of stream.finalTextStream) {
console.log('Approved answer:', approved);
}
console.log(await stream.agentCalls);
console.log(await stream.text);
Properties
agentCalls
agentCalls:
Promise<AgentCallRecord[]>
Defined in: packages/agentos/src/api/types.ts:1048
Final per-agent execution ledger for the streamed run.
finalTextStream
finalTextStream:
AsyncIterable<string>
Defined in: packages/agentos/src/api/types.ts:1060
Finalized approved-only text stream.
Unlike textStream, this yields only the post-guardrail/post-HITL answer.
For most runs it emits a single finalized chunk.
fullStream
fullStream:
AsyncIterable<AgencyStreamPart>
Defined in: packages/agentos/src/api/types.ts:1035
Structured live + finalized event stream.
This includes raw text/tool/lifecycle events and also the finalized
final-output event after post-processing completes.
parsed
parsed:
Promise<unknown>
Defined in: packages/agentos/src/api/types.ts:1053
Final structured payload; resolves to undefined when structured output
was not configured for the run.
text
text:
Promise<string>
Defined in: packages/agentos/src/api/types.ts:1037
Finalized scalar text after guardrails, HITL, and parsing hooks.
textStream
textStream:
AsyncIterable<string>
Defined in: packages/agentos/src/api/types.ts:1028
Raw live text chunks from the underlying strategy.
usage
usage:
Promise<{cacheCreationTokens?:number;cacheReadTokens?:number;completionTokens:number;costUSD?:number;promptTokens:number;totalTokens:number; }>
Defined in: packages/agentos/src/api/types.ts:1039
Final aggregate usage for the streamed run.