StreamedRunResult
이 콘텐츠는 아직 번역되지 않았습니다.
The result of an agent run in streaming mode.
Extends
Section titled “Extends”RunResultBase<TContext,TAgent>
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
|
|
|
|
Implements
Section titled “Implements”AsyncIterable<RunStreamEvent>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new StreamedRunResult<TContext, TAgent>(result): StreamedRunResult<TContext, TAgent>;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
{ |
|
|
|
|
|
|
Returns
Section titled “Returns”StreamedRunResult<TContext, TAgent>
Overrides
Section titled “Overrides”RunResultBase<TContext, TAgent>.constructorProperties
Section titled “Properties”currentTurn
Section titled “currentTurn”currentTurn: number = 0;The current turn number
maxTurns
Section titled “maxTurns”maxTurns: number | undefined;The maximum number of turns that can be run
readonly state: RunState<TContext, TAgent>;The state of the run.
Inherited from
Section titled “Inherited from”RunResultBase.stateAccessors
Section titled “Accessors”cancelled
Section titled “cancelled”Get Signature
Section titled “Get Signature”get cancelled(): boolean;Returns true if the stream has been cancelled.
Returns
Section titled “Returns”boolean
completed
Section titled “completed”Get Signature
Section titled “Get Signature”get completed(): Promise<void>;Await this promise to ensure that the stream has been completed if you are not consuming the stream directly.
Returns
Section titled “Returns”Promise<void>
currentAgent
Section titled “currentAgent”Get Signature
Section titled “Get Signature”get currentAgent(): TAgent | undefined;The current agent that is running
Returns
Section titled “Returns”TAgent | undefined
Get Signature
Section titled “Get Signature”get error(): unknown;Error thrown during the run, if any.
Returns
Section titled “Returns”unknown
finalOutput
Section titled “finalOutput”Get Signature
Section titled “Get Signature”get finalOutput(): ResolvedAgentOutput<TAgent["outputType"]> | undefined;The final output of the agent. If the output type was set to anything other than text,
this will be parsed either as JSON or using the Zod schema you provided.
Returns
Section titled “Returns”ResolvedAgentOutput<TAgent["outputType"]> | undefined
Inherited from
Section titled “Inherited from”RunResultBase.finalOutputhistory
Section titled “history”Get Signature
Section titled “Get Signature”get history(): AgentInputItem[];The history of the agent run. This includes the input items and the new items generated during the agent run.
This can be used as inputs for the next agent run.
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”RunResultBase.historyGet Signature
Section titled “Get Signature”get input(): | string | AgentInputItem[];A copy of the original input items.
Returns
Section titled “Returns”| string
| AgentInputItem[]
Inherited from
Section titled “Inherited from”RunResultBase.inputinputGuardrailResults
Section titled “inputGuardrailResults”Get Signature
Section titled “Get Signature”get inputGuardrailResults(): InputGuardrailResult[];Guardrail results for the input messages.
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”RunResultBase.inputGuardrailResultsinterruptions
Section titled “interruptions”Get Signature
Section titled “Get Signature”get interruptions(): RunToolApprovalItem[];Any interruptions that occurred during the agent run for example for tool approvals.
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”RunResultBase.interruptionslastAgent
Section titled “lastAgent”Get Signature
Section titled “Get Signature”get lastAgent(): TAgent | undefined;The last agent that was run
Returns
Section titled “Returns”TAgent | undefined
Inherited from
Section titled “Inherited from”RunResultBase.lastAgentlastResponseId
Section titled “lastResponseId”Get Signature
Section titled “Get Signature”get lastResponseId(): string | undefined;The last response ID generated by the model during the agent run.
Returns
Section titled “Returns”string | undefined
Inherited from
Section titled “Inherited from”RunResultBase.lastResponseIdnewItems
Section titled “newItems”Get Signature
Section titled “Get Signature”get newItems(): RunItem[];The run items generated during the agent run. This associates the model data with the agents.
For the model data that can be used as inputs for the next agent run, use the output property.
Returns
Section titled “Returns”RunItem[]
Inherited from
Section titled “Inherited from”RunResultBase.newItemsoutput
Section titled “output”Get Signature
Section titled “Get Signature”get output(): AgentOutputItem[];The new items generated during the agent run. These include things like new messages, tool calls and their outputs, etc.
It does not include information about the agents and instead represents the model data.
For the output including the agents, use the newItems property.
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”RunResultBase.outputoutputGuardrailResults
Section titled “outputGuardrailResults”Get Signature
Section titled “Get Signature”get outputGuardrailResults(): OutputGuardrailResult<OutputGuardrailMetadata, "text">[];Guardrail results for the final output of the agent.
Returns
Section titled “Returns”OutputGuardrailResult<OutputGuardrailMetadata, "text">[]
Inherited from
Section titled “Inherited from”RunResultBase.outputGuardrailResultsrawResponses
Section titled “rawResponses”Get Signature
Section titled “Get Signature”get rawResponses(): ModelResponse[];The raw LLM responses generated by the model during the agent run.
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”RunResultBase.rawResponsesMethods
Section titled “Methods”[asyncIterator]()
Section titled “[asyncIterator]()”asyncIterator: AsyncIterator<RunStreamEvent>;Returns
Section titled “Returns”AsyncIterator<RunStreamEvent>
Implementation of
Section titled “Implementation of”AsyncIterable.[asyncIterator]toStream()
Section titled “toStream()”toStream(): ReadableStream<RunStreamEvent>;Returns the underlying readable stream.
Returns
Section titled “Returns”ReadableStream<RunStreamEvent>
A readable stream of the agent run.
toTextStream()
Section titled “toTextStream()”Call Signature
Section titled “Call Signature”toTextStream(): ReadableStream<string>;Returns a readable stream of the final text output of the agent run.
Returns
Section titled “Returns”ReadableStream<string>
A readable stream of the final output of the agent run.
Remarks
Section titled “Remarks”Pass { compatibleWithNodeStreams: true } to receive a Node.js compatible stream
instance.
Call Signature
Section titled “Call Signature”toTextStream(options?): Readable;Returns a readable stream of the final text output of the agent run.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
{ |
|
|
|
Returns
Section titled “Returns”Readable
A readable stream of the final output of the agent run.
Remarks
Section titled “Remarks”Pass { compatibleWithNodeStreams: true } to receive a Node.js compatible stream
instance.
Call Signature
Section titled “Call Signature”toTextStream(options?): ReadableStream<string>;Returns a readable stream of the final text output of the agent run.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
{ |
|
|
|
Returns
Section titled “Returns”ReadableStream<string>
A readable stream of the final output of the agent run.
Remarks
Section titled “Remarks”Pass { compatibleWithNodeStreams: true } to receive a Node.js compatible stream
instance.