Fundamental breaking changes are happening now, affecting protocol, transport, and APIs. Consider this version experimental. Join Alpha discussions to help shape it.

The Python and TypeScript SDKs for the Agent Communication Protocol (ACP) provide standardized and simplified integration for communication between clients, agents, and tools. These SDKs streamline the process of building, discovering, and invoking agents, enabling developers to easily create robust and interoperable agent-based solutions.

Overview

This guide provides practical examples for server and client developers to quickly start using ACP SDKs.

Features

  • ACP Client and ACP Server implementations supporting:
    • Agent discovery
    • Agent invocation
    • List change notifications
  • Fully compatible with all features (such as tools) enabled by MCP.
  • Built-in support for OpenTelemetry instrumentation.

Creating an ACP Server

In this example, you’ll learn how to extend the ACP server by adding a simple “Hello World” agent.

For clarity, these examples intentionally omit advanced topics such as comprehensive error handling, request timeouts, and abort signal propagation. In a production environment, ensure these considerations are properly addressed.

Install the required libraries:

Currently, you must use both acp-sdk (core ACP protocol implementation) and beeai-sdk (BeeAI-specific utilities and schemas). In ACP Alpha, these will be merged into a single library acp-sdk.

uv add beeai-sdk

Next, implement a simple server:

import asyncio

from acp.server.highlevel import Server, Context
from beeai_sdk.providers.agent import run_agent_provider
from beeai_sdk.schemas.text import TextOutput, TextInput

def main():
    server = Server("my-server")

    @server.agent(
        "hello-world", # Agent identifier
        "This is my Hello World agent", # Human-readable description
        input=TextInput,
        output=TextOutput,
    )
    async def run_agent(input: TextInput, ctx: Context) -> TextOutput:
        # Core logic for the "hello-world" agent
        return TextOutput(text=f"Hi there {input.text}")

    asyncio.run(run_agent_provider(server))

Using the ACP Client

In this example, you’ll learn how to use the ACP client to discover and invoke an agent created on the ACP server. Clients typically invoke agents to perform tasks, request data, or trigger automated workflows.

Install the required libraries:

uv add acp-sdk

Next, implement a simple server:

import asyncio

from acp import ClientSession
from acp.client.sse import sse_client


async def run_client():
    async with sse_client(url="http://localhost:8000/sse") as streams:
        async with ClientSession(*streams) as session:
            await session.initialize()

            # List agents
            resp = await session.list_agents()
            print("Available agents:", [agent.name for agent in resp.agents])

            # Run agent
            resp = await session.run_agent("hello-world", {"text": "Bee"})
            print("Agent:", resp.output["text"])


asyncio.run(run_client())