Environment:1ay1 Agentty acp cpp Runtime
| Knowledge Sources | |
|---|---|
| Domains | Protocols, IDE_Integration |
| Last Updated | 2026-10-28 14:00 GMT |
Overview
Agent Client Protocol (ACP) runtime built on the acp-cpp submodule providing JSON-RPC over stdio for editor integration (Zed and other ACP-compatible editors).
Description
This environment provides the acp-cpp external submodule's protocol types and JSON-RPC framing. The AgentServer class in `include/agentty/acp/server.hpp` implements the server side of ACP: it reads JSON-RPC from stdin, dispatches method calls to handlers, and writes notifications + replies to stdout. The server manages multiple sessions, each with its own workspace, model, profile, and turn queue. It shares the same provider, tool, and permission policy stack as the TUI.
Usage
Use this environment for any ACP_Editor_Integration workflow where agentty runs as a subprocess inside an editor (like Zed). It is the mandatory prerequisite for the AgentServer implementation.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | Linux, macOS, or Windows | Cross-platform via acp-cpp submodule |
| Hardware | Any CPU | No GPU required; headless operation |
| Disk | Minimal | Session state rehydrated from ThreadLog |
Dependencies
System Packages
- No external system packages beyond C++ toolchain
Library Packages
- `acp-cpp` submodule (vendored, compiled in-tree)
- JSON-RPC framing (part of acp-cpp)
- ACP protocol types (part of acp-cpp)
Credentials
The following environment variables may be required depending on the provider:
- `ANTHROPIC_API_KEY`: Anthropic API key (if using Anthropic as provider)
- `CLAUDE_CODE_OAUTH_TOKEN`: Claude OAuth token (if using OAuth flow)
Quick Install
# acp-cpp is a vendored git submodule — no separate install needed.
# Ensure submodules are initialized:
git submodule update --init --recursive third_party/acp-cpp
# Build agentty (acp-cpp compiles in):
cmake -B build && cmake --build build -j$(nproc)
# Run agentty in ACP server mode (editor launches this):
./build/agentty --acp
Code Evidence
Server construction from `include/agentty/acp/server.hpp`:
class AgentServer {
public:
AgentServer(rpc::Channel channel, // stdio JSON-RPC transport
StreamFn stream, // provider entrypoint
auth::AuthHeader auth, // resolved credential
std::string model_id, // default model
Profile profile = Profile::Ask,
Extras extras = {});
int serve(const maya::unlocked& cap); // blocks until client disconnects
};
Protocol flow (from server documentation):
Editor (client) AgentServer
-> initialize(params) <- on_initialize -> result (protocol version)
-> session/new(cwd, roots) <- on_new_session -> result
<- session/update (config: slash menu, model picker)
-> session/prompt(text) <- (deferred reply)
<- session/update (InProgress, messages)
<- session/update (Completed)
<- session/prompt result (settled)
Protocol version negotiation from server handler:
// on_initialize — protocol version negotiation (min of ours + theirs),
// capability flags.
::acp::InitializeResult on_initialize(const Cap&, const ::acp::InitializeParams&);
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| Editor cannot connect to agentty | agentty not started in ACP mode | Launch with `--acp` flag or configure editor to use agentty as ACP agent |
| `authentication failed` | No valid API key or OAuth token | Set `ANTHROPIC_API_KEY` or complete OAuth login flow |
| `session/resume failed` | ThreadLog not found or corrupted | Ensure `~/.agentty/` exists with valid thread logs |
| Protocol version mismatch | Editor and agentty use incompatible ACP versions | Update agentty to match editor's ACP version |
Compatibility Notes
- Zed editor: Primary ACP client; agentty is designed to run inside Zed's agent panel.
- Other ACP editors: Any ACP-compatible editor can connect; protocol is stdio JSON-RPC.
- Headless operation: No TUI rendering; all interaction is via JSON-RPC notifications and replies.
- Session resume: Server rehydrates from ThreadLog (`~/.agentty/`); replay history on resume.
- Cross-platform: acp-cpp compiles on Linux, macOS, and Windows alongside agentty.