Skip to content

Thread

Base classes

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

â‹” Inheritance diagram

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

🛈 DocStrings

Bases: CodexBaseModel

Source code in src/codexed/models/v2_protocol.py
class Thread(CodexBaseModel):
    agent_nickname: str | None = None
    """
    Optional random unique nickname assigned to an AgentControl-spawned sub-agent.
    """
    agent_role: str | None = None
    """
    Optional role (agent_role) assigned to an AgentControl-spawned sub-agent.
    """
    attached_to_thread_id: str | None = None
    """
    Parent that owns this persisted attached thread, independent of fork or spawn lineage.
    """
    can_accept_direct_input: bool | None = None
    """
    Whether the app server accepts direct turn input for this loaded thread. `None` means the capability is unavailable, such as for an unloaded stored thread.
    """
    cli_version: str
    """
    Version of the CLI that created the thread.
    """
    created_at: int
    """
    Unix timestamp (in seconds) when the thread was created.
    """
    cwd: AbsolutePathBuf
    """
    Working directory captured for the thread.
    """
    daybreak_enabled: bool | None = None
    """
    Saved Daybreak choice, independent of turn execution. Null if unset.
    """
    environments: list[ThreadEnvironment] | None = None
    """
    Current environments for a loaded thread, in priority order, primary first. `null` means the thread is not loaded or the server does not expose its selection. An empty list means no environments are selected. This does not report connection status.
    """
    ephemeral: bool
    """
    Whether the thread is ephemeral and should not be materialized on disk.
    """
    extra: ThreadExtra | None = None
    """
    Optional implementation-specific thread data.
    """
    forked_from_id: str | None = None
    """
    Source thread id when this thread was created by forking another thread.
    """
    git_info: GitInfo | None = None
    """
    Optional Git metadata captured when the thread was created.
    """
    history_mode: ThreadHistoryMode | None = "legacy"
    """
    Persisted thread history contract selected when this thread was created.
    """
    id: str
    """
    Identifier for this thread. Codex-generated thread IDs are UUIDv7.
    """
    model: str | None = None
    """
    Current configured model when loaded, otherwise the latest persisted model. Null when unavailable. This is not per-turn execution telemetry.
    """
    model_provider: str
    """
    Model provider used for this thread (for example, 'openai').
    """
    name: str | None = None
    """
    Optional user-facing thread title.
    """
    originator: str | None = None
    """
    Originator recorded when the thread was created, independent of its current client or executor. Null when the recorded originator is unavailable.
    """
    parent_thread_id: str | None = None
    """
    The ID of the parent thread. This will only be set if this thread is a subagent.
    """
    path: str | None = None
    """
    [UNSTABLE] Path to the thread on disk.
    """
    preview: str
    """
    Usually the first user message in the thread, if available.
    """
    project_id: str | None
    """
    Canonical project assignment owned by app-server, if any.
    """
    reasoning_effort: ReasoningEffort | None = None
    """
    Current configured reasoning effort when loaded, otherwise the latest persisted effort. Null when unset or unavailable. This is not per-turn execution telemetry.
    """
    recency_at: int | None = None
    """
    Unix timestamp (in seconds) used for thread recency ordering.
    """
    section: ThreadSection | None = None
    """
    The independently persisted section selected for this thread, if any.
    """
    section_entered_at: int | None = None
    """
    Unix timestamp in seconds when the thread entered its current section.
    """
    session_id: str
    """
    Session id shared by threads that belong to the same session tree.
    """
    source: SessionSource
    """
    Origin of the thread (CLI, VSCode, codex exec, codex app-server, etc.).
    """
    status: ThreadStatus
    """
    Current runtime status for the thread.
    """
    thread_source: ThreadSource | None = None
    """
    Optional analytics source classification for this thread.
    """
    turns: list[Turn]
    """
    Only populated on `thread/resume`, `thread/fork`, and `thread/read` (when `includeTurns` is true) responses. For all other responses and notifications returning a Thread, the turns field will be an empty list.
    """
    updated_at: int
    """
    Unix timestamp (in seconds) when the thread was last updated.
    """

agent_nickname class-attribute instance-attribute

agent_nickname: str | None = None

Optional random unique nickname assigned to an AgentControl-spawned sub-agent.

agent_role class-attribute instance-attribute

agent_role: str | None = None

Optional role (agent_role) assigned to an AgentControl-spawned sub-agent.

attached_to_thread_id class-attribute instance-attribute

attached_to_thread_id: str | None = None

Parent that owns this persisted attached thread, independent of fork or spawn lineage.

can_accept_direct_input class-attribute instance-attribute

can_accept_direct_input: bool | None = None

Whether the app server accepts direct turn input for this loaded thread. None means the capability is unavailable, such as for an unloaded stored thread.

cli_version instance-attribute

cli_version: str

Version of the CLI that created the thread.

created_at instance-attribute

created_at: int

Unix timestamp (in seconds) when the thread was created.

cwd instance-attribute

Working directory captured for the thread.

daybreak_enabled class-attribute instance-attribute

daybreak_enabled: bool | None = None

Saved Daybreak choice, independent of turn execution. Null if unset.

environments class-attribute instance-attribute

environments: list[ThreadEnvironment] | None = None

Current environments for a loaded thread, in priority order, primary first. null means the thread is not loaded or the server does not expose its selection. An empty list means no environments are selected. This does not report connection status.

ephemeral instance-attribute

ephemeral: bool

Whether the thread is ephemeral and should not be materialized on disk.

extra class-attribute instance-attribute

extra: ThreadExtra | None = None

Optional implementation-specific thread data.

forked_from_id class-attribute instance-attribute

forked_from_id: str | None = None

Source thread id when this thread was created by forking another thread.

git_info class-attribute instance-attribute

git_info: GitInfo | None = None

Optional Git metadata captured when the thread was created.

history_mode class-attribute instance-attribute

history_mode: ThreadHistoryMode | None = 'legacy'

Persisted thread history contract selected when this thread was created.

id instance-attribute

id: str

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

model class-attribute instance-attribute

model: str | None = None

Current configured model when loaded, otherwise the latest persisted model. Null when unavailable. This is not per-turn execution telemetry.

model_provider instance-attribute

model_provider: str

Model provider used for this thread (for example, 'openai').

name class-attribute instance-attribute

name: str | None = None

Optional user-facing thread title.

originator class-attribute instance-attribute

originator: str | None = None

Originator recorded when the thread was created, independent of its current client or executor. Null when the recorded originator is unavailable.

parent_thread_id class-attribute instance-attribute

parent_thread_id: str | None = None

The ID of the parent thread. This will only be set if this thread is a subagent.

path class-attribute instance-attribute

path: str | None = None

[UNSTABLE] Path to the thread on disk.

preview instance-attribute

preview: str

Usually the first user message in the thread, if available.

project_id instance-attribute

project_id: str | None

Canonical project assignment owned by app-server, if any.

reasoning_effort class-attribute instance-attribute

reasoning_effort: ReasoningEffort | None = None

Current configured reasoning effort when loaded, otherwise the latest persisted effort. Null when unset or unavailable. This is not per-turn execution telemetry.

recency_at class-attribute instance-attribute

recency_at: int | None = None

Unix timestamp (in seconds) used for thread recency ordering.

section class-attribute instance-attribute

section: ThreadSection | None = None

The independently persisted section selected for this thread, if any.

section_entered_at class-attribute instance-attribute

section_entered_at: int | None = None

Unix timestamp in seconds when the thread entered its current section.

session_id instance-attribute

session_id: str

Session id shared by threads that belong to the same session tree.

source instance-attribute

source: SessionSource

Origin of the thread (CLI, VSCode, codex exec, codex app-server, etc.).

status instance-attribute

status: ThreadStatus

Current runtime status for the thread.

thread_source class-attribute instance-attribute

thread_source: ThreadSource | None = None

Optional analytics source classification for this thread.

turns instance-attribute

turns: list[Turn]

Only populated on thread/resume, thread/fork, and thread/read (when includeTurns is true) responses. For all other responses and notifications returning a Thread, the turns field will be an empty list.

updated_at instance-attribute

updated_at: int

Unix timestamp (in seconds) when the thread was last updated.

:fa-brands-github: Show source on GitHub