Skip to content

Turn

Base classes

Name Children Inherits
CodexBaseModel
codexed.models.base
Base model for all Codex API models.

⋔ Inheritance diagram

graph TD
  2719269636["v2_protocol.Turn"]
  3116041069["base.CodexBaseModel"]
  3879467795["main.BaseModel"]
  2751680898["builtins.object"]
  3116041069 --> 2719269636
  3879467795 --> 3116041069
  2751680898 --> 3879467795

🛈 DocStrings

Bases: CodexBaseModel

Source code in src/codexed/models/v2_protocol.py
class Turn(CodexBaseModel):
    completed_at: int | None = None
    """
    Unix timestamp (in seconds) when the turn completed.
    """
    duration_ms: int | None = None
    """
    Duration between turn start and completion in milliseconds, if known.
    """
    error: TurnError | None = None
    """
    Error associated with a failed or interrupted turn.
    """
    id: str
    """
    Identifier for this turn. Codex-generated turn IDs are UUIDv7.
    """
    items: list[ThreadItem]
    """
    Thread items currently included in this turn payload.
    """
    items_view: TurnItemsView | None = "full"
    """
    Describes how much of `items` has been loaded for this turn.
    """
    root_turn_id: str | None = None
    """
    ID of the first turn in the chain of work that led to this turn. Pass this as `rootTurnId` when starting work on behalf of this turn. May be null in older history or a `review/start` response.
    """
    started_at: int | None = None
    """
    Unix timestamp (in seconds) when the turn started.
    """
    status: TurnStatus

completed_at class-attribute instance-attribute

completed_at: int | None = None

Unix timestamp (in seconds) when the turn completed.

duration_ms class-attribute instance-attribute

duration_ms: int | None = None

Duration between turn start and completion in milliseconds, if known.

error class-attribute instance-attribute

error: TurnError | None = None

Error associated with a failed or interrupted turn.

id instance-attribute

id: str

Identifier for this turn. Codex-generated turn IDs are UUIDv7.

items instance-attribute

items: list[ThreadItem]

Thread items currently included in this turn payload.

items_view class-attribute instance-attribute

items_view: TurnItemsView | None = 'full'

Describes how much of items has been loaded for this turn.

root_turn_id class-attribute instance-attribute

root_turn_id: str | None = None

ID of the first turn in the chain of work that led to this turn. Pass this as rootTurnId when starting work on behalf of this turn. May be null in older history or a review/start response.

started_at class-attribute instance-attribute

started_at: int | None = None

Unix timestamp (in seconds) when the turn started.

:fa-brands-github: Show source on GitHub