Setting Up Cloud Sandboxes
So far, you have been using Codex CLI, which runs locally on your machine. Now it is time to explore Codex Cloud, a fundamentally different way of working with AI coding agents. Instead of one agent on your laptop, you get multiple agents running simultaneously in isolated cloud environments.
What You Will Learn
- What Codex Cloud is and how it differs from the CLI
- How cloud sandboxes work and why isolation matters
- How to reach Codex cloud from the web, the desktop app, and the terminal
- How cloud environments set up your repository, tools, secrets, and network access
- How to launch your first cloud task
- How tasks connect back to your repository
What Is Codex Cloud?
Codex Cloud is the cloud-based counterpart to Codex CLI. While the CLI runs a single agent on your local machine, Codex Cloud runs agents in sandboxed environments on OpenAI's infrastructure.
Each cloud task gets its own isolated sandbox: a complete environment with its own filesystem, dependencies, and execution context. This means:
- Tasks cannot interfere with each other. One agent's work does not affect another's.
- Your local machine stays clean. No rogue processes, no unexpected file changes.
- Tasks run in the background. You do not need to keep a terminal open.
- Multiple tasks run in parallel. You can dispatch several tasks at once.
Think of it like having a team of developers, each working in their own branch on their own machine, all at the same time.
Accessing Codex Cloud
There are a few ways to reach Codex cloud:
The Web and the Desktop App
Sign in to ChatGPT on the web (or go to chatgpt.com/codex) or open the ChatGPT desktop app. Start a chat and choose Work in > Cloud. On macOS and Windows you can open the desktop app from your terminal with:
codex app
On mobile, open Codex in the ChatGPT app.
The Terminal
You can also start cloud work from the CLI:
codex cloud
This lets you browse active and finished cloud tasks, send work to a configured environment, and apply the results to your local repository. The docs mark it as experimental.
All of these use the same account, so you can start a task in one place and check on it in another.
Understanding Cloud Sandboxes
A cloud sandbox is an isolated execution environment. When you create a task in Codex Cloud, here is what happens behind the scenes:
- Environment creation: A fresh sandbox is provisioned with a clean filesystem
- Repository cloning: Your repository is cloned into the sandbox
- Dependency installation: Project dependencies are installed (npm install, pip install, etc.)
- Task execution: The Codex agent runs your task within this environment
- Result generation: The agent produces a set of changes (a diff) that you can review
- Cleanup: When the task is done, you can review the changes and apply them to your repository
Each sandbox runs independently. If you have five tasks running, that is five separate environments, each with its own copy of your code.
Setting Up an Environment
An environment tells Codex cloud how to prepare the sandbox for your tasks. It is how you reproduce your setup in the cloud and control what each sandbox can reach.
An environment can include:
- Repositories: Codex can check out repositories from your connected GitHub or GitLab account
- An install script: Commands that install your dependencies and tools
- Network settings: Choose public internet access, package manager domains only, or extra allowed domains
- Secrets: Credentials for allowed HTTPS services
- Environment variables
- Access: Who can use the environment, for example only you or everyone in your workspace
There are two kinds:
- The default environment lets you start a task without choosing a repository, if it is available to you.
- A published environment saves a setup you can reuse across tasks. Each task still gets its own fresh workspace, and you can update the setup as your project changes.
Keep network access as narrow as the task allows. If a task only needs to install packages, allowing package manager domains is safer than opening the whole internet.
Launching Your First Cloud Task
With an environment ready, launching a task is straightforward:
- Start a chat in ChatGPT on the web or desktop app
- Choose Work in > Cloud and pick an environment
- Type your task and send it
For example:
Add input validation to all API endpoints in src/routes/ โ validate request bodies,
return 400 status codes for invalid inputs, and add appropriate error messages
The task is dispatched to a cloud sandbox and begins running immediately. You will see a progress indicator as the agent works through the task.
Reviewing Task Results
When a task completes, Codex presents the results as a set of changes you can review:
- File diffs: See exactly what was added, modified, or deleted
- Agent reasoning: Read the agent's thought process and decisions
- Command output: See the results of any commands the agent ran (tests, builds, etc.)
You have several options:
- Open a pull request or commit: Bring the agent's changes into your repository
- Apply locally: Pull the changes into your local repository, for example with
codex cloud - Request revisions: Ask for changes in the same chat
- Discard: Throw away the changes if they are not what you wanted
Cloud vs CLI: When to Use Which
| Aspect | CLI | Cloud |
|---|---|---|
| Execution | Your local machine | OpenAI's servers |
| Parallelism | One task at a time | Multiple simultaneous tasks |
| File access | Direct access to your filesystem | Works on a cloned copy |
| Speed to start | Instant (already on your machine) | Requires sandbox setup |
| Best for | Interactive development, quick fixes | Background tasks, parallel work |
| Permissions | Permission modes (/permissions) | Set by the environment (network, secrets) |
| Requires terminal | Yes | No (web or app interface) |
The two modes complement each other. Use the CLI for interactive, hands-on work where you want to see changes in real time. Use Cloud for tasks you want to fire off and check on later.
Key Takeaways
- Codex Cloud runs agents in isolated sandboxes on OpenAI's infrastructure, not your local machine
- Each task gets its own clean environment with your repository cloned in
- Start cloud tasks from ChatGPT on the web or desktop app (Work in > Cloud), or with
codex cloudin the terminal - Environments set up each sandbox: repositories, install script, network access, secrets, and environment variables
- Task results are presented as diffs you can review, apply, or discard
- Use CLI for interactive work and Cloud for background or parallel tasks
- Cloud sandboxes ensure tasks cannot interfere with each other or your local environment
Quiz
Up next ยท Lesson 7 of 11
Running Parallel Tasks and Managing Agent Threads
5 min read
6 of 11 lessons done

Ask Byte about this lesson
A private chat about this lesson. Byte has read the whole lesson, answers in seconds, and shows the section each answer comes from. Ask follow-ups in any language.
Questions & Answers
Public questions about this lesson. The AI Tutor answers right away in your language, the FreeAcademy team checks answers, and every learner can read them.

