Skip to main content

ACP adapter for pydantic-ai agents.

Project description

pydantic-acp

pydantic-acp adapts pydantic_ai.Agent instances to the ACP agent interface.

Entry Points

  • run_acp(...)
  • create_acp_agent(...)
  • AdapterConfig
  • AcpSessionContext
  • MemorySessionStore
  • FileSessionStore

What It Covers

pydantic-acp includes:

  • ACP session lifecycle and replay
  • session-local model control
  • providers for host-owned models, modes, config options, and plans
  • native deferred approval bridging
  • projection maps for filesystem diffs and bash previews
  • capability bridges for hooks, history processors, prepare-tools, and MCP metadata
  • hook introspection and HookProjectionMap
  • client-backed filesystem and terminal helpers

Slash commands are available for:

  • /model
  • /tools
  • /hooks
  • /mcp-servers

Quick Start

from pydantic_ai import Agent
from pydantic_acp import run_acp

agent = Agent("openai:gpt-5", name="demo-agent")
run_acp(agent=agent)

Configured Runtime

from pathlib import Path

from pydantic_ai import Agent
from pydantic_acp import (
    AdapterConfig,
    FileSessionStore,
    NativeApprovalBridge,
    run_acp,
)

agent = Agent("openai:gpt-5", name="configured-agent")

run_acp(
    agent=agent,
    config=AdapterConfig(
        session_store=FileSessionStore(base_dir=Path(".acp-sessions")),
        approval_bridge=NativeApprovalBridge(enable_persistent_choices=True),
    ),
)

Projection Maps

Filesystem projection:

from pydantic_acp import FileSystemProjectionMap, run_acp

run_acp(
    agent=agent,
    projection_maps=(
        FileSystemProjectionMap(
            default_read_tool="read_file",
            default_write_tool="write_file",
            default_bash_tool="execute",
        ),
    ),
)

Hook projection:

from pydantic_acp import HookProjectionMap, run_acp

run_acp(
    agent=agent,
    projection_maps=(
        HookProjectionMap(
            hidden_event_ids=frozenset({"after_model_request"}),
            event_labels={"before_tool_execute": "Starting Tool"},
        ),
    ),
)

Factories, Providers, And Host Backends

Use agent_factory or AgentSource when the session context should influence agent creation. Use providers when models, modes, config options, or plans belong to the host layer. Use ClientHostContext when tools should talk back to the ACP client's filesystem or terminal.

Examples

See examples/pydantic/README.md for focused SDK examples and the full runnable demo.

Key examples:

For full workspace documentation, see:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydantic_acp-0.4.2.tar.gz (36.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pydantic_acp-0.4.2-py3-none-any.whl (51.3 kB view details)

Uploaded Python 3

File details

Details for the file pydantic_acp-0.4.2.tar.gz.

File metadata

  • Download URL: pydantic_acp-0.4.2.tar.gz
  • Upload date:
  • Size: 36.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pydantic_acp-0.4.2.tar.gz
Algorithm Hash digest
SHA256 8c81b42c2eb1f4d55f54aaa86a58703faaca04f4c981466c3a62ce83aef6070d
MD5 228adce75e3a5254890f7c5ba0bedcc7
BLAKE2b-256 70e894c1a954fd65c458f6786fbeee187cc61928f2e110218dc6506cfd441fd5

See more details on using hashes here.

File details

Details for the file pydantic_acp-0.4.2-py3-none-any.whl.

File metadata

  • Download URL: pydantic_acp-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 51.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pydantic_acp-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 44d8ec8518fd20a6943755146ea4c9d643a62a6bf89a26d1eb8fa6ab9c008fbf
MD5 5e97af971f42aa9261d308aac815b4f7
BLAKE2b-256 4b9dcf90faa7f3bba56084c8a4c4d24da03aec647ffb32eafaea9f7933d4b343

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page