Skip to content

ToolsToFinalOutputResult

type ToolsToFinalOutputResult =
| {
isFinalOutput: false;
isInterrupted: undefined;
}
| {
interruptions: RunToolApprovalItem[];
isFinalOutput: false;
isInterrupted: true;
}
| {
finalOutput: string;
isFinalOutput: true;
isInterrupted: undefined;
};

{ isFinalOutput: false; isInterrupted: undefined; }

isFinalOutput: false;

Wether this is the final output. If false, the LLM will run again and receive the tool call output

isInterrupted: undefined;

Wether the agent was interrupted by a tool approval. If true, the LLM will run again and receive the tool call output

{ interruptions: RunToolApprovalItem[]; isFinalOutput: false; isInterrupted: true; }

interruptions: RunToolApprovalItem[];
isFinalOutput: false;
isInterrupted: true;

Wether the agent was interrupted by a tool approval. If true, the LLM will run again and receive the tool call output

{ finalOutput: string; isFinalOutput: true; isInterrupted: undefined; }

finalOutput: string;

The final output. Can be undefined if isFinalOutput is false, otherwise it must be a string that will be processed based on the outputType of the agent.

isFinalOutput: true;

Wether this is the final output. If false, the LLM will run again and receive the tool call output

isInterrupted: undefined;

Wether the agent was interrupted by a tool approval. If true, the LLM will run again and receive the tool call output