Skip to main content

A Python implement of Agent Client Protocol (ACP, by Zed Industries)

Project description

Agent Client Protocol (Python)

Python SDK for the Agent Client Protocol (ACP). Build agents that speak ACP over stdio so tools like Zed can orchestrate them.

Each release tracks the matching ACP schema version. Contributions that improve coverage or tooling are very welcome.

Highlights

  • Typed dataclasses generated from the upstream ACP schema (acp.schema)
  • Async agent base class plus stdio transport helpers for quick bootstrapping
  • Included examples that stream content updates and tool calls end-to-end

Install

pip install agent-client-protocol
# or with uv
uv add agent-client-protocol

Quickstart

  1. Install the package and point your ACP-capable client at the provided echo agent:
    pip install agent-client-protocol
    python examples/echo_agent.py
    
  2. Wire it into your client (e.g. Zed → Agents panel) so stdio is connected; the SDK handles JSON-RPC framing and lifecycle messages.

Prefer a step-by-step walkthrough? Read the Quickstart guide or the hosted docs: https://psiace.github.io/agent-client-protocol-python/.

Minimal agent sketch

import asyncio

from acp import Agent, AgentSideConnection, PromptRequest, PromptResponse, SessionNotification, stdio_streams
from acp.schema import AgentMessageChunk, TextContentBlock


class EchoAgent(Agent):
    def __init__(self, conn):
        self._conn = conn

    async def prompt(self, params: PromptRequest) -> PromptResponse:
        for block in params.prompt:
            text = getattr(block, "text", "")
            await self._conn.sessionUpdate(
                SessionNotification(
                    sessionId=params.sessionId,
                    update=AgentMessageChunk(
                        sessionUpdate="agent_message_chunk",
                        content=TextContentBlock(type="text", text=text),
                    ),
                )
            )
        return PromptResponse(stopReason="end_turn")


async def main() -> None:
    reader, writer = await stdio_streams()
    AgentSideConnection(lambda conn: EchoAgent(conn), writer, reader)
    await asyncio.Event().wait()


if __name__ == "__main__":
    asyncio.run(main())

Full example with streaming and lifecycle hooks lives in examples/echo_agent.py.

Examples

  • examples/mini_swe_agent: bridges mini-swe-agent into ACP, including a duet launcher and Textual TUI client
  • Additional transport helpers are documented in the Mini SWE guide

Documentation

Development workflow

make install                     # create uv virtualenv and install hooks
ACP_SCHEMA_VERSION=<ref> make gen-all  # refresh generated schema bindings
make check                       # lint, types, dependency analysis
make test                        # run pytest + doctests

After local changes, consider updating docs/examples if the public API surface shifts.

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

agent_client_protocol-0.4.5.tar.gz (198.5 kB view details)

Uploaded Source

Built Distribution

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

agent_client_protocol-0.4.5-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

File details

Details for the file agent_client_protocol-0.4.5.tar.gz.

File metadata

File hashes

Hashes for agent_client_protocol-0.4.5.tar.gz
Algorithm Hash digest
SHA256 b163407a95210481c188a470a882345268a64da6ab98e0c40c1fad3668bc0a28
MD5 ccf9b2e1a4b7d19c23af748a72255347
BLAKE2b-256 1c24d034817deae53c95e6612184aa75aeaee4f4d15af286e94796b266064285

See more details on using hashes here.

File details

Details for the file agent_client_protocol-0.4.5-py3-none-any.whl.

File metadata

File hashes

Hashes for agent_client_protocol-0.4.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f6de058cb9c9df47ca38eba3866373ae3bed3304ceda33ffa3eed101df107ff7
MD5 7c883d7d5360d4db8724f7d7289d8ae6
BLAKE2b-256 0a9f12559a76fe602706b45431c5b60be3ea91883253c5b3ef00039545f72919

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