Just a show of the bridge in action. Not a best-effort or absolutely-correct implementation of the agent.
A minimal Agent Client Protocol (ACP) bridge that wraps mini-swe-agent so it can be run by Zed as an external agent over stdio, and also provides a local Textual UI client.
Add an agent_servers entry to Zed’s settings.json. Point command to the Python interpreter that has both agent-client-protocol and mini-swe-agent installed, and args to this example script:
{
"agent_servers": {
"Mini SWE Agent (Python)": {
"command": "/abs/path/to/python",
"args": [
"/abs/path/to/agent-client-protocol-python/examples/mini_swe_agent/agent.py"
],
"env": {
"MINI_SWE_MODEL": "openrouter/openai/gpt-4o-mini",
"MINI_SWE_MODEL_KWARGS": "{\"api_base\":\"https://openrouter.ai/api/v1\"}",
"OPENROUTER_API_KEY": "sk-or-..."
}
}
}
}Notes
- If you install
agent-client-protocolfrom PyPI, you do not need to setPYTHONPATH. - Using OpenRouter:
- Set
MINI_SWE_MODELto a model supported by OpenRouter (e.g.openrouter/openai/gpt-4o-mini,openrouter/anthropic/claude-3.5-sonnet). - Set
MINI_SWE_MODEL_KWARGSto a JSON containingapi_base:{ "api_base": "https://openrouter.ai/api/v1" }. - Set
OPENROUTER_API_KEYto your API key.
- Set
- Alternatively, you can use native OpenAI/Anthropic APIs. Set
MINI_SWE_MODELaccordingly and provide the vendor-specific API key;MINI_SWE_MODEL_KWARGSis optional.
Use the duet launcher to run both the ACP agent and the local Textual client connected over dedicated pipes. The client keeps your terminal stdio; ACP messages flow over separate FDs.
# From repo root
python examples/mini_swe_agent/duet.pyEnvironment
- The launcher loads
.envfrom the repo root using python-dotenv (override=True) so both child processes inherit the same environment. - Minimum for OpenRouter:
MINI_SWE_MODEL="openrouter/openai/gpt-4o-mini"OPENROUTER_API_KEY="sk-or-..."- Optional:
MINI_SWE_MODEL_KWARGS='{"api_base":"https://openrouter.ai/api/v1"}'(auto-injected if missing)
Quit behavior
- Quit from the TUI cleanly ends the background loop; duet will terminate both processes gracefully and force-kill after a short timeout if needed.
- User prompt handling
- Text blocks are concatenated into a task and passed to mini-swe-agent.
- Streaming updates
- The agent sends
session/updatewithagent_message_chunkfor incremental messages.
- The agent sends
- Command execution visualization
- Each bash execution is reported with a
tool_call(start) and atool_call_update(complete) including command and output (returncodein rawOutput).
- Each bash execution is reported with a
- Final result
- A final
agent_message_chunkis sent at the end of the turn with the submitted output.
- A final
Use Zed’s “open acp logs” command to inspect ACP traffic if needed.