Expand description
ACP (Agent Client Protocol) adapter for mixtape agents.
This crate bridges mixtape-core agents to the Agent Client Protocol, enabling editors and IDEs — VS Code, Zed, Neovim, JetBrains, Emacs, etc. — to use mixtape agents.
§Architecture
The ACP SDK returns !Send futures (uses RPITIT without + Send bounds),
while mixtape’s Agent is Send + Sync. The bridge works as follows:
- The ACP protocol loop runs on a
tokio::task::LocalSet MixtapeAcpAgentimplementsacp::Agent— its methods run in!Sendcontext- Inside
prompt(),Agent::run()is dispatched viatokio::spawn()onto the multi-threaded runtime - Events flow back via mpsc channels to a
spawn_localrelay task that callsconn.session_notification() - Permission requests carry an
Arc<Agent>— the relay task callsconn.request_permission()to show a dialog in the IDE, then delivers the result viaagent.respond_to_authorization(), unblocking the agent’srequest_authorization()which is waiting on an mpsc channel
§Example
use mixtape_acp::{MixtapeAcpBuilder, serve_stdio};
use mixtape_core::Agent;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let server = MixtapeAcpBuilder::new("my-agent", "0.1.0")
.with_agent_factory(|| async {
Agent::builder()
// .bedrock(ClaudeSonnet4)
.build()
.await
})
.build()?;
serve_stdio(server).await?;
Ok(())
}Re-exports§
pub use error::AcpError;
Modules§
Structs§
- Mixtape
AcpBuilder - Builder for configuring and constructing an ACP server.
- Mixtape
AcpServer - The server bundle returned by
MixtapeAcpBuilder::build.
Functions§
- serve_
stdio - Serve the ACP protocol over stdin/stdout.