agent-client-protocol-tokio 0.11.0

Tokio-based utilities for the Agent Client Protocol
Documentation

agent-client-protocol-tokio

Tokio-based utilities for working with ACP agents.

What's in this crate?

This crate provides helpers for spawning and connecting to ACP agents using the Tokio async runtime:

  • AcpAgent — Configuration for spawning agent processes, parseable from command strings or JSON
  • Stdio — A transport that connects over stdin/stdout with optional debug logging

Usage

The main use case is spawning an agent process and connecting to it:

use agent_client_protocol::{Client, ConnectTo};
use agent_client_protocol_tokio::AcpAgent;
use std::str::FromStr;

let agent = AcpAgent::from_str("python my_agent.py")?;

// The agent process is spawned automatically when connected
Client.builder()
    .name("my-client")
    .connect_to(agent)
    .await?;

You can also add debug logging to inspect the wire protocol:

use agent_client_protocol_tokio::{AcpAgent, LineDirection};

let agent = AcpAgent::from_str("python my_agent.py")?
    .with_debug(|line, direction| {
        eprintln!("{direction:?}: {line}");
    });

When to use this crate

Use agent-client-protocol-tokio when you need to:

  • Spawn agent processes from your code
  • Test agents by programmatically launching them
  • Build tools that orchestrate multiple agents

If you're implementing an agent that listens on stdin/stdout, you only need the core agent-client-protocol crate.

Related Crates

License

Apache-2.0