This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified. Consider using release 1.12.0 instead.
pip install pydantic-acp==1.11.0 Copy PIP instructions
pydantic-acp adapts pydantic_ai.Agent instances to the ACP agent interface without rewriting the underlying agent.
Install the stable v1 package with optional harness integration:
uv add "pydantic-acp[harness]>=1.0.0, =1.0.0,<2.0.0" Add web when the adapter will be served through ACP 0.12 Streamable HTTP or WebSocket:
uv add "pydantic-acp[web]" The core contract is simple:
The package also includes the inverse bridge: an ACP agent can be consumed as a Pydantic AI v2 provider/model pair via AcpProvider and AcpModel. The final v1 stability boundary is defined by the ACP Kit versioning policy.
from pydantic_ai import Agent from pydantic_acp import run_acp agent = Agent("openai:gpt-5", name="demo-agent") run_acp(agent=agent) ACP 0.12 Controls The adapter targets agent-client-protocol==0.12.1 and ACP schema v1.19. Model changes use the selectable "model" session config option rather than the removed session/set_model RPC. AdapterConfig(plan_update_mode="content") emits incremental plan updates only for clients that advertise plan support and otherwise falls back to complete plan updates.
additional_directories are durable session roots for client-backed file and terminal bridges, subject to any explicit workspace_root policy. Typed elicitation is available through AcpSessionContext.create_elicitation(...).
AcpMcpServer session descriptors are retained for host-owned ACP delegation; they are not connected or advertised as an ACP MCP transport because the SDK does not currently expose a public router for it. Use HTTP, SSE, or stdio MCP servers when SessionMcpBridge must execute tools.
If another runtime should own transport lifecycle:
from acp import run_agent from pydantic_ai import Agent from pydantic_acp import AdapterConfig, MemorySessionStore, create_acp_agent agent = Agent("openai:gpt-5", name="composable-agent") acp_agent = create_acp_agent( agent=agent, config=AdapterConfig(session_store=MemorySessionStore()), ) run_agent(acp_agent) ACP Client Provider Bridge create_acp_model(...) is the client-side mirror of the ACP server adapter. It wraps an ACP agent, or an ACP stdio command, as a Pydantic AI v2 model. AcpProvider and AcpModel remain available when lower-level provider ownership is needed.
For lower-level ownership, construct the provider directly:
Use this bridge when the thing you have is already an ACP agent and you want it to participate in code that expects a Pydantic AI provider/model. It is not another ACP server adapter and it does not replace create_acp_agent(...). If you are using Codex-backed Pydantic models through codex-auth-helper, pass explicit instructions when building the model. That is the preferred seam for Codex-specific system behavior:
from codex_auth_helper import create_codex_responses_model from pydantic_ai import Agent model = create_codex_responses_model( "gpt-5.4", instructions="You are a careful coding assistant.", ) agent = Agent(model, name="codex-agent") On the Pydantic path, Agent(instructions=...) is also valid and may still be useful for agent-specific behavior layered on top of the model:
TaskPlan is the structured native plan output surface.
Projection maps decide how known tool families render into ACP-visible updates.
from pydantic_acp import ( AdapterConfig, BuiltinToolProjectionMap, FileSystemProjectionMap, HookProjectionMap, run_acp, ) run_acp( agent=agent, config=AdapterConfig( projection_maps=[ FileSystemProjectionMap( default_read_tool="read_file", default_write_tool="write_file", ), HookProjectionMap( hidden_event_ids=frozenset({"after_model_request"}), event_labels={"before_model_request": "Preparing Request"}, ), BuiltinToolProjectionMap(), ], ), ) Capability Bridges Current built-in bridges include:
Use bridges when the runtime should gain upstream Pydantic AI capabilities and ACP-visible metadata without rewriting the adapter core.
Use ExtensionRouter for private or experimental ACP methods and notifications that do not need connection state. Use ContextualExtensionRouter when the handler also needs the connected acp.interfaces.Client, negotiated protocol version, client capabilities, or peer implementation metadata. Use AuthenticationProvider to contribute typed auth methods during initialize() and handle authenticate() calls:
Use a bridge for known Pydantic AI capability projection, an extension router for narrow application-owned JSON-RPC messages, and a native acp.interfaces.Agent when most protocol lifecycle behavior is custom. See the extensions and authentication guide for the full ownership and error-handling contract.
Use AcpSessionContext.ask_choice() for a capability-gated, typed single-choice question. The result distinguishes accepted, declined, and cancelled outcomes; accepted results contain the original typed choice value. Unsupported clients raise ElicitationUnsupportedError unless the caller supplies an explicit sync or async fallback. A fallback should return ChoiceElicitationAccepted, ChoiceElicitationDeclined, or ChoiceElicitationCancelled; returning a plain choice value is deprecated. Accepted and legacy plain values are both rejected when they do not match an offered choice.
from pydantic_acp import ChoiceElicitationAccepted, ElicitationChoice result = await session.ask_choice( "Choose a target", [ ElicitationChoice(value="preview", label="Preview", default=True), ElicitationChoice(value="production", label="Production"), ], ) if isinstance(result, ChoiceElicitationAccepted): target = result.value The helper compiles to ACP's existing form schema and does not promise a specific client UI. See the typed elicitation guide for fallback, metadata, low-level schema, and acpremote behavior.
pydantic-acp also ships a maintained bridge and projection layer for pydantic-ai-harness.
from pathlib import Path from pydantic_ai import Agent from pydantic_acp import ( AdapterConfig, HarnessFileSystemBridge, HarnessFileSystemProjectionMap, HarnessLocalWorkspaceBridge, HarnessShellBridge, HarnessShellProjectionMap, MemorySessionStore, run_acp, ) workspace_root = Path("agent_demos/harness-agent") agent = Agent( "openai:gpt-5", name="harness-agent", instructions="Use the harness filesystem and shell tools inside the workspace only.", ) run_acp( agent=agent, config=AdapterConfig( session_store=MemorySessionStore(), capability_bridges=[ HarnessLocalWorkspaceBridge( working_dir=workspace_root, capability_id="workspace", description="Set the working directory used by Harness tools.", ), HarnessFileSystemBridge( root_dir=workspace_root, read_only=True, capability_id="workspace-files", description="Read files in the ACP session workspace.", defer_loading=True, ), HarnessShellBridge( capability_id="workspace-shell", description="Run bounded workspace commands.", defer_loading=True, ), ], projection_maps=[ HarnessFileSystemProjectionMap(), HarnessShellProjectionMap(), ], ), ) Use HarnessCodeModeBridge only when the run should expose CodeMode. The maintained example keeps that bridge opt-in so the native ACP target stays limited to filesystem and shell by default:
The harness filesystem projection now renders read_file as a read-specific preview instead of a fake diff, which makes ACP transcript output much more truthful for inspection-only tool calls.
Use agent_factory= when the ACP session should influence which agent gets built:
Use MemorySessionStore for ephemeral local runs and FileSessionStore when ACP sessions should survive process restarts. FileSessionStore is a local durable store, not a distributed coordination layer.
File-backed session ids are constrained before they become filenames:
The file store writes through a temp file, fsync, and atomic replace. Malformed or partially written session files are skipped by public load/list flows.
pydantic-acp supports pydantic-ai-slim>=2.9.0,<=2.63.0. Pydantic AI V1 and Pydantic AI 2.x releases before 2.9.0 are outside the supported range.
The ACP client provider bridge depends on the Pydantic AI v2 Provider and Model contracts. Upgrades across major Pydantic AI versions should be deliberate because the adapter exposes both server-side ACP translation and client-side ACP provider integration.
Every supported minor is exercised by the repository's runtime and type-check compatibility matrix. The adapter keeps upstream compatibility behind ACP Kit's bridge and runtime seams instead of scattering version checks through callers.
Pydantic AI V2 defaults agent dependency and output generics to object. When your tools or hooks explicitly use RunContext[None] or Hooks[None], also declare the dependency type on the agent:
from pydantic_ai import Agent agent: Agent[None, str] = Agent( "openai:gpt-5", deps_type=type(None), name="typed-agent", ) The supported surface includes tool and output-tool preparation, output validation and processing hooks, deferred tool-call hooks, run metadata, conversation IDs, and the run_stream_events() lifecycle used through 2.63.0.
Harness-backed filesystem, shell, and CodeMode bridges are validated against pydantic-ai-harness[code-mode]==0.63.0 using its public capability imports. Harness 0.63.0 requires pydantic-ai-slim==2.63.0; the core adapter itself remains compatible with Pydantic AI 2.9.0 through 2.63.0.
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
None of the files in this release were uploaded with provenance metadata.
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.




