Codex.Thread (Codex SDK v0.3.0)
View SourceRepresents a Codex conversation thread and exposes turn execution APIs.
Summary
Functions
Executes a blocking multi-turn run using the agent runner.
Executes an auto-run loop, retrying while a continuation token is present.
Executes a run and returns a stream of events for progressive consumption.
Types
@type t() :: %Codex.Thread{ codex_opts: Codex.Options.t(), continuation_token: String.t() | nil, labels: map(), metadata: map(), pending_tool_failures: [map()], pending_tool_outputs: [map()], thread_id: String.t() | nil, thread_opts: Codex.Thread.Options.t(), transport: :exec | {:app_server, pid()}, transport_ref: reference() | nil, usage: map() }
Functions
Executes a blocking multi-turn run using the agent runner.
@spec run_auto(t(), String.t(), keyword()) :: {:ok, Codex.Turn.Result.t()} | {:error, term()}
Executes an auto-run loop, retrying while a continuation token is present.
Options:
:max_attempts– maximum number of attempts (default: 3):backoff– unary function invoked with current attempt (default: exponential sleep):turn_opts– per-turn options forwarded to each attempt
@spec run_streamed(t(), String.t(), map() | keyword()) :: {:ok, Codex.RunResultStreaming.t()} | {:error, term()}
Executes a run and returns a stream of events for progressive consumption.
The stream is lazy; events will not be produced until enumerated.