Codex.Exec (Codex SDK v0.6.0)

Copy Markdown View Source

Process manager wrapping the codex binary via erlexec.

Provides blocking and streaming helpers that decode JSONL event output into typed %Codex.Events{} structs.

Summary

Functions

Runs codex exec review and accumulates all emitted events.

Returns a lazy stream of events for codex exec review.

Runs codex in blocking mode and accumulates all emitted events.

Returns a lazy stream of events. The underlying process starts on first enumeration and stops automatically when the stream halts.

Types

exec_opts()

@type exec_opts() :: %{
  optional(:codex_opts) => Codex.Options.t(),
  optional(:thread) => Codex.Thread.t(),
  optional(:turn_opts) => map(),
  optional(:continuation_token) => String.t(),
  optional(:attachments) => [Codex.Files.Attachment.t()],
  optional(:output_schema_path) => String.t(),
  optional(:tool_outputs) => [map()],
  optional(:tool_failures) => [map()],
  optional(:env) => map(),
  optional(:clear_env?) => boolean(),
  optional(:cancellation_token) => String.t(),
  optional(:timeout_ms) => pos_integer()
}

Functions

review(target, opts)

@spec review(term(), exec_opts()) :: {:ok, map()} | {:error, term()}

Runs codex exec review and accumulates all emitted events.

review_stream(target, opts)

@spec review_stream(term(), exec_opts()) :: {:ok, Enumerable.t()} | {:error, term()}

Returns a lazy stream of events for codex exec review.

run(input, opts)

@spec run(String.t(), exec_opts()) :: {:ok, map()} | {:error, term()}

Runs codex in blocking mode and accumulates all emitted events.

run_stream(input, opts)

@spec run_stream(String.t(), exec_opts()) :: {:ok, Enumerable.t()} | {:error, term()}

Returns a lazy stream of events. The underlying process starts on first enumeration and stops automatically when the stream halts.