Skip to content

fix(runtime): import AsyncCodex from openai_codex, not codex_app_server - #591

Merged
zakahan merged 1 commit into
mainfrom
fix/codex-runtime-import
Jun 9, 2026
Merged

zakahan merged 1 commit into
mainfrom
fix/codex-runtime-import

Conversation

@yaozheng-fang

Copy link
Copy Markdown
Collaborator

Problem

Agent(runtime="codex") fails at import:

ImportError: The 'codex' runtime requires extra dependencies (missing: codex_app_server).

veadk/runtime/codex/runtime.py imported from codex_app_server import AsyncCodex, but codex_app_server does not exist on PyPI (404). The OpenAI Codex Python SDK publishes the symbol as openai_codex.AsyncCodex (pip install openai-codex).

Fix

  • Import AsyncCodex from openai_codex. Its API matches our existing usage unchanged: async with AsyncCodex() → thread_start(model=...) → await thread.run(prompt).
  • Update the docstring and the get_runtime error message to point at the real package.

Pure-pip, no binary setup

openai-codex depends on openai-codex-cli-bin, which ships the Codex CLI binary as a platform wheel (installed under site-packages/codex_cli_bin/bin/). The SDK locates it automatically — no npm/brew/PATH setup required. The runtime's other deps (fastapi, uvicorn) are unchanged.

Install:

pip install openai-codex fastapi uvicorn

Verification

With openai-codex installed, a minimal Agent(runtime="codex") run now executes end-to-end through the runtime — loads the bundled binary, starts a thread, and reaches a live model turn (the only remaining error observed was a transient upstream "high demand" from the bridged model backend, not a code/setup issue).

ruff check + format pass (pre-commit).

The codex runtime imported `from codex_app_server import AsyncCodex`, but that
package does not exist on PyPI (404). The OpenAI Codex Python SDK publishes the
symbol as `openai_codex.AsyncCodex` (pip install openai-codex), whose API
matches our usage (AsyncCodex() context manager -> thread_start(model=...) ->
thread.run(prompt)). Fix the import and the dependency hints.

openai-codex bundles the Codex CLI binary via its openai-codex-cli-bin
dependency, so no separate binary / PATH setup is needed — pip install is enough.
Verified end-to-end: the runtime now reaches a live model turn.
@zakahan
zakahan merged commit 60e0aaf into main Jun 9, 2026
16 checks passed
PolarisCzh pushed a commit to PolarisCzh/veadk-python that referenced this pull request Sep 23, 2026
…er (volcengine#591)

The codex runtime imported `from codex_app_server import AsyncCodex`, but that
package does not exist on PyPI (404). The OpenAI Codex Python SDK publishes the
symbol as `openai_codex.AsyncCodex` (pip install openai-codex), whose API
matches our usage (AsyncCodex() context manager -> thread_start(model=...) ->
thread.run(prompt)). Fix the import and the dependency hints.

openai-codex bundles the Codex CLI binary via its openai-codex-cli-bin
dependency, so no separate binary / PATH setup is needed — pip install is enough.
Verified end-to-end: the runtime now reaches a live model turn.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants