Skip to main content

Crate agent_client_protocol_cookbook

Crate agent_client_protocol_cookbook 

Source
Expand description

Cookbook of common patterns for building ACP components.

This crate contains guides and examples for the three main things you can build with ACP:

  • Clients - Connect to an existing agent and send prompts
  • Proxies - Sit between client and agent to add capabilities (like MCP tools)
  • Agents - Respond to prompts with AI-powered responses

See the agent_client_protocol::concepts module for detailed explanations of the concepts behind the API.

§Building Clients

A client connects to an agent, sends requests, and handles responses. Use Client.builder() to build connections.

§Building Proxies

A proxy sits between client and agent, intercepting and optionally modifying messages. The most common use case is adding MCP tools. Use Proxy.builder() to build proxy connections.

Important: Proxies don’t run standalone—they need the agent-client-protocol-conductor to orchestrate the connection between client, proxies, and agent. See running_proxies_with_conductor for how to put the pieces together.

§Building Agents

An agent receives prompts and generates responses. Use Agent.builder() to build agent connections.

Modules§

building_an_agent
Pattern: Building an agent.
connecting_as_client
Pattern: Connecting as a client.
custom_message_handlers
Pattern: Custom message handlers.
filtering_tools
Pattern: Filtering which tools are available.
global_mcp_server
Pattern: Global MCP server in handler chain.
one_shot_prompt
Pattern: You Only Prompt Once.
per_session_mcp_server
Pattern: Per-session MCP server with workspace context.
reusable_components
Pattern: Defining reusable components.
running_proxies_with_conductor
Pattern: Running proxies with the conductor.