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 activeAgent(): TAgent | undefined;

The agent that should handle the next turn. This is an alias for the last agent that completed a turn.

TAgent | undefined

RunResultBase.activeAgent


get agentToolInvocation():
| Readonly<{
toolArguments?: string;
toolCallId?: string;
toolName: string;
}>
| undefined;

Metadata about the nested Agent.asTool() invocation that produced this result, when applicable.

| Readonly<{ toolArguments?: string; toolCallId?: string; toolName: string; }> | undefined

RunResultBase.agentToolInvocation


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 validation schema you provided.

ResolvedAgentOutput<TAgent["outputType"]> | undefined

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(): TAgent | undefined;

The last agent that was run

TAgent | undefined

RunResultBase.lastAgent


get lastResponseId(): string | undefined;

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

string | undefined

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


get runContext(): RunContext<TContext>;

The public run context for this run.

RunContext<TContext>

RunResultBase.runContext


get toolInputGuardrailResults(): ToolInputGuardrailResult[];

Guardrail results for tool inputs.

ToolInputGuardrailResult[]

RunResultBase.toolInputGuardrailResults


get toolOutputGuardrailResults(): ToolOutputGuardrailResult[];

Guardrail results for tool outputs.

ToolOutputGuardrailResult[]

RunResultBase.toolOutputGuardrailResults