Skip to main content

Interface: DoneSegment

Defined in: packages/core/src/stream-segments/types.ts:209

The end of a response, with its reason.

Extends​

Properties​

agentId​

agentId: string

Defined in: packages/core/src/stream-segments/types.ts:228

Set in group chat.

Overrides​

BaseSegment.agentId


agentName?​

optional agentName?: string

Defined in: packages/core/src/stream-segments/types.ts:15

Inherited from​

BaseSegment.agentName


avatarEmoji?​

optional avatarEmoji?: string

Defined in: packages/core/src/stream-segments/types.ts:16

Inherited from​

BaseSegment.avatarEmoji


cacheReadTokens?​

optional cacheReadTokens?: number

Defined in: packages/core/src/stream-segments/types.ts:225


cacheWriteTokens?​

optional cacheWriteTokens?: number

Defined in: packages/core/src/stream-segments/types.ts:226


duration_ms​

duration_ms: number

Defined in: packages/core/src/stream-segments/types.ts:212


durationDisplay​

durationDisplay: string

Defined in: packages/core/src/stream-segments/types.ts:215


error?​

optional error?: object

Defined in: packages/core/src/stream-segments/types.ts:231

code​

code: string

message​

message: string


id​

id: string

Defined in: packages/core/src/stream-segments/types.ts:10

Inherited from​

BaseSegment.id


inputTokens?​

optional inputTokens?: number

Defined in: packages/core/src/stream-segments/types.ts:223

The rest of the done event's token counts, so a stored turn reports the usage its live stream did (uiMessagesFromSegments).


iterationCount?​

optional iterationCount?: number

Defined in: packages/core/src/stream-segments/types.ts:217


outputTokens?​

optional outputTokens?: number

Defined in: packages/core/src/stream-segments/types.ts:224


parentAgentId?​

optional parentAgentId?: string

Defined in: packages/core/src/stream-segments/types.ts:229


reason​

reason: "error" | "turn_yielded" | "out_of_iterations" | "max_tokens_reached" | "interrupted" | "awaiting_interrupt" | "no_applicable_tools" | "max_depth_reached" | "graceful_shutdown"

Defined in: packages/core/src/stream-segments/types.ts:211


reasonDisplay​

reasonDisplay: string

Defined in: packages/core/src/stream-segments/types.ts:214


reasoningTokens?​

optional reasoningTokens?: number

Defined in: packages/core/src/stream-segments/types.ts:227


step?​

optional step?: number

Defined in: packages/core/src/stream-segments/types.ts:24

The model step (0-based, within its turn) that produced this segment. History stamps it when the step finishes, so a turn is rebuilt for the next request one step at a time, in the order it was sent (see deriveAPIMessages). Absent on segments stored without it, which are rebuilt as one assistant message per turn.

Inherited from​

BaseSegment.step


timestamp​

timestamp: number

Defined in: packages/core/src/stream-segments/types.ts:12

Epoch milliseconds.

Inherited from​

BaseSegment.timestamp


tokensUsed?​

optional tokensUsed?: number

Defined in: packages/core/src/stream-segments/types.ts:218


type​

type: "done"

Defined in: packages/core/src/stream-segments/types.ts:210