ai.ModelTurn

One attempt at a turn. A client returns one that succeeded; a wrapper's `child_turns` also hold the attempts that failed (`error` set, no content, `stop_reason` Failed).

Reference version

Signature

class ai.ModelTurn

One attempt at a turn. A client returns one that succeeded; a wrapper's child_turns also hold the attempts that failed (error set, no content, stop_reason Failed).

Source:<builtin>/ai/turn.bamlbytes 984–3046

Fields

requested_model

string | null

child_turns

ai.ModelTurn[]

Instance methods

function

all_calls

(self) -> ai.events.ModelCall[] throws never

Every call behind this turn: its own, then each child's, oldest first.

function

media

(self) -> ai.MediaPart[] throws never

The media payloads the turn produced, in order. A media-shaped output type is built from these instead of from the terminal text.

function

terminal_text

(self) -> string | null throws never

The terminal Text block — the final candidate the runner parses.

function

tool_uses

(self) -> ai.content.ToolUse[] throws never

The ToolUse blocks of the turn, in order.