What is an Agent?
In the Agent-Client Protocol (ACP), an agent is a program that uses generative AI to autonomously perform tasks like modifying code, answering questions, and executing operations on behalf of users. Agents communicate with clients (typically code editors or IDEs) through a standardized protocol.Agent Responsibilities
An ACP-compliant agent is responsible for:- Session Management: Creating and maintaining conversation sessions with independent contexts and history
- Prompt Processing: Receiving user prompts, processing them with language models, and returning responses
- Tool Execution: Executing tool calls and reporting results back to the client
- Permission Handling: Requesting user permission before performing sensitive operations
- Real-time Updates: Streaming progress updates to the client during prompt processing
- State Management: Tracking session state and handling cancellation requests
Architecture Overview
The ACP TypeScript SDK provides two main components for building agents:AgentSideConnection
The connection class that handles communication with clients over a bidirectional stream. It provides methods for sending session updates, requesting permissions, and accessing client capabilities.
Example Agent
For a complete working example, see the example agent implementation in the TypeScript SDK repository. The example demonstrates:- Session management
- Sending message chunks
- Tool call lifecycle
- Permission requests
- Cancellation handling
Next Steps
AgentSideConnection
Learn about the connection class and its methods
Agent Interface
Implement the required Agent interface methods
Handling Prompts
Process user prompts and send updates
Session Management
Create and manage conversation sessions