Back Home

AI 開發工具

Codex Python SDK 0.154 Lets External Events Enter Active Turns While Explicitly Limiting Their Instruction Authority

The new `ExternalMessage` can deliver events from tools, other agents, or applications to a Codex turn already in progress, while marking them as having tool-level authority—below user and developer instructions. The release also adds history-loading and per-turn service-tier controls, but upgrading involves compatibility changes to event streams and hook structures.

Esculenta · CC BY-SA 4.0 · Image source
zh-Hant

OpenAI released version 0.154.0 of the `openai-codex` Python SDK on September 10, addressing a common but easily mishandled requirement in agent systems: receiving deployment notifications, outputs from other agents, or external application events after work has already begun. The new `ExternalMessage` can be passed as input to `run()` and `turn()`, or added to a normal turn already in progress. Both synchronous and asynchronous clients are supported, and each consumer receives an independent event stream.

The key is not merely that external sources can “interject,” but that the SDK does not disguise their content as user messages. External messages are assigned tool-level authority, so they cannot approve actions or expand the permissions of the original task. Applications must still establish user goals, sandboxes, and approval policies separately. This makes it less likely that Slack notifications, CI results, or multi-agent handoffs will accidentally gain elevated privileges through their textual content. It does not, however, make that content trustworthy: prompt-injection defenses and data validation remain the integrator’s responsibility.

Version 0.154.0 also allows `resume` and `fork` to use `include_turns` to determine whether responses include existing turns, and adds `turn_service_tier` plus source metadata for an individual new turn. Importantly, `include_turns=False` only reduces the history returned; it does not clear the model context. A manually created turn handle that attaches late will not replay earlier events and may even receive a `TransportClosedError` after the work has completed. When a complete record is required, use `thread.read(include_turns=True)` instead.

Upgraders must also account for the `HookMetadata` handler moving to `.root`, as well as some notifications switching from generic `.params` to typed fields. The package includes the matching 0.154.0 CLI runtime; if a custom binary is specified, it must be at least CLI version 0.151.0. The next area to watch is how external messages behave under heavy concurrency—including ordering, deduplication, and audit semantics—rather than merely confirming that events were delivered successfully.

Sources

  1. Python SDK 0.154.0 release
  2. openai-codex 0.154.0