Minimal, unbreakable ACP-compliant LLM agent. Stdio in, tool calls out. Non-streaming. No persistence. No cleverness.ACP is the Agent Client Protocol — JSON-RPC 2.0 over stdio between a client (Zed, JetBrains, buzz-acp, …) and an agent. MCP is how the agent talks to its tools.
buzz-agent is the agent.
What It Is
session/prompt. The agent loops: call the LLM → get tool calls → run them via MCP → feed results back → repeat. The loop terminates when the LLM stops asking for tools, the round cap is hit, or the client cancels.
The agent’s output is its tool calls. Generated text is forwarded to the client as agent_message_chunk updates, but the real work happens in the tools. The LLM call is non-streaming — one HTTP POST, one response.
Quick Start
ACP Transcript
A complete round-trip. Lines starting with→ are client→agent (stdin); ← are agent→client (stdout). Each line is one newline-terminated JSON value. Comments are not part of the wire.
initialize, session/new, session/prompt), one inbound notification (session/cancel), and three outbound update variants (agent_message_chunk, tool_call, tool_call_update). The full server is hand-rolled in main.rs.
Configuration
Everything is environment variables. No flags, no config files. (We are a subprocess; subprocess config is environment.)Reply Guard
Off by default, except on Buzz shared-compute (mesh) agents, where Buzz Desktop setsBUZZ_AGENT_REQUIRE_REPLY=1 automatically. With it enabled, a turn that is
about to end without any recognized attempt to post to Buzz gets a reminder that
its assistant text is invisible to humans, and is rerolled.
This exists because a Buzz agent’s reasoning and tool output are not shown to
anyone. A turn that does real work and never posts is a silent failure — the
requester waits on a result that was produced and thrown away.
Mesh agents get it by default because they run on small local models, which are
the ones most likely to do the work and then end the turn without publishing it.
Setting BUZZ_AGENT_REQUIRE_REPLY=0 on the agent, persona, or global env opts a
mesh agent back out; the default never overrides an explicit value.
Advisory, never a trap. At most two reminders, then the turn ends whether or
not anything was published. The guard catches accidental omission; it does not
compel speech. The reminder text explicitly licenses silence, because the
built-in system prompt says publishing is optional and silence is often the
correct outcome.
Recognition contract. A turn counts as having replied when it issues a call
that:
- resolves to a registered, non-hook tool (a hallucinated tool name is rejected at preflight and never runs, so it must not disarm the guard),
- whose qualified name ends in
__shell— i.e. the bare tool name is exactlyshell, which isbuzz-dev-mcp’s shell tool and any other server’s, and - whose
commandargument containsmessages sendorreactions add.
messages send also covers messages send-diff. Reactions count because the
built-in prompt directs agents to react rather than post a bare
acknowledgement, so nagging an agent that reacted would punish documented
behavior.
Detection is checked after the per-turn tool-call cap
(MAX_TOOL_CALLS_PER_TURN) is applied: a publish-shaped call that was discarded
never ran.
It recognizes an attempt, not a successful publish. Only the command text is
inspected, never the exit status. A send that fails still satisfies the guard —
which is fine, since a failed send already returns a non-zero exit and error
JSON to the model, louder feedback than a reminder.
Known limits, both deliberate. A command assembled at runtime ($CMD) or
buried in a wrapper script is missed, so that turn is reminded despite having
posted. Text that merely quotes a send (echo "buzz messages send") matches, so
that turn is not reminded. Missing a real post is the expensive direction, and
substring matching is the forgiving one there. Neither edge is pinned by a test;
the matcher is free to improve.
Budget. Reminders ride the existing _Stop gate and share
BUZZ_AGENT_STOP_MAX_REJECTIONS — the outer cap on every end-turn objection.
At the default 3 both reminders fit; at 1 only one does; at 0 the guard is off
along with the hooks. A round carrying both a _Stop hook objection and a
reminder costs one rejection and delivers both texts. This is not a new
lifecycle hook — see MCP_DRIVEN_HOOKS.md.
Providers
buzz-agent speaks a few HTTP dialects. Pick with BUZZ_AGENT_PROVIDER.
If
BUZZ_AGENT_PROVIDER=anthropic is selected without ANTHROPIC_API_KEY, BUZZ_AGENT_PROVIDER=openai is selected without OPENAI_COMPAT_API_KEY, or BUZZ_AGENT_PROVIDER=openrouter is selected without OPENROUTER_API_KEY, the agent returns an error — there is no implicit fallback to another provider.
provider=openai speaks two HTTP dialects: the Responses API (/v1/responses, required for GPT-5 / o-series tool-calling on OpenAI’s own service) and the Chat Completions API (/chat/completions, the broadly-supported OpenAI-compatible wire format).
By default (OPENAI_COMPAT_API=auto) the agent picks Responses when OPENAI_COMPAT_BASE_URL points at an *.openai.com host and Chat Completions everywhere else. Pin the choice explicitly with OPENAI_COMPAT_API=chat or OPENAI_COMPAT_API=responses for providers that diverge from the default (e.g. a Responses-compatible self-hosted gateway).
provider=openrouter is first-class, not routed through provider=openai: it speaks OpenAI’s Chat Completions wire format but with OpenRouter-specific extensions layered on top —
reasoning.effortis set on the request when reasoning effort is configured. The request deliberately carries noprovider.require_parametersfilter: that filter routes only to endpoints advertising every parameter in the body, and 83 of 274 tools-capable OpenRouter models do not advertisereasoning, so it turns an effort setting into a hard 404 on a valid model id. A model that cannot reason answers without reasoning instead.- The response’s
reasoning_detailsarray (opaque extended-thinking payload) is captured and replayed byte-for-byte on the next turn’s assistant message, so multi-turn tool use keeps the model’s chain-of-thought. anthropic/*models get Anthropic-stylecache_controlbreakpoints injected on the system message and the last two user messages.- Retryable statuses (429 and typed
provider_overloaded503) honor the documentedRetry-Afterheader (clamped to a small ceiling — seeRETRY_AFTER_CAP_SECSinllm.rs— since the sleep happens outsideBUZZ_AGENT_LLM_TIMEOUT_SECS); 502 and untyped 503 retry with jittered backoff instead.401is treated as an expired/invalid key and refreshed once, while402(no credits) and403(guardrail/moderation/permission) fail immediately without retry.
Provider is a Rust enum with one match in Llm::complete. There is no trait, no Box<dyn>, no async-trait. Adding a provider is a match arm and one body/parse pair in llm.rs.
MCP Servers
The client passes MCP server specs insession/new. The agent spawns each one as a stdio subprocess, calls tools/list, and merges everything into a single tool catalog the LLM sees. Tool names are namespaced as server__tool (double underscore separator). Bare tool names containing __ are rejected at registration.
Example: a single echo MCP server.
agentCapabilities (mcpCapabilities.http: false, mcpCapabilities.sse: false); spec-compliant clients won’t ask for what we don’t have.
Security Model
The trust boundary is the operator who launched the agent. The harness, MCP server binaries, and API keys are all trusted. Untrusted input — model output, tool results, prompts — is bounded.Bounded Everything
What This Is NOT
A short list, because the answer is mostly “no”:- Not a framework. No plugins, no recipes, no slash commands, no modes. MCP servers can participate in agent lifecycle via hook tools (
_Stop,_PostCompact), but these are advisory, fail-open, and budget-bounded — not a plugin system. - Not streaming. One non-streaming HTTP POST per round. The LLM’s generated text is forwarded to the client as
agent_message_chunk, but there is no token-level streaming. - Not persistent. Everything is in-memory, per-process. No SQLite. When context fills, the agent summarizes its own history and continues (context handoff). No external persistence.
- Not an SDK. This is a binary. The protocol seam is stdin/stdout. Use it from any language.
- Not a UI. No TUI, no web, no notifications. The client renders.
- Not authenticated. API keys come from env. Use systemd, Docker secrets, or a wrapper.
- Not networked MCP. Stdio transport only. No HTTP/SSE MCP transport.
- Not load-able. No
session/load. We advertiseloadSession: false. - Not a router. No agent-to-agent, no fan-out, no orchestration. One model. One loop.
Building
Testing
- Fake LLM —
tests/fake_llm.rsand the helpers intests/regressions.rsspin up a realtokio::net::TcpListeneron port 0, parseContent-Length, and return scripted JSON. No HTTP mocking library. - Fake MCP server —
tests/bin/fake_mcp.rsis a separate binary controlled by env vars:FAKE_MCP_HANG_INIT,FAKE_MCP_TOOL_DELAY,FAKE_MCP_SPAWN_GRANDCHILD, etc. Each fault path is a real process being abused. - Regression tests are the changelog. Each
#[test]inregressions.rsis named for the bug it locks down:assistant_text_preserved_across_prompts,cancel_leaves_history_valid_for_next_prompt,mcp_init_timeout_kills_child,oversize_line_kills_connection. Read them in order to learn the protocol’s failure modes.