Skip to main content

General-purpose Python SDK for the Agent Client Protocol (ACP)

Project description

conduit-agent-sdk

General-purpose Python SDK for the Agent Client Protocol (ACP). Works with any ACP-compatible coding agent — Claude Code, Gemini CLI, OpenCode, Codex, Goose, and more.

Architecture

┌─────────────────────────────────────────┐
│          Python (conduit_sdk)           │  ← Developer-facing API
│  Client, Session, @tool, hooks, proxy   │
├─────────────────────────────────────────┤
│       Rust (_conduit_sdk via PyO3)      │  ← Performance-critical core
│  ACP client, transport, serialization   │
├─────────────────────────────────────────┤
│          sacp / sacp-tokio              │  ← ACP protocol implementation
│  JrHandlerChain, ByteStreams, types     │
└─────────────────────────────────────────┘

Installation

Requires Python 3.12+ and Rust toolchain.

# Clone and install in development mode
git clone <repo-url>
cd conduit-agent-sdk
uv sync
maturin develop --uv

Quick Start

One-liner with query()

import asyncio
from conduit_sdk import query

async def main():
    async for message in query(prompt="Hello!", agent="claude-acp"):
        print(message.text())

asyncio.run(main())

Registry-based client

from conduit_sdk import Client

async with await Client.from_registry("claude-acp") as client:
    async for message in client.prompt("Hello!"):
        print(message.text())

Manual command (no registry)

from conduit_sdk import Client

async with Client(["claude", "--agent"]) as client:
    async for message in client.prompt("Hello!"):
        print(message.text())

Agent Registry

The SDK integrates with the ACP agent registry, which provides a catalog of available agents with distribution metadata.

from conduit_sdk import Registry

registry = Registry()
await registry.fetch()

# List all agents
agents = await registry.list_agents()

# Search by keyword
results = registry.search("claude")

# Resolve to a shell command
cmd, env = await registry.resolve_command("claude-acp")
# cmd = ["npx", "@zed-industries/claude-agent-acp@0.18.0"]

Resolution automatically detects your platform and preferred runtime (npx → uvx → binary).

Features

Custom Tools

from conduit_sdk import tool

@tool(description="Read a file from disk")
async def read_file(path: str) -> str:
    return open(path).read()

Lifecycle Hooks

from conduit_sdk import HookType

@client.hooks.on(HookType.PreToolUse)
async def log_tool(ctx):
    print(f"Tool called: {ctx.get('tool_name')}")
    return ctx

Proxy Chains

from conduit_sdk import ProxyChain, ContextInjector

chain = ProxyChain()
chain.add(ContextInjector(context="Be concise."))
await chain.build()

Sessions

session = await client.new_session()
await session.set_mode("code")
response = await session.prompt("Fix the bug in main.py")

Examples

Run any example with uv run:

uv run examples/01_hello_world.py
# File What it demonstrates
01 01_hello_world.py Simplest query() call
02 02_registry_browse.py Fetch registry, list agents, search
03 03_streaming.py Client.from_registry() + streaming
04 04_multi_agent.py Connect to different agents
05 05_permissions.py Custom can_use_tool callback
06 06_custom_tools.py @tool decorator + MCP server
07 07_file_operations.py Agent reads/lists/summarizes files
08 08_code_generation.py Agent writes a Python module
09 09_multi_turn.py Multi-turn sessions, mode/model changes
10 10_hooks.py PreToolUse/PostToolUse hooks
11 11_proxy_chain.py ContextInjector + ResponseFilter
12 12_parallel_agents.py asyncio.gather() multiple agents

API Overview

Module Purpose
conduit_sdk.query One-shot registry-based agent query
conduit_sdk.Client Connect to agents, send prompts, stream responses
conduit_sdk.Registry Fetch and query the ACP agent registry
conduit_sdk.Session Manage conversation sessions
conduit_sdk.tool Register Python functions as agent tools
conduit_sdk.HookRunner Lifecycle hook system
conduit_sdk.ProxyChain Compose message-intercepting proxies

Development

# Install dev dependencies
uv sync --extra dev

# Build Rust extension
maturin develop --uv

# Run tests
uv run pytest tests/ -v

# Lint
uv run ruff check python/ tests/

Status

This SDK is in early development. The current implementation provides:

  • Complete project scaffold with Rust/Python hybrid architecture
  • ACP agent registry integration with automatic command resolution
  • Stub implementations for all ACP operations (connect, prompt, session, tools, hooks, proxy)
  • Full type coverage with PEP 561 type stubs
  • 12 runnable examples demonstrating the full SDK surface
  • Test suite covering Python-layer logic

The Rust core has TODO markers where sacp crate integration needs to be wired up for actual ACP protocol communication.

License

MIT

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

conduit_agent_sdk-0.1.0.tar.gz (96.4 kB view details)

Uploaded Source

Built Distributions

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

conduit_agent_sdk-0.1.0-cp312-abi3-win_amd64.whl (1.8 MB view details)

Uploaded CPython 3.12+Windows x86-64

conduit_agent_sdk-0.1.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.17+ x86-64

conduit_agent_sdk-0.1.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.0 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.17+ ARM64

conduit_agent_sdk-0.1.0-cp312-abi3-macosx_11_0_arm64.whl (1.8 MB view details)

Uploaded CPython 3.12+macOS 11.0+ ARM64

File details

Details for the file conduit_agent_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: conduit_agent_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 96.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for conduit_agent_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8e856cbf97aadf036ab955d8c43965e00ef924773a530a63220eb0e906555e7a
MD5 d63ca66e6c521a06f8a0304e6f1162d2
BLAKE2b-256 426b72cb13f34d1caa742e1d8956249fc67cb8f8dc0bd0724184789542bbca3d

See more details on using hashes here.

Provenance

The following attestation bundles were made for conduit_agent_sdk-0.1.0.tar.gz:

Publisher: release.yml on omoios/conduit-agent-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file conduit_agent_sdk-0.1.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for conduit_agent_sdk-0.1.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f3bacc370a3d90751d6a38239908324f9fcf1c6a8fb9ac0cef2c7105603dd357
MD5 2341c028133c724cc836c2ce847e8342
BLAKE2b-256 c75006537440d4a9f65f8f0681d3bb7d1f5c5457aae836743b9131027c159e20

See more details on using hashes here.

Provenance

The following attestation bundles were made for conduit_agent_sdk-0.1.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on omoios/conduit-agent-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file conduit_agent_sdk-0.1.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for conduit_agent_sdk-0.1.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3b34c969e7ab0bdbe28ea616baffe648c310586ca70b0fca2fe19d601860c7d0
MD5 30af8148db57a435cdb965e627d7f299
BLAKE2b-256 82f37bd6ce300d24f608e27a3d0d9c55d59ddb69f7d71c3279d501af7a136a1c

See more details on using hashes here.

Provenance

The following attestation bundles were made for conduit_agent_sdk-0.1.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on omoios/conduit-agent-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file conduit_agent_sdk-0.1.0-cp312-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for conduit_agent_sdk-0.1.0-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 0edbb7ad95e42befb2ebeb7d37982e0c2039a661a91695a0a0ba8b448176fb97
MD5 bb9c5adcca3c55e9e59b36443732b6ee
BLAKE2b-256 9f539d748357ca1af499ebdbf26aa2fef9e0008b203731a99a2088bc7707f990

See more details on using hashes here.

Provenance

The following attestation bundles were made for conduit_agent_sdk-0.1.0-cp312-abi3-win_amd64.whl:

Publisher: release.yml on omoios/conduit-agent-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file conduit_agent_sdk-0.1.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for conduit_agent_sdk-0.1.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5eeb82adcc7c222169d3bd2bde1e4a9ac2f9b1d34cababc81e099a669035bc87
MD5 8460f6182b0dc9ab57dd28f4bf61a0a4
BLAKE2b-256 575bb1b066cf6aaca310143d9d0a571dc71576f55ac96f5ff77a8c094e8d5cdf

See more details on using hashes here.

Provenance

The following attestation bundles were made for conduit_agent_sdk-0.1.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on omoios/conduit-agent-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file conduit_agent_sdk-0.1.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for conduit_agent_sdk-0.1.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 87073096b7b02a1dc20e392568944699645b8b9ee5653d307b2b7e412acd2ca1
MD5 92c4816763df6034ede798e77c41a330
BLAKE2b-256 2b5b0e09d8ac20045418e67ddeed47a3949a0ab24ea6f9507ff17683746e5e20

See more details on using hashes here.

Provenance

The following attestation bundles were made for conduit_agent_sdk-0.1.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on omoios/conduit-agent-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file conduit_agent_sdk-0.1.0-cp312-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for conduit_agent_sdk-0.1.0-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f6a0ea019c289953bbf704d6710f5f48bd7c1e129888d1dafb16e1fe68af1cd4
MD5 f4b6f2ce17c2f95bd9ffb8db6a18cb17
BLAKE2b-256 93c31bfa7a4280447ef56850317fdd3f3690a05766e629c89d58e39d709b7196

See more details on using hashes here.

Provenance

The following attestation bundles were made for conduit_agent_sdk-0.1.0-cp312-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on omoios/conduit-agent-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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