This example wraps mini-swe-agent behind ACP so editors such as Zed can interact with it over stdio. A duet launcher is included to run a local Textual client beside the bridge for quick experimentation.
- Accepts ACP prompts, concatenates text blocks, and forwards them to mini-swe-agent
- Streams language-model output via
session/update→agent_message_chunk - Emits
tool_call/tool_call_updatepairs for shell execution, including stdout and return codes - Sends a final
agent_message_chunkwhen mini-swe-agent printsCOMPLETE_TASK_AND_SUBMIT_FINAL_OUTPUT
- Python environment with
mini-swe-agentinstalled (pip install mini-swe-agent) - ACP-capable client (e.g. Zed) or the bundled Textual client
- Optional:
.envfile at the repo root for shared configuration when using the duet launcher
If mini-swe-agent is missing, the bridge falls back to the reference copy at reference/mini-swe-agent/src.
Set environment variables before launching the bridge:
MINI_SWE_MODEL: model identifier such asopenrouter/openai/gpt-4o-miniOPENROUTER_API_KEYfor OpenRouter models, orOPENAI_API_KEY/ANTHROPIC_API_KEYfor native providers- Optional
MINI_SWE_MODEL_KWARGS: JSON blob of extra keyword arguments (OpenRouter defaults are injected automatically when omitted)
The bridge selects the correct API key based on the chosen model and available variables.
Add an Agent Server entry targeting examples/mini_swe_agent/agent.py and provide the environment variables there. Use Zed’s “Open ACP Logs” panel to observe streamed message chunks and tool call events in real time.
To pair the bridge with the Textual TUI client, run:
python examples/mini_swe_agent/duet.pyBoth processes inherit settings from .env (thanks to python-dotenv) and communicate over dedicated pipes.
TUI shortcuts
y: YOLOc: Confirmu: Human (prompts for a shell command and streams it back as a tool call)Enter: Continue
- Agent entrypoint:
examples/mini_swe_agent/agent.py - Duet launcher:
examples/mini_swe_agent/duet.py - Textual client:
examples/mini_swe_agent/client.py