codex

package
v2.0.0-...-18254e1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 35 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package codex provides the built-in Driver implementation for Codex.

Construct a configured driver with Driver and pass it to adaptor.New:

agent := adaptor.New(codex.Driver(codex.Config{
	Model: "gpt-5.4",
}))

Driver snapshots its configuration without performing environment I/O. Configuration validation and transport availability checks occur when the agent runs or is inspected. The appserver subpackage contains the typed Codex app-server transport used when that transport is selected.

App-server invocations deliver messages with turn/steer (Codex >=0.100.0), interrupt and restart in the same thread, and consume turn-end continuations inside one driver Run. Exec invocations expose continuation through resume only. The driver probes the configured CLI version and falls back to resume when it cannot verify the minimum version required for in-run delivery. Interrupt RPC errors retain messages until the active turn completes: a natural completion delivers them in a normal continuation, and a failed turn requeues them for core to continue delivery. Permission policy applies to every SDK-declared MCP server, including the private WithTools endpoint and host-supplied WithMCP declarations. Auto-approve sets default_tools_approval_mode to "approve"; Ask and Auto-deny set "prompt". SDK-declared servers remain enabled under every filesystem sandbox, including read-only: the host controls its tools' side effects. Auto-deny requests use the core rejection policy. The default renderer preserves explicit server defaults and exact tool settings; this version's MCP API does not expose those explicit policies. Servers owned solely by the user's native profile retain their own settings. Invocation config overrides prevent shared-profile policy races. SyncProfile has no execution policy and materializes the prompt fallback; Send applies its resolved permission policy when preparing the invocation.

App-server MCP confirmation elicitations (empty object forms and URL consent), shell approvals, and file approvals route through the core approval handler. Nonempty elicitation forms require structured user input and are explicitly unsupported; they are never auto-approved as permission confirmations.

Notifications for unrelated threads/turns are ignored. Late usage for turns owned by the current execution updates their accounting without repeating TurnCompleted. TurnCompleted reports usage observed at completion; Response includes all usage observed before return. A resident process also observes idle usage snapshots so the next run excludes historical usage. Returned results are immutable and are not revised by notifications arriving later.

Native structured output always selects app-server, independently of whether the consumer reads Events or Result and whether provider streaming was requested. The resolved mechanism remains core-owned: prompt validation does not send a native schema. Native output schemas are sent on every turn/start, including continuation and interrupt restarts, and the final turn is validated before completion. Responses retain all turns' raw streams and transcript, sum their observed usage, and expose the last turn's assistant text and terminal payload.

Index

Constants

View Source
const DriverType = "codex"

DriverType is the stable descriptor type for the built-in Codex driver.

Variables

This section is empty.

Functions

func Driver

func Driver(cfg Config) driver.Driver

Driver returns the Codex driver with cfg captured at construction. Pass the result to adaptor.New. Config validation stays deferred to run/probe time: Driver never panics or validates eagerly.

Types

type CommonConfig

type CommonConfig = driver.CommonConfig

CommonConfig carries the provider-independent CLI and process defaults embedded by Config: command, cwd, env, instructions, prompt templates, workspace strategy/runtime, timeouts, and extra args.

type Config

type Config struct {
	CommonConfig
	// Model selects the Codex model. Empty uses the driver's default.
	Model string
	// ReasoningEffort overrides the model reasoning effort.
	ReasoningEffort ReasoningEffort
	// FastMode requests Codex's fast service tier defaults.
	FastMode bool
}

Config configures the Codex driver.

CommonConfig controls process, profile, and workspace defaults. Model, ReasoningEffort, and FastMode select Codex model and service-tier settings.

type ReasoningEffort

type ReasoningEffort string

ReasoningEffort is the Codex reasoning effort value ("low", "medium", "high", or "xhigh"). The empty value leaves the Codex default in place.

Directories

Path Synopsis
Package appserver is a typed client for the codex app-server JSON-RPC protocol over stdio.
Package appserver is a typed client for the codex app-server JSON-RPC protocol over stdio.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL