Quick Start¶
Get two agents talking in under 60 seconds.
Prerequisites¶
- Python 3.9+
- Two terminal windows (or two machines)
Step 1: Get the Relay¶
git clone https://github.com/Kickflip73/agent-communication-protocol.git
cd agent-communication-protocol
No package installation required — acp_relay.py uses Python stdlib only.
Step 2: Start Agent A¶
You'll see:
[ACP] Detecting public IP...
[ACP] AgentA ready on ws://0.0.0.0:7801, http://0.0.0.0:7901
✅ Ready. Your link: acp://1.2.3.4:7801/tok_xxxxxxxx
Send this link to any other Agent to connect.
Copy the acp://... link — this is Agent A's address.
Step 3: Start Agent B¶
In a second terminal:
Step 4: Connect B → A¶
curl -X POST http://localhost:7902/peers/connect \
-H "Content-Type: application/json" \
-d '{"link": "acp://1.2.3.4:7801/tok_xxxxxxxx"}'
Response:
Step 5: Subscribe on Agent A (optional)¶
In a third terminal, watch Agent A's incoming stream:
Step 6: Agent B Sends a Message¶
curl -X POST http://localhost:7902/message:send \
-H "Content-Type: application/json" \
-d '{
"role": "agent",
"parts": [{"type": "text", "content": "Hello from Agent B!"}]
}'
Response:
Agent A's SSE stream fires immediately:
event: acp.message
data: {"role":"agent","from_peer":"peer_001","parts":[{"type":"text","content":"Hello from Agent B!"}],"message_id":"msg_abc123","ts":"2026-03-28T..."}
Step 7: Agent A Replies¶
curl -X POST http://localhost:7901/peer/peer_001/send \
-H "Content-Type: application/json" \
-d '{
"role": "agent",
"parts": [{"type": "text", "content": "Hello back from Agent A!"}]
}'
🎉 You have two agents communicating in real-time.
Using the Python SDK¶
Instead of curl, use the Python SDK:
from acp_client import RelayClient
# Agent B
b = RelayClient("http://localhost:7902")
peer_id = b.connect("acp://1.2.3.4:7801/tok_xxxxxxxx")
b.send("Hello from SDK!", peer_id=peer_id)
# Receive messages (blocking iterator)
for msg in b.recv(timeout=5):
print(f"Got: {msg.parts[0].content}")
Install:
Next Steps¶
- Core Concepts — understand links, peers, tasks, streams
- Team Collaboration — orchestrator + workers
- NAT Traversal — how P2P works across networks
- CLI Reference — all flags and options