Skip to content

AgentResult

Defined in: src/types/agent.ts:60

Result returned by the agent loop.

new AgentResult(data): AgentResult;

Defined in: src/types/agent.ts:85

ParameterType
data{ stopReason: StopReason; lastMessage: Message; metrics?: AgentMetrics; structuredOutput?: unknown; }
data.stopReasonStopReason
data.lastMessageMessage
data.metrics?AgentMetrics
data.structuredOutput?unknown

AgentResult

readonly type: "agentResult";

Defined in: src/types/agent.ts:61


readonly stopReason: StopReason;

Defined in: src/types/agent.ts:66

The stop reason from the final model response.


readonly lastMessage: Message;

Defined in: src/types/agent.ts:71

The last message added to the messages array.


readonly optional structuredOutput: unknown;

Defined in: src/types/agent.ts:77

The validated structured output from the LLM, if a schema was provided. Type represents any validated Zod schema output.


readonly optional metrics: AgentMetrics;

Defined in: src/types/agent.ts:83

Aggregated metrics for the agent’s loop execution. Tracks cycle counts, token usage, tool execution stats, and model latency.

toString(): string;

Defined in: src/types/agent.ts:107

Extracts and concatenates all text content from the last message. Includes text from TextBlock and ReasoningBlock content blocks.

string

The agent’s last message as a string, with multiple blocks joined by newlines.