Skip to main content

Module component

Module component 

Source
Expand description

Component abstraction for agents and proxies ConnectTo abstraction for agents and proxies.

This module provides the ConnectTo trait that defines the interface for things that can be run as part of a conductor’s chain - agents, proxies, or any ACP-speaking component.

§Usage

Components connect to other components, creating a chain of message processors. The type parameter R is the role that this component connects to (its counterpart).

To implement a component, implement the connect_to method:

use agent_client_protocol::{Agent, Client, Connect, Result};

struct MyAgent {
    // configuration fields
}

// An agent connects to clients
impl ConnectTo<Client> for MyAgent {
    async fn connect_to(self, client: impl ConnectTo<Agent>) -> Result<()> {
        Agent.builder()
            .name("my-agent")
            // configure handlers here
            .connect_to(client)
            .await
    }
}

Structs§

DynConnectTo
A dynamically-typed component for heterogeneous collections.

Traits§

ConnectTo
A component that can exchange JSON-RPC messages to an endpoint playing the role R (e.g., an ACP Agent or an MCP Server).