Documentation Index
Fetch the complete documentation index at: https://agentcommunicationprotocol.dev/llms.txt
Use this file to discover all available pages before exploring further.
This guide will walk you through using the Agent Communication Protocol (ACP) to create and run your first agent, interact with it using HTTP requests, and build a basic client.
This guide uses uv. See the uv primer for more
details.
Initialize your project
uv init --python '>=3.11' my_acp_project
cd my_acp_project
Create an agent
Let’s create a simple “echo agent” that returns any message it receives.
Create an agent.py file in your project directory with the following code:import asyncio
from collections.abc import AsyncGenerator
from acp_sdk.models import Message
from acp_sdk.server import Context, RunYield, RunYieldResume, Server
server = Server()
@server.agent()
async def echo(
input: list[Message], context: Context
) -> AsyncGenerator[RunYield, RunYieldResume]:
"""Echoes everything"""
for message in input:
await asyncio.sleep(0.5)
yield {"thought": "I should echo everything"}
await asyncio.sleep(0.5)
yield message
server.run()
Verify your agent is available
In another terminal, run the following curl command:curl http://localhost:8000/agents
You should see a JSON response containing your echo agent, confirming it’s available. Run the agent via HTTP
curl -X POST http://localhost:8000/runs \
-H "Content-Type: application/json" \
-d '{
"agent_name": "echo",
"input": [
{
"role": "user",
"parts": [
{
"content": "Howdy!",
"content_type": "text/plain"
}
]
}
]
}'
Your response should include the echoed message “Howdy!”.Build an ACP client
Here’s a simple ACP client to interact with your echo agent.
Create a client.py file in your project directory with the following code:import asyncio
from acp_sdk.client import Client
from acp_sdk.models import Message, MessagePart
async def example() -> None:
async with Client(base_url="http://localhost:8000") as client:
run = await client.run_sync(
agent="echo",
input=[
Message(
parts=[MessagePart(content="Howdy to echo from client!", content_type="text/plain")]
)
],
)
print(run.output)
if __name__ == "__main__":
asyncio.run(example())
Run the ACP client
You should see the echoed response printed to your console. 🎉
Now that you’re up and running, explore Example Agents, Core Concepts, or browse the full API Reference.