Skip to content

Threads and configuration

Scope boundaries

UNSET vs None

  • UNSET: omit field from request payload
  • None: send explicit JSON null (where allowed by protocol)
from codex_app_server_sdk import ThreadConfig, UNSET

cfg = ThreadConfig(
    model=UNSET,
    developer_instructions=None,
)

Thread lifecycle

High-level methods:

ThreadHandle wraps these operations for one thread id.

Setting model/cwd/instructions

Thread-level defaults belong on thread methods (thread/start, thread/resume, thread/fork). Per-turn changes belong in TurnOverrides.

For persistent thread behavior:

thread = await client.start_thread(
    ThreadConfig(
        cwd=".",
        base_instructions="Be concise",
        developer_instructions="Focus on correctness",
        model="gpt-5.3-codex",
    )
)