Expand description
§Messaggero
High-performance AI agent communication protocol for Rust.
Provides A2A-compatible interoperability over HTTP/JSON-RPC alongside a fast binary transport over Unix domain sockets for local agent-to-agent communication with minimal overhead.
§Quick Start
ⓘ
use messaggero::prelude::*;
struct EchoAgent;
#[async_trait]
impl Agent for EchoAgent {
fn card(&self) -> AgentCard {
AgentCard::builder("echo")
.description("Echoes messages back")
.skill("echo", "Echo", "Echoes any message")
.build()
}
async fn handle_task(&self, req: TaskRequest) -> Result<TaskResponse, AgentError> {
let text = req.message.text_content().unwrap_or("...");
Ok(TaskResponse::completed(&req.id, Message::agent(format!("Echo: {text}"))))
}
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
messaggero::serve(EchoAgent)
.fast("/tmp/echo.sock")
.http("127.0.0.1:3000")
.run()
.await
}Re-exports§
pub use core::agent::Agent;pub use core::agent::LoggingMiddleware;pub use core::agent::Middleware;pub use core::agent::MiddlewareStack;pub use core::codec::Encoding;pub use core::error::AgentError;pub use core::error::CodecError;pub use core::error::TransportError;pub use core::jsonrpc;pub use transport::AgentEndpoint;pub use transport::Discovery;pub use transport::Router;pub use transport::fast::FastClient;pub use transport::fast::FastMessage;pub use transport::a2a::A2AClient;pub use transport::log::Direction;pub use transport::log::LogEntry;pub use transport::log::TransportKind;pub use transport::log::TransportLogger;pub use transport::log::TransportLoggerBuilder;pub use core::types::*;
Modules§
Structs§
- Messaggero
Client - Unified client that auto-selects the best transport for reaching an agent.
- Server
Builder - Builder for serving an agent on one or more transports simultaneously.
Functions§
- serve
- Create a
ServerBuilderto serve the given agent.