Skip to main content
The Agent-Client Protocol defines two distinct roles: Agents and Clients. Each has specific responsibilities and capabilities in the communication flow.

Overview

Agent

AI-powered programs that autonomously write and modify code using language models

Client

Development environments (IDEs, editors) that provide the interface and control access to resources

What is an Agent?

An Agent is a program that uses generative AI to autonomously modify code. Agents receive prompts from users (via the client), process them using language models, and execute tasks using tools.

Agent Interface

The SDK defines the Agent interface that all ACP-compliant agents must implement:
src/acp.ts

Agent Responsibilities

Agents are responsible for:
  1. Processing Prompts - Understanding user requests and generating appropriate responses
  2. Managing Language Models - Interfacing with LLMs to generate code and responses
  3. Executing Tool Calls - Performing operations like reading files, running commands
  4. Streaming Updates - Sending real-time progress updates to the client
  5. Session State - Maintaining conversation history and context
  6. MCP Integration - Connecting to Model Context Protocol servers for additional tools
Agents initiate most actions but must request permission from clients for sensitive operations.

Example: Basic Agent Structure

What is a Client?

A Client is typically a code editor or IDE that provides the interface between users and AI agents. Clients manage the development environment, handle user interactions, and control access to resources.

Client Interface

The SDK defines the Client interface:
src/acp.ts

Client Responsibilities

Clients are responsible for:
  1. User Interface - Displaying agent responses, tool calls, and progress updates
  2. Resource Access - Providing controlled access to files, terminals, and other resources
  3. Permission Management - Prompting users for authorization before sensitive operations
  4. Environment Management - Managing working directories, MCP server connections
  5. Session Persistence - Storing and retrieving conversation history
  6. Capability Advertisement - Informing agents which features are available
Clients have the final say on all operations. They can deny any agent request and cancel operations at any time.

Example: Basic Client Structure

Interaction Flow

Here’s how agents and clients work together:

Capabilities and Features

Both sides advertise capabilities during initialization:
Optional methods (marked with ?) are only available if the corresponding capability is advertised during initialization.

Key Differences

Extension Methods

Both agents and clients can implement custom methods beyond the ACP specification:
To avoid conflicts, prefix extension methods with a unique identifier (e.g., your domain name).

Learn More

Connections

Learn how to establish agent-client connections

Sessions

Understand session lifecycle and management

Build an Agent

Step-by-step guide to building your first agent

Build a Client

Step-by-step guide to building your first client