Skip to content

RunResult

The result of an agent run.

  • RunResultBase<TContext, TAgent>
Type Parameter

TContext

TAgent extends Agent<TContext, AgentOutputType>

new RunResult<TContext, TAgent>(state): RunResult<TContext, TAgent>
Parameter Type

state

RunState<TContext, TAgent>

RunResult<TContext, TAgent>

RunResultBase<TContext, TAgent>.constructor
readonly state: RunState<TContext, TAgent>;

The state of the run.

RunResultBase.state
get finalOutput(): undefined | ResolvedAgentOutput<TAgent["outputType"]>

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.

undefined | ResolvedAgentOutput<TAgent["outputType"]>

RunResultBase.finalOutput

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.

AgentInputItem[]

RunResultBase.history

get input():
| string
| AgentInputItem[]

A copy of the original input items.

| string | AgentInputItem[]

RunResultBase.input

get inputGuardrailResults(): InputGuardrailResult[]

Guardrail results for the input messages.

InputGuardrailResult[]

RunResultBase.inputGuardrailResults

get interruptions(): RunToolApprovalItem[]

Any interruptions that occurred during the agent run for example for tool approvals.

RunToolApprovalItem[]

RunResultBase.interruptions

get lastAgent(): undefined | TAgent

The last agent that was run

undefined | TAgent

RunResultBase.lastAgent

get lastResponseId(): undefined | string

The last response ID generated by the model during the agent run.

undefined | string

RunResultBase.lastResponseId

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.

RunItem[]

RunResultBase.newItems

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.

AgentOutputItem[]

RunResultBase.output

get outputGuardrailResults(): OutputGuardrailResult<OutputGuardrailMetadata, "text">[]

Guardrail results for the final output of the agent.

OutputGuardrailResult<OutputGuardrailMetadata, "text">[]

RunResultBase.outputGuardrailResults

get rawResponses(): ModelResponse[]

The raw LLM responses generated by the model during the agent run.

ModelResponse[]

RunResultBase.rawResponses