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 sacp:
- 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 sacp::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
ClientToAgent as your link type.
one_shot_prompt- Send a single prompt and get a response (simplest pattern)connecting_as_client- More details on connection setup and permission handling
§Building Proxies
A proxy sits between client and agent, intercepting and optionally modifying
messages. The most common use case is adding MCP tools. Use ProxyToConductor
as your link type.
Important: Proxies don’t run standalone—they need the sacp-conductor to
orchestrate the connection between client, proxies, and agent. See
running_proxies_with_conductor for how to put the pieces together.
global_mcp_server- Add tools that work across all sessionsper_session_mcp_server- Add tools with session-specific statefiltering_tools- Enable or disable tools dynamicallyreusable_components- Package your proxy as aComponentfor compositionrunning_proxies_with_conductor- Run your proxy with an agent
§Building Agents
An agent receives prompts and generates responses. Use AgentToClient as
your link type.
building_an_agent- Handle initialization, sessions, and promptsreusable_components- Package your agent as aComponentcustom_message_handlers- Fine-grained control over message routing
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.