Codex Python SDK: embed Codex in your Python apps
Melvin Vivas · X post · 2026-06-03 · Open on X
Topics: AI Agents, Tool Use & MCP, AI Dev Tools & Productivity · Level: intermediate
Summary
OpenAI released a Codex Python SDK that lets developers embed the Codex coding agent in their Python apps and workflows. It supports threads, turns, streaming, session resumption, image inputs and sandbox control, and it reuses your existing Codex auth.
Key points
- The Codex Python SDK embeds the Codex agent directly into Python apps and workflows.
- Start threads and run turns programmatically.
- Stream progress events while the agent works.
- Resume previous sessions.
- Pass images as input.
- Control sandbox access for safety, and reuse your existing Codex authentication; install it with pip.
Resources mentioned
- Codex Python SDK · tool · github.com · free
OpenAI's Python SDK for running Codex agent threads, turns and sessions from your own code. - OpenAI Codex · tool · openai.com · paid · recommended by both Bashiri Smith & Melvin Vivas
OpenAI's coding agent. In the diagram it writes code, fixes review findings and drives the build loop. The creator also used it to make this video.
Also in: Developers moving from ChatGPT/Codex to Claude (Melvin Vivas on X · notes), Creator Opinion: Codex Is Still the Best at Computer Use (Melvin Vivas on X · notes), OpenAI Codex Ambassador applications are open (Melvin Vivas on X · notes), GPT-Live-1.1: Multilingual Voice Update for ChatGPT and Codex (Melvin Vivas on X · notes) and 264 more
Try this
- Install the Codex Python SDK with pip and try starting a thread and streaming its progress.
- Build a Python automation that runs Codex in a sandbox to fix code or generate patches inside your workflow.
More in AI Agents, Tool Use & MCP
- Building a basic MCP server with GLM 5.2 in Claude Code
- Testing free GLM 5.2 in Devin Desktop to create an MCP server
- Sakana Fugu: Multi-Agent Orchestration Behind a Single Model API
- Dynamic workflows: Claude Code running hundreds of parallel subagents
- Cursor's /orchestrate Skill: Agents That Spawn Agents via the Cursor SDK
- Gemma 4 E4B Driving an iOS Simulator With Argent