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.

ℹ️ ACP vs A2A vs MCP
**ACP** connects an agent to a *host application* (IDE, CLI tool) via stdio. **A2A** connects *agents to other agents* over HTTP. **MCP** exposes agents as *tools* for other MCP clients. Choose based on your integration target.

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

  1. The host application spawns cagent acp agent.yaml as a child process
  2. Communication happens over stdin/stdout using the ACP protocol
  3. The host sends user messages, cagent processes them through the agent
  4. Agent responses, tool calls, and events stream back to the host
  5. 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

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.
});
💡 When to use ACP

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.

ℹ️ See also

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.