Lesson 485 of 2116
Codex With Sandboxed Execution: Running Untrusted Code Safely
When Codex executes tests, scripts, or generated code, you want it inside a sandbox. Microvms, containers, and ephemeral environments are the modern answer.
Lesson map
What this lesson covers
Learning path
The main moves in order
- 1Local is convenient, sandboxed is safe
- 2sandboxed execution
- 3ephemeral environment
- 4microvm
Concept cluster
Terms to connect while reading
Section 1
Local is convenient, sandboxed is safe
Running Codex on your laptop is fast and convenient — and the agent has access to everything your shell does. For untrusted scripts, generated code from issues, or open-source contributions, you want a sandbox: a fresh, isolated environment with limited network and zero secrets.
Sandbox options in 2026
- Codex Cloud sandboxes — built-in per-task containers
- Vercel Sandbox — Firecracker microVMs designed for AI agents
- Docker containers — fine for trusted code, weak isolation against hostile code
- Cloud dev containers — Codespaces or Gitpod with strict network policies
- Locally — only when the code is yours and the credentials are scoped
Compare the options
| Sandbox | Isolation strength | Best for |
|---|---|---|
| Microvm (Firecracker) | Strong — kernel boundary | Untrusted user code |
| Container | Medium — namespace boundary | Trusted-but-experimental code |
| Codex Cloud sandbox | Strong — managed | Default Codex tasks |
| Local shell | Weak — your laptop | Your own code only |
Applied exercise
- 1List three Codex tasks you have run on your laptop in the past month
- 2Mark each: would I run an unknown contributor's code in this same context?
- 3For any 'no', move that workflow into a sandbox before next week
- 4Add a checklist item to your team's onboarding: 'when to sandbox'
Key terms in this lesson
The big idea: sandboxes are cheap insurance. Use them by default, escalate to local only with intent.
End-of-lesson quiz
Check what stuck
15 questions · Score saves to your progress.
Tutor
Curious about “Codex With Sandboxed Execution: Running Untrusted Code Safely”?
Ask anything about this lesson. I’ll answer using just what you’re reading — short, friendly, grounded.
Progress saved locally in this browser. Sign in to sync across devices.
Related lessons
Keep going
Creators · 9 min
Citations And Source Verification: Perplexity's Biggest Win
Citations are the headline feature, but they only deliver if you actually click them. The verification habit is the skill — not the citation list.
Creators · 8 min
Sharing Perplexity Threads: Privacy And Accuracy
Sharable threads make Perplexity feel like a publishing tool. They are — but every share is a public record of your research and its mistakes.
Creators · 10 min
When Perplexity Hallucinates: Pattern-Spotting And Recovery
Perplexity hallucinates differently than ChatGPT. Recognizing those specific failure modes is the difference between catching them and embedding them in your work.
