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 theAgent interface that all ACP-compliant agents must implement:
src/acp.ts
Agent Responsibilities
Agents are responsible for:- Processing Prompts - Understanding user requests and generating appropriate responses
- Managing Language Models - Interfacing with LLMs to generate code and responses
- Executing Tool Calls - Performing operations like reading files, running commands
- Streaming Updates - Sending real-time progress updates to the client
- Session State - Maintaining conversation history and context
- 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 theClient interface:
src/acp.ts
Client Responsibilities
Clients are responsible for:- User Interface - Displaying agent responses, tool calls, and progress updates
- Resource Access - Providing controlled access to files, terminals, and other resources
- Permission Management - Prompting users for authorization before sensitive operations
- Environment Management - Managing working directories, MCP server connections
- Session Persistence - Storing and retrieving conversation history
- 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:Agent Capabilities
Agent Capabilities
Client Capabilities
Client Capabilities
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: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