In short.
This Pydantic AI Harness guide helps Python developers add approval controls to AI agents, but those controls cannot replace a sandbox. It documents full, auto and read-only modes, rules that allow, ask about or deny calls, and handlers that obtain human decisions. The default full mode lets file writes and commands run unless another control intervenes. Other tools and delegated agents need explicit attention to receive equivalent checks. The page provides detailed API examples and matching rules, but runtime behavior, security effectiveness, compatibility and costs have not been tested or established.
Researched and written by an AI model and checked by a second AI model. How it works
Covers the complete captured Permissions page at [https://pydantic.dev/docs/ai/harness/permissions/index.md], including its examples, 0.x API-change notice, mode behavior, rule semantics, approval memory, telemetry and stated limitations. The captured source revision is sha256:afa5f3d1bddaa6d8da9260fa09457365d54b090aad67c7c84b628ce1f60eae10. Linked documentation, the documentation index and repository contents are excluded; related resources are described only to the extent this page explains them. Nothing was executed. Runtime behavior, security effectiveness, exact release compatibility, costs and reuse rights remain unverified or unknown.
The overview
Resource and scope
The resource is the Permissions documentation page for Pydantic AI Harness, a Python agent framework component. It explains how the Permissions capability controls certain tool calls before execution. It is a technical guide with examples, rather than a standalone application.
The documentation is at [https://pydantic.dev/docs/ai/harness/permissions/index.md]. It links to implementation source at [https://github.com/pydantic/pydantic-ai/tree/main/src/pydantic_ai_harness/pydantic_ai_harness/permissions/], but that repository's contents are outside the supplied evidence.
Practical assessment
The guide is useful for developers who want selective approval requests instead of asking about every tool call. Its strongest practical detail is the explanation of where checks apply, how competing rules resolve and how shell syntax affects matching.
Its suitability depends on treating permissions as application controls. A developer who needs enforced isolation from host files, credentials or networks also needs a sandbox. The documentation alone does not establish that any particular configuration provides adequate protection.
Who it is for
The intended readers are Python developers building coding agents or other agents with file and shell access. It is particularly relevant when a person should approve selected actions, such as pushing code or deploying to production.
Beginners need familiarity with Python imports, asynchronous functions and agent tool calls. Experienced developers get details about command parsing, path matching, durable execution and approval history that matter when integrating permissions into an application.
Documented capabilities
Permissions has three modes. Full, the default, lets file writes and commands run. Auto lets file writes run and asks about commands matching ask_commands. Read-only asks about the recognized file writes and commands; despite its name, it can permit writes after approval or through an applicable allow rule.
Rules can allow, ask about or deny calls based on tool selectors, argument patterns and shell commands. Tool selectors support names, metadata matches and predicates. The mode can also be a function of run context, allowing an application to change it during a run.
The guide covers remembered approvals and telemetry. Permissions creates no spans of its own; held and denied calls appear through the core tool spans, deferred requests or results, and message history.
Using it
Requirements and dependencies
The examples use Agent from pydantic_ai and Permissions from pydantic_ai_harness.permissions. The inline approval example also combines LocalWorkspace, FileSystem, Shell and HandleDeferredToolCalls with an approver returning PermissionDecision.
Without an approval handler, a held call ends the run with DeferredToolRequests instead of prompting a person inline. Calls to other tools that ask for approval require another handler because ask_permissions handles the recognized permission requests and leaves other approvals for subsequent handlers.
The page gives no installation command, minimum Python version, pinned package versions or complete dependency list.
How decisions work
Rules are checked before the mode decides what happens. Every field specified in a rule must match. Across matching rules, deny takes precedence over ask, and ask over allow, regardless of rule order. An allow rule does not bypass an ask_commands match in auto or read-only mode.
Argument patterns check both the supplied string and a normalized path. Allow rules require both forms to match; ask and deny rules need either form and can match the end of a longer path. Windows comparisons ignore case and normalize separators. Symlinks are not resolved. Values longer than 4096 characters match ask and deny argument rules but do not match allow argument rules.
Shell command rules examine simple commands separated by operators such as semicolons and pipes. To allow a compound command, every simple command needs an allow match. Allow rules match command prefixes and restrict redirection; ask and deny rules use broader word matching. A match found only inside quoted text asks instead of denying because that text may be data.
A held call raises ApprovalRequired. The approval helper asks about held permission calls in turn, and a denied call returns a denial to the model. A deny rule can also refuse an already-approved call, although a separate approval requirement may prompt the person before that refusal.
Remembered approval normally lasts in process for the same tool and command or path within a conversation. Durable workflows retain approval in the approved call's ToolReturnPart metadata. Trusted history can therefore suppress another prompt; dropping that history during compaction makes the call ask again.
Integration approach
The first example creates an Agent with LocalWorkspace('.'), FileSystem(), Shell(), Permissions('auto') and a HandleDeferredToolCalls handler that invokes ask_permissions. Its approver uses console input to approve, refuse or remember the decision.
For custom tools subject to ask rules, the page adds a second handler after the permissions handler. That handler returns approvals through DeferredToolResults. Applications using their own approval interface must supply the corresponding decision handling.
Delegated agents require explicit configuration: pass the permissions object and handler through SubAgents(shared_capabilities=[permissions, handler]). A Permissions capability passed to the parent's run does not automatically reach a delegate.
Concrete example
The page's read-only rules example allows git status and rg, asks about git push, denies commands matching rm -rf, allows write_file calls whose path matches docs/*, and asks about deploy calls whose env matches prod*. This illustrates a documentation agent that can perform selected routine work while requesting decisions for other actions.
A command allow rule for git status also permits git status --short. It does not permit git status > ~/.bashrc through that rule. A compound command such as ls && git status --short needs an allow match for ls as well. These are documented examples, not observed execution results.
Assessment & evidence
Limits and failure cases
Automatic file checks cover FileSystem's write_file, edit_file and create_directory tools, identified by tool kind. Command checks depend on metadata declaring a shell command argument. Other tools run in every mode unless a rule or separate approval control applies. External tool execution performed by the application is not checked.
The default command patterns ask about operations including forced or recursive deletion, git push, destructive Git commands, sudo, network clients, package installation and disk utilities. They are regular expressions searched within command text, not a guarantee that equivalent behavior will be detected. A script can perform an operation without matching its usual command pattern.
Command rules also match words rather than behavior. For example, rm --recursive --force does not match the rm -rf rule. Broad allow prefixes can admit powerful options: allowing find also allows find . -delete.
Complex shell syntax cannot be allowed by command rules. Some forms involving expansion trigger an approval request when relevant ask or deny command rules apply, but complex syntax does not universally force approval. With no matching rule, the permission mode still decides. Windows command parsing is treated as complex too.
The FileSystem root restriction and path normalization do not make these permission rules a sandbox. Runtime protection, integration behavior and resistance to bypass have not been tested.
Why the distinctions matter
The guide addresses approval fatigue: asking about every harmless call can make meaningful requests harder to notice. Selective rules offer a way to reserve attention for actions the application considers consequential.
The documented defaults imply that adding Permissions() alone does not create a restrictive configuration. Likewise, the name read-only describes an approval policy rather than an immutable filesystem boundary. These distinctions matter when deciding whether the feature fits an interactive assistant or an application that needs enforced isolation.
Related approaches
The page contrasts selective permissions with setting requires_approval=True on each tool, which asks about every call to that tool. It also identifies ToolGuardrail and ToolCallJudge as options for gating custom tools, and a sandbox as the approach for restricting what an agent can reach.
Related links describe Approval Reviewer for having a second model approve low-risk calls and Ask User for multiple-choice questions. Those linked pages were not assessed, so their implementation details, costs and comparative effectiveness are unknown.
Evidence and confidence
The evidence consists of the complete Permissions documentation page at [https://pydantic.dev/docs/ai/harness/permissions/index.md]. It provides API explanations, Python examples, matching semantics and explicit limitations.
These support an account of documented behavior. They do not establish implementation correctness, measured security effectiveness or successful integration in a particular application. No commands or examples were executed, and the linked implementation and documentation were not examined.
Access & freshness
Costs
The page states no price for the permission capability, model usage, hosting or support. It provides no measurements of latency, token consumption or human approval workload. Acquisition and operating costs are unknown from this evidence; the example's model identifier does not establish pricing.
Licensing and reuse
The supplied page contains no licence text or explicit redistribution terms for its documentation or code examples. Its source repository link does not establish those terms. Rights for copying, distributing or commercially reusing the material remain unknown from this page.
Version and freshness
The supplied page was captured on 24 November 2026 at 02:02:25.555 UTC. It carries a notice that Pydantic AI Harness is on 0.x releases and that APIs may change between minor releases, with deprecation warnings and release-note migration guidance.
The page does not identify an exact package release, publication date or supported Python versions. The capture timestamp identifies this documentation copy; it does not establish compatibility with any installed or subsequent release.
Before adopting
Choose the desired approval behavior explicitly, identify which tools receive automatic checks and add rules or separate approval controls for other tools. Configure both the permissions handler and any handler needed for other approval requests, including those from delegates.
Review command allow rules for overly broad prefixes, decide how remembered approvals and trusted history should be managed, and use a sandbox for boundaries that must be enforced.
In the intended environment, verify representative allowed, held and denied calls, compound commands, path normalization, delegated calls and durable replay before relying on the configuration. Confirm package compatibility and licensing separately. None of these runtime checks has been performed.
