All courses

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

Outline

  1. Codex CLI basics (14 min, 3-question quiz)
  2. Approval and sandbox modes (14 min, 4-question quiz)
  3. Configuring Codex with AGENTS.md (14 min, 3-question quiz)
  4. Cloud agents, PR review, and parallel task hygiene (14 min, 4-question quiz)
Assign this course to your team

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 subcommands
Illustrative usage. Confirm commands with codex --help on your installed version.

A good first session

  1. Start on a clean branch with no uncommitted work, so every change Codex makes is easy to see and discard.
  2. Begin with a read-only question: ask it to explain a module. This shows you how it explores and whether it understands the codebase.
  3. Give it a small, testable task with an explicit check, such as "add input validation to createUser and make pnpm test pass".
  4. 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

  1. Install Codex CLI following the current official instructions and sign in.
  2. In a clean branch of a repository you know well, ask Codex to explain one module. Note anything it got wrong.
  3. Ask it to write a missing unit test for that module and run it.
  4. 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 started

Independent course. Not affiliated with or endorsed by Anthropic, OpenAI or Anysphere.