agent_client_protocol/concepts/acp_basics.rs
1//! The roles in ACP: clients, agents, proxies, and conductors.
2//!
3//! The Agent-Client Protocol defines how AI agents communicate with the
4//! applications that use them. Understanding the four roles helps you choose
5//! the right approach for what you're building.
6//!
7//! # Clients
8//!
9//! A **client** is an application that wants to use an AI agent. Examples include:
10//!
11//! - IDEs like VS Code or JetBrains
12//! - Command-line tools
13//! - Web applications
14//! - Automation scripts
15//!
16//! Clients send prompts to agents and receive responses. They can also handle
17//! requests from the agent (like permission requests or tool approvals).
18//!
19//! # Agents
20//!
21//! An **agent** is an AI-powered service that responds to prompts. Examples include:
22//!
23//! - Claude Code
24//! - Custom agents built with language models
25//!
26//! Agents receive prompts, process them (typically by calling an LLM), and stream
27//! back responses. They may also request permissions, invoke tools, or ask for
28//! user input during processing.
29//!
30//! # Proxies
31//!
32//! A **proxy** sits between a client and an agent, intercepting and potentially
33//! modifying messages in both directions. Proxies are useful for:
34//!
35//! - Adding tools via MCP (Model Context Protocol) servers
36//! - Injecting system prompts or context
37//! - Logging and debugging
38//! - Filtering or transforming messages
39//!
40//! Proxies can be chained - you can have multiple proxies between a client and
41//! an agent, each adding its own capabilities.
42//!
43//! # Conductors
44//!
45//! A **conductor** orchestrates a chain of proxies with a final agent. It:
46//!
47//! - Spawns and manages proxy processes
48//! - Routes messages through the chain
49//! - Handles initialization and shutdown
50//!
51//! The [`agent-client-protocol-conductor`] crate provides a conductor implementation. Most users
52//! don't need to implement conductors themselves - they just configure which
53//! proxies to use.
54//!
55//! # Message Flow
56//!
57//! Messages flow through the system like this:
58//!
59//! ```text
60//! Client <-> Proxy 1 <-> Proxy 2 <-> ... <-> Agent
61//! ^ ^
62//! | |
63//! +------ Conductor manages -------+
64//! ```
65//!
66//! Each arrow represents a bidirectional connection. Requests flow toward the
67//! agent, responses flow back toward the client, and notifications can flow
68//! in either direction.
69//!
70//! # Next Steps
71//!
72//! Now that you understand the roles, see [Connections and Links](super::connections)
73//! to learn how to establish connections in code.
74//!
75//! [`agent-client-protocol-conductor`]: https://crates.io/crates/agent-client-protocol-conductor