codex

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: Apache-2.0 Imports: 12 Imported by: 0 modules, 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 adapts the Codex CLI (`codex exec`) into an inference backend.

The CLI is launched non-interactively with the read-only sandbox, in an empty scratch directory, with no session persisted and a sanitized environment: agent2api uses it as a plain LLM, never as an agent that touches the machine.

Index

Constants

View Source
const DefaultSandbox = config.DefaultSandbox

DefaultSandbox is the sandbox mode used when adapters.codex.sandbox is not set. It mirrors the config default rather than restating it, so the two cannot drift; the adapter keeps its own fallback because Options can be built without going through the config layer at all.

View Source
const ID = "codex"

ID is the adapter id used to namespace this backend's models.

Variables

This section is empty.

Functions

func New

func New(opts adapter.Options) (adapter.Adapter, error)

New builds the adapter from its resolved configuration.

Types

type Adapter

type Adapter struct {
	// contains filtered or unexported fields
}

Adapter is the Codex backend.

func (*Adapter) EffortLevels added in v0.1.5

func (a *Adapter) EffortLevels(context.Context) []ir.Effort

EffortLevels implements adapter.EffortSetter.

The knob is a config override rather than a flag, and `-c` is always available, so there is nothing to probe for.

Worth knowing before trusting a level end to end: codex turns it into a `thinking_budget` for the upstream endpoint, and the endpoint decides whether that number is acceptable. Against the third-party provider on the recording machine, `low` worked and `high` came back `400 InternalError.Algo. InvalidParameter: The thinking_budget parameter must be a positive integer and not greater than …`. That surfaces as an honest upstream error rather than a silent downgrade, which is the behaviour to keep — but it means a level this adapter accepts can still be refused further up.

func (*Adapter) ID

func (a *Adapter) ID() string

ID implements adapter.Adapter.

func (*Adapter) Probe

func (a *Adapter) Probe(ctx context.Context) (adapter.Health, error)

Probe checks that the CLI is installed, exposes the flags agent2api needs, and is logged in. It sends no prompt, so it costs nothing.

func (*Adapter) Run

func (a *Adapter) Run(ctx context.Context, req ir.Request) (<-chan ir.Event, error)

Run executes one request as a fresh CLI process.

Jump to

Keyboard shortcuts

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