Overview of the new Rust SDK (SACP-based)
mainThe new Rust SDK for the Agent Client Protocol (ACP) is based on the SACP (Symposium ACP) implementation. It moves away from a simple trait-based callback model to a component-based architecture. Key improvements include:
- Builder Patterns: For constructing components and connections.
- Explicit Directional Naming: Uses types like
ClientToAgentandAgentToClientto clarify peer relationships and support multiple peers (essential for proxies). - Connection Context (
cx): Handlers receive a context object that allows them to send requests and notifications back through the connection, enabling streaming progress. - Dynamic Handlers: Supports adding/removing closure-based handlers that can be specific to a particular session.
- Ordering Guarantees: Provides mechanisms to ensure messages are processed in order and that notifications are handled before a response is sent.
- Starvation-Free APIs: Designed to prevent common async Rust pitfalls where message processing is blocked during long-running tasks.