Pydantic AI Pax Coding Agent & Harness Beta Guide
Hands-on guide to Pydantic AI Pax (pydantic-ai-pax) & Harness beta (Nov 25, 2026): uvx launch, --agent custom harnesses, Coder() embedding & cost benchmarks.

Table of Contents
- 1. Why Pydantic AI Pax & Harness Stand Out Among Terminal Agents
- 2. Architecture Deep Dive: Plugins, Coder(), Code Mode & Sandboxes
- 3. Claude Code, Codex & OpenCode vs. Pax Selector
- 4. Hands-On Commands: uvx Launch, --agent & Modal Sandbox Embedding
- 5. 4-Step Adoption Plan & Practical Gotchas (Including macOS /bin/pax)
- 6. Frequently Asked Questions (FAQ)
1. Why Pydantic AI Pax & Harness Stand Out Among Terminal Agents
Developers adopting terminal coding agents have faced an awkward split: turnkey black-box CLIs like Claude Code or Codex CLI feel polished out of the box but lock down their internal tool loops, while building a custom coding agent inside a Python backend meant hand-rolling file editors, shell wrappers, context pruning, and sub-agents from scratch.
Pydantic AI Pax and the Pydantic AI Harness beta unify both worlds. The interactive terminal agent (pydantic-ai-pax) runs on the exact same Coder() capability and 100+ reusable blocks (pydantic-ai-harness) that you can embed directly into production Python applications.
In Pydantic's Harness-Bench SWE81 evaluation (81 real-world software engineering implementation and repair tasks), Pax narrowly led average scores across multiple models in single-run benchmarks—and demonstrated how strongly the harness shapes token cost ("Harness Tax"). On GPT-6.2 Sol, Pax ran at less than half the cost of Codex, while roughly matching Claude Code in both score and cost on Claude Opus 5.5.

2. Architecture Deep Dive: Plugins, Coder(), Code Mode & Sandboxes
Pax follows an "Everything is a Plugin" philosophy on Python 3.11+: even the default coding agent, sandboxes, MCP connectors, and Logfire tracing behave as toggleable, composable modules.
| Layer / Feature | Core Building Blocks | Practical Advantage |
|---|---|---|
| Terminal UI (Pax) | pydantic-ai-pax TUI, mid-session provider switching, session recovery | Imports existing conversation history from Claude Code & Codex; toggle plugins live |
| Reusable Coding Bundle | pydantic_ai_harness.coder.Coder() | Path-restricted file ops, ripgrep(rg) search, shell execution, auto-reads CLAUDE.md & AGENTS.md, sub-agent delegation |
Code Mode ([code-mode]) | Single run_code execution step | Replaces serial tool round-trips with Python blocks (loops, conditionals, asyncio.gather parallelism) |
| Workspaces & Sandboxes | LocalWorkspace('.') ↔ ModalSandbox() etc. | Swap local execution for Modal, E2B, Render, Sprites, Daytona, OpenSandbox, or boxd without touching agent logic |
| Observability & Custom Agents | MCP plugins, Logfire tracing, --agent flag | Write custom plugins in a few lines of Python or attach any custom Pydantic AI Agent directly into Pax |
3. Claude Code, Codex & OpenCode vs. Pax Selector
Pydantic AI Pax & HarnessOpen-source Python plugin TUI + embeddable 100+ capability SDK
“uvx launch · --agent · Sandbox swap”
- Strengths
- Shared Coder() across TUI and apps, 1-line Modal/E2B sandbox swap, strong Harness-Bench cost efficiency
- Extensibility
- Type-safe Python plugins, MCP, Logfire tracing, and bring-your-own --agent support
- Caveat
- Harness is pre-1.0 beta; watch out for macOS built-in /bin/pax name collision
- Best For
- Python/AI engineers building custom coding agents, internal dev tools, or sandboxed bots
Anthropic Claude CodeTurnkey Anthropic coding agent integrated with Claude Ship
“Zero assembly · /ship · Official polish”
- Strengths
- Top-tier out-of-the-box coding, PR automation (/ship), and Code Mode with minimal setup
- Extensibility
- MCP, Skills, Hooks, and CLAUDE.md—though the core harness loop stays closed
- Caveat
- Anthropic-centric ecosystem; not designed as an embeddable Python SDK
- Best For
- Teams seeking maximum immediate velocity with zero harness maintenance
OpenCode / Codex CLIMulti-provider open TUI or official OpenAI terminal agent
“Fast model swap · Low Python overhead”
- Strengths
- Quick installation across non-Python stacks for interactive terminal coding
- Extensibility
- Config- and MCP-driven rather than programmable Python capability composition
- Caveat
- Token cost can vary sharply by harness/model pairing (Harness Tax)
- Best For
- Non-Python developers wanting a straightforward daily terminal assistant
4. Hands-On Commands: uvx Launch, --agent & Modal Sandbox Embedding
The tabs below reflect the verified CLI and Python patterns from Pydantic's official beta release notes (pydantic.dev/articles/pax-harness-beta).
# Run immediately in an ephemeral environment without permanent install
uvx pydantic-ai-pax
# Install globally with bytecode compilation for faster startup
uv tool install --compile-bytecode pydantic-ai-pax
# Mount your own custom Pydantic AI Agent inside Pax TUI
uvx pydantic-ai-pax --agent my_package.agent:my_custom_agent -m anthropic:claude-sonnet-4-65. 4-Step Adoption Plan & Practical Gotchas (Including macOS /bin/pax)
- 1Step 1 — Pilot Zero-Install via uvx & Import Existing Sessions
uvx pydantic-ai-paxTest Pax without polluting your global Python environment. Verify automatic CLAUDE.md/AGENTS.md loading, mid-conversation model switching, and importing history from Claude Code or Codex.
- 2Step 2 — Measure Harness Tax with Code Mode & Logfire Tracing
Code Mode (run_code) + Logfire Plugin + MCPEnable Code Mode to collapse multi-file tool round-trips into batched Python execution, and turn on the Logfire tracing plugin to inspect per-turn token spend and latency.
- 3Step 3 — Standardize Team Workflows via --agent Modules
uvx pydantic-ai-pax --agent company_agent.cli:agentVersion-control your team's custom Pydantic AI Agent (internal tools, approval policies, MCP servers) in Git so every engineer launches the exact same harness inside Pax.
- 4Step 4 — Move Unattended Runs to Cloud Sandboxes
LocalWorkspace('.') -> ModalSandbox() / E2B / DaytonaBefore running autonomous bug-fix or CI workflows unattended, swap LocalWorkspace('.') for ModalSandbox() or E2B so untrusted shell commands never touch host credentials.
Practical Gotchas & Operations Explorer
- Running `pax` on macOS launches an old archive utility instead of Pydantic AI PaxmacOS Trap· CLI & macOS
If /bin appears earlier in PATH or the shell hash table isn't refreshed, typing `pax` invokes macOS's system binary instead of Pydantic's CLI.
Key Caveat:macOS ships with a built-in POSIX archive tool at /bin/paxRecommended Fix:Run `uvx pydantic-ai-pax` directly or ensure ~/.local/bin precedes /bin in PATH and open a fresh terminal after `uv tool install`. - Why did default coding tools disappear when I passed `--agent my_module:agent`?--agent Scope· CLI & macOS
Passing `--agent` gives you full control over instructions, models, and tools without hidden defaults colliding with your custom workflow.
Key Caveat:Expected behavior — `--agent` bypasses built-in default plugins to load your exact AgentRecommended Fix:Explicitly include `Coder()` and `LocalWorkspace('.')` in your custom agent's `capabilities=[...]` list if you still want built-in coding tools. - Why can two CLI harnesses using the exact same model differ by >2x in token cost?Harness Tax· Cost & Code Mode
On Harness-Bench SWE81 with GPT-6.2 Sol, Pax ran at under half the cost of Codex thanks to modular context handling and Code Mode (`run_code`).
Key Caveat:System prompts, context pruning, and tool round-trip loops multiply token usageRecommended Fix:Enable Logfire tracing during pilots to compare cost-per-solved-task rather than looking only at pass rates. - Is Pydantic AI Harness beta safe to embed in production pipelines today?Beta Caution· Sandboxes & Beta
Because `pydantic-ai-harness` is in beta ahead of 1.0, minor capability API adjustments can still land between releases.
Key Caveat:Yes for controlled rollouts—provided you pin versions and isolate execution in sandboxesRecommended Fix:Pin dependencies via `uv.lock` and swap `LocalWorkspace('.')` to `ModalSandbox()` or E2B for unattended production runs.
6. Frequently Asked Questions (FAQ)
Q1. Is Pydantic AI Pax free to use?
Q2. Can I use Pax on repositories already configured for Claude Code or Codex?
Q3. How does Code Mode ([code-mode]) reduce latency and token cost?
Q4. Which cloud sandboxes work with Pydantic AI Harness?
Q5. How do I avoid the macOS /bin/pax conflict?
Inspect Structured Agent Outputs & MCP Configs with Hafuture JSON Formatter
Format and validate Pydantic AI structured JSON outputs, MCP manifests, and Logfire trace payloads locally in your browser.
Related Articles
Google Workspace MCP Server & gwscli GA Guide
Practical guide to Google Workspace MCP servers & gwscli (GA Nov 24, 2026): Streamable HTTP setup, free Standard Tier (5,000/day), and Feb 1, 2027 rules.
Claudia Guide: Manage Claude Code Settings & MCP in a GUI
Set up Claudia (v0.2.0), the MIT-licensed Go tray app for Claude Code. Manage 180 settings.json keys, CLAUDE.md, auto memory, MCP servers, and skills per project.
Gortex vs Graphify: Code Exploration Token Benchmark
Benchmark of Gortex v0.64.12 vs Graphify v0.9.124 on a 726-file Next.js repo: 74.4%–97.9% token cuts, CLI latency, disk/RAM footprints, and setup fixes.