Problem
OpenAI released Codex as a cloud-based software engineering agent in May 2025, distinct from the older Codex API that powered code completion. The new Codex runs in a sandboxed environment, operates asynchronously on coding tasks, and organizes work into projects and threads — concepts that don’t map directly to a typical chat interface or IDE plugin. Developers arriving from the original Codex API or from tools like GitHub Copilot often expect inline code suggestions, not a task-based agent workflow.
This guide covers the setup process described in OpenAI’s Academy onboarding for Codex, focusing on creating projects, opening threads, and structuring prompts that produce usable output.
Quick answer
Codex uses a project → thread → task hierarchy. You create a project to group related work (similar to a repository), open a thread within that project to start a focused task session, and submit a natural-language prompt describing the coding work. Codex spins up a sandboxed cloud environment, writes or modifies code, and returns results — including diffs, new files, or explanations — within the thread. Each thread retains conversational context so you can iterate without restating the full problem.
NOTE
The current Codex agent (2025) is a different product from the legacy Codex API (2021–2023) that powered early GitHub Copilot completions. The new Codex operates as an asynchronous coding agent accessed through ChatGPT or the OpenAI Academy, not as an inline autocomplete model. If you previously used the Codex API, expect a fundamentally different interaction model.
Step-by-step workflow
1. Access Codex
Codex is available to ChatGPT Pro, Team, and Enterprise users through the ChatGPT interface and through OpenAI’s Academy onboarding at openai.com/academy/codex-how-to-start. The Academy page provides a guided walkthrough alongside the tool itself. You need an OpenAI account with an eligible plan to proceed.
2. Create a project
A project in Codex acts as a container for related threads and tasks — analogous to a repository or workspace. According to the Academy onboarding, you create a project by navigating to the project creation option in the Codex interface and assigning a descriptive name (e.g., the name of your application, library, or problem domain).
Projects persist between sessions. When you return, your projects are listed with their threads intact, so you resume work without re-explaining the codebase or goal.
TIP
Name projects after the specific codebase or feature area, not generic labels like “Testing” or “Backend.” A name like invoice-pdf-generator or auth-service-refactor makes it immediately clear what context the threads inside carry, especially when you accumulate multiple projects.
3. Open a thread
Within a project, work happens inside threads. A thread is a single task session with its own conversational context — the model can reference earlier messages in that thread when generating responses.
To start a thread, select your project and use the new-thread option. Multiple threads per project are supported. For example, you might have one thread for debugging a specific function and another for writing tests against the same module.
4. Submit your first task
With a thread open, write a prompt that specifies what you want the code to do, which language or framework to use, and any constraints. Codex responds to specificity — vague requests like “write some code” or “help me with Python” produce generic output.
Examples of effective first prompts:
- “Write a Python function that reads a CSV file and returns only the rows where the value in column B exceeds 100. Use the csv module from the standard library.”
- “Create a JavaScript function that debounces user input with a 300ms delay. It should cancel the previous timer on each new keystroke.”
- “Here is a function [paste code]. Explain what it does, identify any edge cases it misses, and suggest a refactored version that improves readability.”
The third example shows that Codex handles explanation and refactoring tasks, not just generation from scratch.
5. Review and iterate
Codex returns its response in the thread. Because the agent runs in a sandboxed environment, it may produce file diffs, new files, or inline explanations depending on the task.
Review all generated code before using it. If the output is close but incomplete, follow up in the same thread with a targeted correction — for example: “This works, but add error handling for the case where the file path does not exist.” Thread context means Codex understands the referent without you repeating the full task.
This iterative loop — prompt, review, refine — is the core workflow. Rather than starting over on each attempt, you narrow the output through conversation.
WARNING
Codex can produce code that appears correct but contains logical errors, misses edge cases, or uses deprecated APIs. According to OpenAI’s own documentation, all generated code should be reviewed and tested before use in production. Do not deploy Codex output without running it through your test suite and manual review.
Key concepts at a glance
| Concept | What it is | Practical analogy |
|---|---|---|
| Project | A container grouping related threads and tasks | A repository or workspace folder |
| Thread | A single task session with retained context | A focused conversation about one problem |
| Task/Prompt | A natural-language request submitted in a thread | A ticket or issue description |
| Sandbox | The cloud environment where Codex executes work | A disposable VM or container |
Limits
- Context window: Each thread has a finite context window. Long threads with large code blocks may eventually cause the model to lose track of earlier messages. Starting a new thread with a concise summary of the current state is a practical workaround when this happens.
- Code accuracy: As noted above, Codex output can contain bugs, logic errors, or deprecated patterns. Treat generated code as a draft, not a finished product.
- No persistent execution environment: Codex generates and proposes code but does not maintain a long-running server or database between tasks. Each task runs in a fresh sandbox.
- Plan requirements: Codex access requires a ChatGPT Pro, Team, or Enterprise plan. Free-tier users do not have access as of mid-2025.
Alternatives
If the project-and-thread model does not fit your workflow, other AI coding tools take different approaches:
| Tool | Integration model | Primary strength |
|---|---|---|
| GitHub Copilot | Inline in VS Code, JetBrains, Neovim | Real-time autocomplete and suggestions as you type |
| Cursor | Standalone AI-native editor (VS Code fork) | Multi-file context and codebase-wide queries |
| Replit AI | Browser-based editor with built-in execution | Write, run, and get AI help without local setup |
| Amazon CodeWhisperer | IDE plugin (VS Code, JetBrains, AWS Cloud9) | AWS SDK and service integration |
Codex occupies a different niche: it is a task-based agent you send work to asynchronously, rather than a real-time copilot embedded in your editor. This makes it better suited for discrete, well-defined tasks (write this function, refactor this module, explain this code) than for continuous inline assistance while typing.