Skip to main content

Interface: AgencyStreamResult

Defined in: packages/agentos/src/api/types.ts:1046

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:

  • textStream for raw token-by-token UX
  • fullStream for structured lifecycle events
  • text or finalTextStream for 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:1068

Final per-agent execution ledger for the streamed run.


finalTextStream​

finalTextStream: AsyncIterable<string>

Defined in: packages/agentos/src/api/types.ts:1080

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:1055

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:1073

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:1057

Finalized scalar text after guardrails, HITL, and parsing hooks.


textStream​

textStream: AsyncIterable<string>

Defined in: packages/agentos/src/api/types.ts:1048

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:1059

Final aggregate usage for the streamed run.