From 641b41a434f163597644804623f7df0c673af4fd Mon Sep 17 00:00:00 2001 From: "fangyaozheng@bytedance.com" Date: Tue, 9 Jun 2026 11:55:57 +0800 Subject: [PATCH] fix(runtime): import AsyncCodex from openai_codex, not codex_app_server MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- veadk/runtime/__init__.py | 4 ++-- veadk/runtime/codex/runtime.py | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/veadk/runtime/__init__.py b/veadk/runtime/__init__.py index d5c5a66f3..350e10cdd 100644 --- a/veadk/runtime/__init__.py +++ b/veadk/runtime/__init__.py @@ -61,8 +61,8 @@ def get_runtime(name: str) -> BaseRuntime: except ModuleNotFoundError as e: raise ImportError( f"The 'codex' runtime requires extra dependencies (missing: {e.name}). " - "Install the Codex binary and the codex_app_server SDK, plus: " - "pip install fastapi uvicorn" + "Install them with: pip install openai-codex fastapi uvicorn " + "(openai-codex bundles the Codex binary via openai-codex-cli-bin)." ) from e return CodexRuntime() diff --git a/veadk/runtime/codex/runtime.py b/veadk/runtime/codex/runtime.py index c6e066430..4bd835c4b 100644 --- a/veadk/runtime/codex/runtime.py +++ b/veadk/runtime/codex/runtime.py @@ -28,7 +28,8 @@ - Codex only speaks the Responses API, so requests are routed through an in-process Responses→chat shim (see :mod:`veadk.runtime.codex.proxy`). -Note: this requires the Codex binary on PATH and the ``codex_app_server`` SDK. +Note: this requires the ``openai-codex`` SDK (``pip install openai-codex``), +which bundles the Codex CLI binary via its ``openai-codex-cli-bin`` dependency. """ from __future__ import annotations @@ -37,7 +38,7 @@ import tempfile from typing import TYPE_CHECKING, AsyncGenerator -from codex_app_server import AsyncCodex # type: ignore[import-not-found] +from openai_codex import AsyncCodex # type: ignore[import-not-found] from veadk.runtime.base_runtime import BaseRuntime, build_system_append from veadk.runtime.codex.proxy import get_shim_url