Skip to content

Comprehensive Development Services to Accelerate Business Growth

From CRM solutions to web, mobile, AI, and custom software development.
Sandbox for AI coding agents showing a secure isolated coding environment with an AI programming assistant, code editor, and security shield
A secure sandbox for AI coding agents provides an isolated environment to execute code, test changes, and manage automated development tasks.

Sandbox for AI Coding Agents: Pydantic Pax Safe Setup

Pydantic Pax runs code with no sandbox or approval step. Learn how to set up a sandbox for AI coding agents, protect tokens and secure client repos.

Editorial Team

Pydantic has released Pax, a beta coding agent that works in your terminal. It reads your code, edits files and runs commands, and it shows each step as it goes. Its own documentation also says something every team should read twice: Pax runs commands and edits files as you, with no sandbox and no approval step. If you let agents work on client code, a sandbox for AI coding agents is no longer a nice extra. It is the baseline.

This guide follows our explainer on how agentic coding works. Here we cover why agents need isolation and approvals, how local micro-VMs compare with hosted options such as an E2B sandbox, where tokens can leak, and a safe default setup you can roll out this week.

TL;DR: Pydantic Pax has no sandbox or approval step by default, and its folder-trust prompt does not stop the agent from running code. Use its /sandbox command, prefer providers that keep your GitHub token outside the sandbox, and add your own human approval before anything is merged.

What Pydantic Pax Does, and What It Does Not

Pax is a terminal app built on the Pydantic AI Harness SDK. The team calls it beta, on the road to a 1.0 release alongside the Harness. You install it with uv tool install pydantic-ai-pax on Python 3.11 or newer. You can sign in with a ChatGPT subscription (/login openai-codex) or GitHub Copilot (/login github-copilot) without an API key, or bring your own keys through environment variables or a .env file. Everything is a plugin, and pax –agent can run your own Pydantic AI agent.

The safety note is blunt. The official Pax documentation says the agent works with your permissions, with no sandbox and no approval step, and advises running it only in projects you trust or moving the work into a sandbox. The DEV AI Daily Digest of 28 November 2026 summed it up well: the safety burden falls on the user and the project.

The Folder-Trust Prompt Is Not a Permission System

The first time Pax starts in a folder, it asks whether you trust its files and lists the instruction files, skills and agent folders it found. The default answer is No. That sounds safe, but in an untrusted folder the agent still reads, edits and runs code. The only change is that instruction files and skills reach the model as the repository’s, not yours. Pax remembers the answer per repository, and /trust shows or changes it.

So treat the trust prompt as a label, not a lock. It helps the model weigh repo instructions, but it does nothing for coding agent security on your machine. Only a real sandbox for AI coding agents does that.

Why Every Coding Agent Needs Isolation and Approval

A terminal agent that runs as you can reach everything you can: SSH keys, cloud command-line logins, .env files, other client folders and your package manager. Most of the time it only does what you asked. The problem is the rare time it does not.

  • Prompt injection: a README, issue or dependency file can carry text that tells the agent to run a command or send data somewhere.
  • Destructive commands: a cleanup step, a force push or a migration pointed at the database URL in your .env file.
  • Secret exposure: a token read from disk and pasted into a request, a log or a commit.
  • Supply chain mistakes: the agent installs a look-alike package to fix a missing import.

A sandbox limits how far a mistake can reach. That is the job of an approval step. AI agent work still needs a person to say yes before risky changes land in a real branch, a real database or a real cloud account. Pax ships with neither turned on, so you need a sandbox for AI coding agents and a human gate, and you need to set both up yourself.

Choosing a Sandbox for AI Coding Agents: Local vs Hosted

Related walkthrough

How to Use Twilio WhatsApp Sandbox to Send and Receive Messages Using Twilio WhatsApp Number?

Practical guidance from the Outright Systems team. Watch on YouTube

Pax’s /sandbox command starts a new conversation in an isolated environment instead of your launch folder. Local micro-VM providers are smol and BoxLite. Hosted providers are E2B, boxd, Daytona, OpenSandbox, Modal, Render, Sprites and Kubernetes. The file and shell tools behave the same in both cases, and ! shell commands run inside the sandbox.

Pax copies your current branch, its unpushed commits and your uncommitted changes, including untracked files. Your own checkout is not changed: uncommitted files are committed through a temporary index that no branch points to. If the repo is on GitHub, the sandbox clones from GitHub as you and only the missing commits are sent. Other checkouts are copied whole. A conversation stays in the sandbox where its first turn ran, including forks and resumed sessions.

Left: a local micro-VM keeps the token inside. Right: a proxy provider adds it from outside.

OptionWhere it runsGitHub token handlingGood fit
Local micro-VM (smol, BoxLite)Your machineToken saved inside the sandbox until it is deletedCode that must stay on your laptop
Hosted with proxy (E2B, boxd, Daytona, OpenSandbox)Provider’s cloudProxy adds the token from outside; the sandbox holds a stand-inClient repos and team work
Hosted without proxy (Modal, Render, Sprites, Kubernetes)Provider’s cloud or your clusterToken saved inside the sandboxTeams with existing infrastructure
No sandbox (Pax default)Your machine, as youFull access to your environmentThrowaway or fully trusted projects only

The Token-Leak Risk Most People Miss

Inside the sandbox, git and gh act as your gh login. With a proxy provider, the real token never enters the sandbox. With the others, Pax saves the token inside it, where anything running there can read it until the sandbox is deleted. That includes a package the agent just installed or a command planted through prompt injection. Pax tells you which case applies when the sandbox starts, so read that line.

If you pick an E2B sandbox or another proxy provider, a leaked token is much less likely. When you compare options for a sandbox for AI coding agents, this token detail matters more than speed. If your origin is not on GitHub, the sandbox has no credentials to push, which is a useful safety net.

A Safe Default Setup for Client Repos

Here is the setup we suggest for any team running a sandbox for AI coding agents on client code:

  1. Never run bare on client code. Start client sessions with /sandbox, and answer No at the trust prompt for repos you did not write.
  2. Prefer a proxy provider for anything that touches GitHub, so the token stays outside the sandbox.
  3. Use a narrow GitHub identity: a fine-grained token or machine account limited to one repo, with no admin or org-wide scopes. Run /sandbox delete when the task is done.
  4. Keep secrets out of the copy. Pax copies uncommitted and untracked files, so check whether a local .env or key file would travel with them, and move it out first.
  5. Make the merge your approval step. Let the agent push to a branch only. Protect main, require a human pull request review and run your security scans in continuous security in CI/CD.
  6. Review new dependencies the agent adds before they reach a lockfile on main.
  7. Check the trail. Pax shows every step and saves sessions in sessions.db under ~/.config/pydantic-ai-pax/, so review what ran before you merge.

A first session on a client repo looks like this:

Terminal

# Install Pax with every provider extra (Python 3.11+)
uv tool install 'pydantic-ai-pax[all]'

cd ~/clients/acme-api
pax

Inside Pax

/trust            # should read: untrusted
/sandbox          # move this conversation into a sandbox
/sandbox delete   # remove the sandbox when the task is done

Note that the all extra installs every sandbox provider except local, according to the Pax docs. Each hosted provider still needs its own account.

FAQ

Does Pydantic Pax have a sandbox?

Not by default. Pax runs commands and edits files as you. The /sandbox command moves a conversation into a local micro-VM or a hosted sandbox, and you choose the provider.

What is the best sandbox for AI coding agents?

For client repos on GitHub, a hosted provider with a token proxy, such as E2B or Daytona, is a strong default because the real token stays outside. For code that must never leave your machine, a local micro-VM like smol or BoxLite is the better fit, as long as you use a narrow token.

Is an E2B sandbox safer than a local micro-VM?

For GitHub tokens, yes: Pax keeps the token outside proxy sandboxes. But your code runs on a third party’s servers, so check your client contracts and, for EU clients, your GDPR data-processing terms first.

Do I still need human approval if I use a sandbox?

Yes. A sandbox for AI coding agents limits damage while the agent works. A human review before merge stops bad code, risky dependencies and leaked secrets from reaching production.

Conclusion: Make the Sandbox the Default

Pydantic Pax is useful and honest about its limits. It runs as you, and the trust prompt does not change that. Make a sandbox for AI coding agents the default for every client repo, keep tokens outside it where you can, and keep a human approval step before merge. If you want help rolling this out across your team, our AI integration services team can help you set up agents, sandboxes and review rules that fit your clients.

Discover our most-read articles, packed with expert insights, practical tips, and industry-leading knowledge.

Let's stay in touch!

We'll send you a newsletter once per week. No spam.