OpenAI releases Python and TypeScript SDKs for Codex
New SDKs allow developers to integrate Codex programmatically into CI/CD pipelines, internal tools, and custom applications using Python 3.10+ or Node.js 18+.
OpenAI has released Python and TypeScript SDKs for Codex, enabling developers to integrate the model programmatically into applications, internal workflows, and CI/CD pipelines. These libraries allow for the automation of coding tasks and the creation of custom agents capable of performing complex engineering work without requiring manual wrappers.
Managing threads and session state
The SDKs allow applications to start, continue, and resume local threads. Developers can identify specific integrations by setting a threadSource label during thread creation, which is preserved when a thread is resumed.
To optimize performance, the Python SDK supports resuming a thread without loading its full history by passing include_turns=False to thread_resume() or thread_fork(). The model retains the context, but the history can be retrieved separately via thread.read(include_turns=True).
When switching model providers, the codex.thread_fork(thread_id) method allows a user to continue from the same history on a new provider, provided they use Codex CLI 0.166.0 or later.
Sandbox environment and filesystem access
The SDK provides three presets for managing filesystem access within the sandbox. Sandbox.read_only allows reading files without write permissions, Sandbox.workspace_write enables writing inside the workspace and configured roots, and Sandbox.full_access removes all filesystem restrictions.
These presets can be applied during thread creation or changed for specific turns. For example, a developer can use workspace_write to make a change and then switch to read_only for a subsequent review turn.
Integration with external data and models
The Python SDK supports ExternalMessage to pass content from other agents or tools, such as an issue tracker. Codex treats this input as tool output, assigning it a lower priority than developer or user instructions.
The library supports specific models like gpt-6.1-sol for users with account access. For asynchronous applications, the AsyncCodex class is available. This programmatic control complements other Codex desktop developments by moving control to the API level.
Installation and configuration
The Python SDK requires Python 3.10 or later and is installed via:
pip install openai-codexThe TypeScript library requires Node.js 18 or later and is installed via:
npm install @openai/codex-sdkConfiguration can be managed through structured settings or raw TOML strings via configOverrides. Raw overrides take precedence over structured config, while managed settings like baseUrl take the highest priority.
Sources
Related news
- AI AgentsBuild programmatic agents with the new Cursor SDKCursor releases a TypeScript SDK in public beta, allowing developers to integrate its agent runtime, models, and orchestration into custom apps and CI/CD pipelines.·shared tag: Developer Tools
Open Sourceoh-my-codex adds a workflow layer to OpenAI Codex CLIA TypeScript toolkit that wraps Codex with persistent state, canonical skills, and a clarification-to-execution loop.·shared tag: Codex
- AI AgentsOpenAI adds native Chrome extension support to CodexCodex now integrates with Chrome on macOS and Windows, enabling background multi-tab processing and automated browser tasks.·shared tag: Codex
- AI AgentsCodex adds session handoff between local and remote hostsOpenAI's Codex now transfers full project state — code, Git history, and conversation — between a laptop and a remote server so developers can offload heavy agent work without losing context.·shared tag: AI Agents
- CodexOpenAI brings Codex to ChatGPT mobile app to manage workCodex is now available in preview for iOS and Android, allowing users to monitor and steer AI agents running on laptops, Mac minis, or remote environments from their phones.·shared tag: Codex
Open SourceOpenAI launches Codex for Open Source support programMaintainers of critical open-source projects can apply for 6 months of ChatGPT Pro, API credits, and Codex access to reduce development workloads.·shared tag: Codex
Comments
Weekly digest
The best of vibe coding, AI agents and open source — once a week, no spam.