Skip to main content

Python SDK for the Agent Client Protocol (ACP) - Build powerful agent-based applications with streaming, terminal, and filesystem capabilities

Project description

Simple ACP Client

Simple ACP Client is a Python SDK for the Agent Client Protocol (ACP), providing a high-level, async-friendly interface for interacting with ACP-compatible agents. Build powerful agent-based applications with support for streaming messages, terminal operations, and filesystem capabilities.

Features

Requirements

  • Python 3.12 or higher
  • agent-client-protocol>=0.6.3

Installation

Install Simple ACP Client using pip:

pip install simple-acp-client

Or with uv:

uv add simple-acp-client

Quick Start

Here's a simple example to get you started:

import asyncio
from simple_acp_client.sdk.client import PyACPSDKClient, PyACPAgentOptions

async def main():
    # Configure the agent options
    options = PyACPAgentOptions(
        model="claude-sonnet-4-5",  # Optional: specify model
        cwd="/path/to/working/directory"  # Optional: set working directory
    )

    # Create and connect the client
    async with PyACPSDKClient(options) as client:
        await client.connect(["codex-acp"])  # Path to your ACP agent

        # Send a query and stream responses
        await client.query("What files are in the current directory?")

        async for message in client.receive_messages():
            if hasattr(message, 'text'):
                print(f"Agent: {message.text}")
            elif hasattr(message, 'thinking'):
                print(f"[Thinking]: {message.thinking}")

asyncio.run(main())

Core Concepts

PyACPSDKClient

The main client class that manages connections to ACP agents and handles protocol operations.

Key Methods

  • connect(agent_command): Establish connection to an ACP agent
  • query(prompt): Send a prompt to the agent (non-blocking)
  • receive_messages(): Stream messages from the agent until end of turn
  • interrupt(): Cancel the current agent operation
  • disconnect(): Close the connection and cleanup resources

Example Usage

from simple_acp_client.sdk.client import PyACPSDKClient, PyACPAgentOptions

# Initialize with options
options = PyACPAgentOptions(
    model="claude-sonnet-4-5",
    cwd="/workspace",
    env={"DEBUG": "true"}
)

client = PyACPSDKClient(options)

# Connect to agent
await client.connect(["path/to/agent", "--arg1", "--arg2"])

# Send query
await client.query("Analyze this codebase")

# Receive streaming responses
async for message in client.receive_messages():
    # Handle different message types
    print(message)

# Cleanup
await client.disconnect()

PyACPAgentOptions

Configuration options for the ACP agent connection.

Fields

  • model (str | None): Model identifier to use (e.g., "claude-sonnet-4-5")
  • cwd (str | Path | None): Working directory for the agent session
  • env (dict[str, str]): Environment variables for the agent process
  • max_turns (int | None): Maximum number of conversation turns
  • agent_program (str | None): Path to ACP agent executable
  • agent_args (list[str]): Arguments to pass to the agent program

Capabilities: Terminal (create/manage sessions, buffer output, exit/signals) and secure filesystem (read/write text files, absolute paths) are supported natively via the ACP protocol.

ACP Agent Compatibility

PyACP is compatible with ACP agents that implement the Agent Client Protocol. Popular agents include:

  • Codex ACP: npm install @zed-industries/codex-acp
  • Claude Code ACP: npm install -g @zed-industries/claude-code-acp

TODO

  • Right now the code in scripts always gives full capabilities to the agent, so only run it in docker/heavy sandboxing.

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

simple_acp_client-0.1.1.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

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

simple_acp_client-0.1.1-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file simple_acp_client-0.1.1.tar.gz.

File metadata

  • Download URL: simple_acp_client-0.1.1.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.2

File hashes

Hashes for simple_acp_client-0.1.1.tar.gz
Algorithm Hash digest
SHA256 01f2c4284f8fbc5a1f4fd6feffe79a879acbb7d9be833f37195c4fe86d42f18c
MD5 c42f0d5ae573887a5dbe8dee62cb9a97
BLAKE2b-256 f20339c29eeec691a55f9303bc5dfca90b867f69f1e9313327924a2c13eb4a99

See more details on using hashes here.

File details

Details for the file simple_acp_client-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for simple_acp_client-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e1b58e3ee13ce65ab681bf8d15552d5b295ac048ab1779f48a5efbb88d2dffb3
MD5 2893742beff6e6293a21cbb40dc7bf97
BLAKE2b-256 a9cff9fce3bf053ea41803882917a953434d24d5c2e31bd28d0b747b70099b2a

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