ACP (Agent Client Protocol)
Expose cagent agents via the Agent Client Protocol for integration with ACP-compatible hosts like VS Code, IDEs, and other developer tools.
Overview
The cagent acp command starts an ACP server that communicates over stdio (standard input/output). This makes it ideal for integration with editors, IDEs, and other tools that spawn agent processes — the host sends JSON-RPC messages to cagent’s stdin and reads responses from stdout.
ACP is built on the ACP Go SDK and provides a standardized way for client applications to interact with AI agents.
Usage
# Start ACP server on stdio
$ cagent acp ./agent.yaml
# With a multi-agent team config
$ cagent acp ./team.yaml
# From the agent catalog
$ cagent acp agentcatalog/pirate
# With a custom session database
$ cagent acp ./agent.yaml --session-db ./my-sessions.db
How It Works
- The host application spawns
cagent acp agent.yamlas a child process - Communication happens over stdin/stdout using the ACP protocol
- The host sends user messages, cagent processes them through the agent
- Agent responses, tool calls, and events stream back to the host
- Sessions are persisted in a SQLite database for continuity
# Conceptual flow:
Host Application
└── spawns: cagent acp agent.yaml
├── stdin ← JSON-RPC requests from host
└── stdout → JSON-RPC responses to host
Features
- Stdio transport — No network ports needed; ideal for subprocess integration
- Session persistence — SQLite-backed sessions survive process restarts
- Full agent support — All cagent features work: tools, multi-agent, model fallbacks
- Multi-agent configs — Team configurations with sub-agents work transparently
- Filesystem operations — Agents can read/write files relative to the host’s working directory
CLI Flags
cagent acp <agent-file>|<registry-ref> [flags]
| Flag | Default | Description |
|---|---|---|
-s, --session-db |
~/.cagent/session.db |
Path to the SQLite session database |
Integration Example
A host application would spawn cagent as a subprocess and communicate via the ACP protocol:
// Pseudocode for an IDE extension
const child = spawn("cagent", ["acp", "./agent.yaml"]);
// Send a message to the agent
child.stdin.write(
JSON.stringify({
jsonrpc: "2.0",
method: "agent/run",
params: { message: "Explain this code" },
}),
);
// Read responses
child.stdout.on("data", (data) => {
const response = JSON.parse(data);
// Handle agent response, tool calls, etc.
});
Use ACP when building **IDE integrations**, **editor plugins**, or any tool that wants to embed a cagent agent as a subprocess. For HTTP-based integrations, use the API Server instead.
For HTTP-based agent access, see the API Server. For agent-to-agent communication, see A2A Protocol. For exposing agents as MCP tools, see MCP Mode.