Interface CompiledStrategyStreamResult

Internal stream result shape returned by compiled agency strategies.

Strategy compilers may return only the live iterables plus aggregate promises. The outer agency() wrapper can enrich this into the public AgencyStreamResult.

This type exists for strategy authors. Most external callers should consume AgencyStreamResult from agency().stream(...) instead.

interface CompiledStrategyStreamResult {
    textStream?: AsyncIterable<string, any, any>;
    fullStream?: AsyncIterable<AgencyStreamPart, any, any>;
    text?: Promise<string>;
    usage?: Promise<{
        promptTokens: number;
        completionTokens: number;
        totalTokens: number;
        costUSD?: number;
    }>;
    agentCalls?: Promise<AgentCallRecord[]>;
}

Properties

textStream?: AsyncIterable<string, any, any>

Raw live text chunks from the strategy.

fullStream?: AsyncIterable<AgencyStreamPart, any, any>

Structured live stream parts from the strategy.

text?: Promise<string>

Final raw text assembled by the strategy, when available.

usage?: Promise<{
    promptTokens: number;
    completionTokens: number;
    totalTokens: number;
    costUSD?: number;
}>

Aggregate usage for the strategy run, when available.

Type declaration

  • promptTokens: number
  • completionTokens: number
  • totalTokens: number
  • Optional costUSD?: number
agentCalls?: Promise<AgentCallRecord[]>

Final per-agent ledger for the strategy run, when available.