ACP SDK allows you to wrap an existing agent, regardless of its framework or programming language, into a reusable and interoperable service. By implementing a simple interface, your agent becomes compatible with the ACP protocol. It can communicate over HTTP, interact with other agents in workflows, and exchange structured messages using a shared format.Once wrapped, your agent becomes:
If you haven’t already, install the SDK: uv add acp-sdk
Wrapping an agent with ACP is as simple as annotating a Python function.Use the @server.agent() decorator to define your agent. The name is inferred from the function name, and the description is pulled from the docstring:
echo.py
Copy
Ask AI
from collections.abc import AsyncGeneratorfrom acp_sdk.models import Messagefrom acp_sdk.server import Context, RunYield, RunYieldResume, Server# Create a new ACP server instanceserver = Server()@server.agent()async def echo(input: list[Message], context: Context) -> AsyncGenerator[RunYield, RunYieldResume]: """Echoes everything""" for message in input: yield message# Start the ACP serverserver.run()
This is the minimal structure needed for an ACP-compliant agent. You now have an agent that can receive messages from others, or be called via HTTP, using the ACP protocol.