This guide gets you from a clean environment to streaming ACP messages from a Python agent.
- Python 3.10+ and either
piporuv - An ACP-capable client such as Zed (optional but recommended for testing)
pip install agent-client-protocol
# or
uv add agent-client-protocolLaunch the ready-made echo example, which streams text blocks back over ACP:
python examples/echo_agent.pyKeep it running while you connect your client.
Add an Agent Server entry in settings.json (Zed → Settings → Agents panel):
{
"agent_servers": {
"Echo Agent (Python)": {
"command": "/abs/path/to/python",
"args": [
"/abs/path/to/agent-client-protocol-python/examples/echo_agent.py"
]
}
}
}Open the Agents panel and start the session. Each message you send should be echoed back via streamed session/update notifications.
Any ACP client that communicates over stdio can spawn the same script; no additional transport configuration is required.
Create your own agent by subclassing acp.Agent. The pattern mirrors the echo example:
from acp import Agent, PromptRequest, PromptResponse
class MyAgent(Agent):
async def prompt(self, params: PromptRequest) -> PromptResponse:
# inspect params.prompt, stream updates, then finish the turn
return PromptResponse(stopReason="end_turn")Hook it up with AgentSideConnection inside an async entrypoint and wire it to your client. Refer to examples/echo_agent.py for the complete structure, including lifetime hooks (initialize, newSession) and streaming responses.
The repository also ships a bridge for mini-swe-agent. To try it:
- Install the dependency:
pip install mini-swe-agent
- Configure Zed to run
examples/mini_swe_agent/agent.pyand supply environment variables such asMINI_SWE_MODELandOPENROUTER_API_KEY. - Review the Mini SWE Agent guide for environment options, tool-call mapping, and a duet launcher that starts both the bridge and a Textual client (
python examples/mini_swe_agent/duet.py).