Learning resourcesReviewed · Pydantic

Pydantic AI Harness Coder documentation

The Coder documentation is a guide for Python developers building Pydantic AI coding agents, and its default setup gives the agent unrestricted shell access. It explains installation, local and sandbox workspaces, file tools, delegation and configuration. The page also warns that 0.x APIs may change between minor releases.

Researched 24 Nov 2026

In short.

The Coder documentation is a guide for developers adding coding tools to Pydantic AI agents, with unrestricted shell commands requiring careful workspace and permissions choices. It describes a configurable bundle of file operations, command execution, repository instructions, delegation and context management. Examples cover local development, cloud sandboxes and sharing files with a reviewer. Useful operational details include restricted environment inheritance, persistent background processes, bounded tool output and migration hazards for durable workflows. Autonomy settings guide the model but do not enforce approval. Installation, coding accuracy, provider compatibility, performance and costs were not tested or measured; the page supplies no benchmark scores or pricing.

Researched and written by an AI model and checked by a second AI model. How it works

Covers the complete selected Coder documentation page at https://pydantic.dev/docs/ai/harness/coder/index.md, including usage, composition, tool behavior, delegation, filesystem scope, long-running commands, argument repair, strict schemas, caching, durability, upgrade notices, benchmarking guidance and API reference. The page's 0.x compatibility warning and deprecation notes are included. Linked documentation, provider pages, GitHub source and the benchmark playbook are outside the selected scope. No installation, code execution, provider interaction or runtime validation occurred; performance, task success, current compatibility, costs and reuse rights remain unestablished where the page supplies no evidence.

The overview

identity

The Coder page documents pydantic_ai_harness.coder.Coder, a combined capability attached to a Pydantic AI Agent. Its purpose is to give the model tools and guidance for investigating, editing and testing code in an attached workspace. The documentation is available at [https://pydantic.dev/docs/ai/harness/coder/index.md].

The page combines a usage guide, operational explanations, upgrade notes and constructor reference. It also describes coder_agent, an exported agent that has no model configured and uses the directory current when it is imported.

assessment

The guide is useful for understanding what a coding agent can access and which defaults require attention. It documents command permissions, environment variables, search limits, workspace persistence and cleanup, giving developers concrete configuration decisions to assess.

Its strongest support is for understanding and configuring the documented API. It does not establish how reliably an agent fixes bugs, whether the examples work with a particular installation, or how it compares with other coding assistants. Those outcomes remain unassessed.

users

The main audience is Python developers building coding assistants with Pydantic AI. The examples assume familiarity with package installation, Python imports, model configuration and command-line tools. Beginners can follow the basic configuration, but the page does not provide a complete introduction to Python or provider authentication.

Experienced developers get details relevant to sandbox integration, reviewer agents, custom capability composition, background processes and durable execution. Developers requiring enforced approvals need to understand the separate Permissions capability because Coder's autonomy setting only supplies model guidance.

capabilities

Coder supplies read_file, write_file, edit_file, list_files and grep, together with a shell tool and optional delegate_task. File edits use exact text replacements; a replacement batch is written only when every replacement matches. Repository context loads AGENTS.md, or otherwise CLAUDE.md, from applicable directories.

The page describes local workspaces and sandbox integrations including Modal, E2B, Render, Sprites, Daytona and boxd. Agents can share a workspace, while ReadOnlyWorkspace prevents commands and file changes for a reviewer. Optional TaskControl adds background delegation, steering, questions, cancellation and resumption.

Additional capabilities manage conversation context, repair malformed tool arguments and enable prompt caching. Durable execution with Temporal, DBOS and Prefect is documented, although Temporal delegation is limited to the self delegate.

Using it

requirements

Installation requires the coder extra: pip install "pydantic-ai-harness[coder]". It includes json-repair and installs ripgrep 14.1.0 except on Android, where rg must be supplied separately on PATH. Importing Coder without the extra raises an ImportError. Provider extras may also be needed.

An explicit workspace capability is required; a run without one fails at startup. LocalWorkspace requires a POSIX host, while the page directs Windows users to WindowsWorkspace and PowerShell. Remote images need their own rg and git for the documented fast-search setup.

The examples assume a usable model configuration. Supported Python versions, minimum machine resources, exact compatible package versions and complete provider authentication requirements are not specified on this page.

mechanism

Coder combines FileSystem, Shell, RepoContext, SubAgents and context-management capabilities. Files and commands operate through the run's workspace. File tools normally restrict paths to the workspace directory, but shell commands have no command allowlist and can bypass those file-tool restrictions.

Defaults include five consecutive retries for file tools, a 270-second foreground shell wait, prompt caching enabled and strict schemas disabled for Coder's tools. Argument repair attempts to recover malformed JSON before normal validation; it does not fix missing fields, invalid types or ambiguous intent. Exhausted execution retries return a failed tool result, while exhausted argument-validation retries still end the run.

Delegation is enabled by default, with self representing a fresh run of the same agent in the parent's workspace. The instructions discourage delegation unless requested. Agent-bound capabilities and settings carry over, but settings supplied only to run() do not. Delegation depth is limited to three levels including the top-level run.

setup

The documented setup imports Agent, LocalWorkspace and Coder, then attaches LocalWorkspace('.') and Coder() through Agent(capabilities=[...]). A sandbox capability can replace LocalWorkspace. Coder must be attached to the Agent when delegation is enabled; supplying it only to run() raises a UserError unless sub_agents=False.

Local commands receive PATH, HOME, LANG, LC_ALL and LC_CTYPE by default. Additional variables must be passed explicitly. The page cautions against passing the entire process environment because that exposes secrets, including model API keys, to commands. PATH may also need adjustment so Python and pytest resolve to the workspace's interpreter rather than the agent project's environment.

For enforced approval before writes or commands, the page identifies Permissions as the relevant addition. Setting autonomy='low' alone does not impose a tool restriction. ReadOnlyWorkspace is documented for reviewers that should inspect files without editing or running commands.

example

One documentation example creates an Agent with a model identifier and capabilities=[LocalWorkspace('.'), Coder()], then asks it to investigate why tests/test_parser.py fails and fix the underlying bug. The workspace establishes where file paths resolve and commands begin.

Another example asks an agent to add a --verbose flag, then continues with message_history=result.all_messages() to request README documentation. A separate reviewer receives ReadOnlyWorkspace(result.workspace). These are illustrative configurations; no successful repair, test execution or review result is established.

Assessment & evidence

limitations

Local shell access is unrestricted within the host permissions available to the process. Protected file patterns and workspace path limits apply to file tools, not to shell commands. Enabling unrestricted_filesystem also removes the file tools' normal protections for secrets and repository metadata. Autonomy levels do not enforce security boundaries.

Output is bounded: read_file defaults to 2,000 lines and at most 50,000 characters of complete lines; searches and listings have 1,000-line or file caps; tool results over 64,000 characters are truncated without a spill-retrieval tool. Repository instructions have a default 32,000-character inline budget. Partial output cannot establish exhaustive coverage.

Without rg, search fallbacks have different ignore-file and regular-expression behavior. Shell processes can outlive an agent run without completion notifications or automatic wake-up. Sandbox-backed to_web() creates a fresh sandbox for each message, so files do not persist between messages in the same way as the documented CLI session.

Closing a retained workspace backend client does not necessarily delete its sandbox. Tool-output spill files are not automatically pruned. Cleanup therefore requires explicit lifecycle handling.

reasoning

The documented composition suggests a useful fit when a developer wants one coding-agent configuration that can operate in either a local checkout or a sandbox. This is an inference from the shared workspace interface and replacement examples, rather than a demonstrated portability result.

The detailed defaults help developers identify necessary controls: choose the execution environment, constrain access, pass only required environment variables and manage persistent processes. Reliability and coding quality remain unknown because tool descriptions and configuration examples do not demonstrate successful task completion.

alternatives

The page's concrete alternative is to assemble the constituent capabilities individually. Developers can change FileSystem settings, retain content hashes, add list_directory, configure command restrictions or define a different delegation roster instead of accepting the Coder bundle's defaults.

Smaller adjustments include sub_agents=False, a custom RepoContext, caching=False or a different strict setting. BenchmarkInstructions is an optional companion for benchmark-specific guidance. The page does not compare external libraries or coding assistants, so relative quality, speed and cost are unknown.

evidence

The supporting source is the complete Coder documentation page at [https://pydantic.dev/docs/ai/harness/coder/index.md]. It provides installation commands, Python examples, constructor defaults, tool behavior and migration notes. These support statements about documented behavior, rather than independently verified runtime behavior.

Nothing was installed, executed or tested. The page's Benchmarking section explains optional instructions and links to a Terminal-Bench 2.1 playbook, but supplies no benchmark scores. Coding accuracy, throughput, latency, successful sandbox operation and security enforcement were not assessed.

Access & freshness

costs

The page does not specify a library price, subscription requirement, model token rates, sandbox charges or total operating cost. Free-use allowances and the cost of any particular task are unknown.

The documentation notes that delegation repeats project exploration and can multiply tool calls and cost. Prompt caching is enabled by default and allows providers to reuse repeated prompt prefixes, but provider support, pricing and actual savings are not established here. No measured cost comparison is supplied.

rights

The selected page does not state the license covering the library, documentation or code examples. Commercial-use, modification and redistribution permissions cannot be established from this page alone.

The page links to source code, but a source-code link does not establish reuse rights. Model-provider and sandbox-provider terms are also unspecified. Applicable licenses and service terms would need to be obtained before relying on those permissions.

freshness

The documentation snapshot was captured on 2026-11-24 at 01:33:09.248 UTC. The page warns that Pydantic AI Harness APIs may change between minor releases during 0.x development. It does not identify an exact package release or state a publication or last-modified date.

Upgrade notes describe required workspace attachment, deprecated directory arguments, changed environment inheritance, prompt-caching and strict-schema defaults, and persistent background commands. Added workspace operations can also prevent replay of existing Temporal and DBOS runs; the page advises allowing those runs to finish or versioning the deployment. Behavior beyond this snapshot is unknown.

actions

Before adoption, confirm the intended package version, Python compatibility, provider configuration, licenses and service costs. Choose a workspace appropriate to the code and inputs, add enforced permissions where required, and pass only necessary environment variables. Disable delegation if it is unnecessary.

A useful first evaluation would use a disposable codebase with a known failing test, then inspect the changes and run the relevant tests in the intended interpreter environment. Check output truncation, command cleanup and file persistence in the chosen interface. For existing durable workflows, assess replay compatibility before upgrading. These are proposed evaluations; no results are available.

Evidence for this report

selected-page.txtselected · checked 2026-11-24