Codex . Intermediate . 56 min
Codex CLI and Cloud Agents
Use OpenAI's Codex CLI safely in your terminal, configure it with AGENTS.md, and delegate work to cloud agents whose pull requests your team can review with confidence.
What your team will learn
- Run Codex CLI on a real repository and understand what it can read, write, and execute
- Pick an approval and sandbox setting that matches the risk of the task
- Write an AGENTS.md that gives Codex the commands, conventions, and limits of your project
- Delegate well-scoped tasks to cloud agents and review the resulting pull requests rigorously
- Run several agent tasks in parallel without conflicts or lost work
Outline
- Codex CLI basics (14 min, 3-question quiz)
- Approval and sandbox modes (14 min, 4-question quiz)
- Configuring Codex with AGENTS.md (14 min, 3-question quiz)
- Cloud agents, PR review, and parallel task hygiene (14 min, 4-question quiz)
Free lesson
Codex CLI basics
Codex CLI is OpenAI's open source coding agent that runs in your terminal, published on GitHub under the Apache-2.0 license. You give it a task in natural language, and it reads files, proposes edits, and runs commands inside your working directory. OpenAI publishes a standalone installer for macOS and Linux, plus npm, Homebrew and Windows options. Install steps change, so check the Codex docs on developers.openai.com before rolling it out to a team. On first run you sign in, usually with your ChatGPT account.
The interaction model
Running the command in a repository starts an interactive session. You type a request, Codex explores the code with shell commands such as listing files and searching, then proposes changes as diffs and may ask to run commands such as your test suite. For scripts and CI there is codex exec, which takes a prompt, runs to completion and exits. Flags change between releases, so confirm anything beyond the basics with codex --help.
cd ~/code/my-service
codex # start an interactive session
codex "explain how auth middleware is wired up"
codex exec "run the tests and summarize failures" # non-interactive
codex --help # current flags, modes, and subcommandsA good first session
- Start on a clean branch with no uncommitted work, so every change Codex makes is easy to see and discard.
- Begin with a read-only question: ask it to explain a module. This shows you how it explores and whether it understands the codebase.
- Give it a small, testable task with an explicit check, such as "add input validation to createUser and make pnpm test pass".
- Read the diff with git diff before accepting anything into a commit.
Models and cost
Codex can be pointed at different OpenAI models, and authentication may go through a ChatGPT plan or an API key depending on your setup. Billing and model availability vary by plan and change over time. For teams, decide up front which account type engineers use, and set usage expectations, because an agent that loops on a failing test can consume far more usage than a chat session.
Codex is most productive on the same kinds of tasks as any coding agent: bounded bug fixes, test writing, mechanical refactors, and explaining unfamiliar code. It is weakest when the task needs product judgment or knowledge that lives outside the repo. Supply that knowledge in the prompt or in AGENTS.md rather than expecting the agent to guess.
Exercise
First session on a real repo
- Install Codex CLI following the current official instructions and sign in.
- In a clean branch of a repository you know well, ask Codex to explain one module. Note anything it got wrong.
- Ask it to write a missing unit test for that module and run it.
- Review the diff with git diff, then either commit it or discard it with git checkout.
Keep going with your team
The other 3 lessons, quizzes, progress tracking, due dates and certificates come with the Training add-on at $12 per learner per month.
Get startedIndependent course. Not affiliated with or endorsed by Anthropic, OpenAI or Anysphere.