Skip to main content
Terminal event yielded at the end of every successful or failed run.

Extended by

Properties

durationMs


error?

cause?

message


messageId?


modelUsage?


parentMessageId?


sessionId


stopReason?


structuredOutput?


subtype


text?

Assistant text from every text part of the turn’s final assistant message, identified by messageId. Identical to the text on the assistant stream message with the same messageId, so this and the last streamed assistant text can never disagree. undefined when the turn produced no assistant text (a tool-only final step, a result without a message id, or a hard failure before any matching assistant message was observed). Use text ?? "" for a plain string — which is exactly what RunResult.text does. Unlike Claude Agent SDK’s result (success variant only), this is also populated on error subtypes: on error_aborted it is the partial answer produced before the interrupt.

totalCostUsd?


turns


usage?