Skip to main content

rpc_agent/
lib.rs

1//! # rpc-agent
2//!
3//! This crate provides a modular framework for building RPC-based AI agent servers.
4//! It exposes core components for agent management, tool integration, error handling,
5//! and provider abstraction. Use the [`AgentServerBuilder`] to configure and launch
6//! your own agent server with custom tools and providers.
7//!
8//! ## Example
9//!
10//! Here is a minimal example of how to set up and run an Ollama RPC agent:
11//!
12//!```rust,ignore
13//!use rpc_agent::Providers;
14//!
15//!#[tokio::main]
16//!async fn main() -> Result<(), Box<dyn std::error::Error>> {
17//!    let builder = rpc_agent::AgentServerBuilder::new(
18//!        5500,
19//!        Providers::Ollama,
20//!        "You're a friendly assistant",
21//!        "gpt-oss:20b",
22//!    );
23//!
24//!    let server = builder.build()?;
25//!
26//!    server.run().await?;
27//!
28//!    Ok(())
29//!}
30//!```
31//!
32//! ## Feature Flags
33//!
34//! `tracing`: Enables `tracing` instrumentation for request/response traces.
35//!
36mod agent;
37mod builder;
38pub mod error;
39mod jwt;
40
41mod message;
42mod providers;
43mod tools;
44
45#[cfg(test)]
46mod tests;
47
48/// Builder for configuring and launching an [`AgentServer`].
49pub use builder::AgentServerBuilder;
50
51/// Wrapper type for integrating tools into the agent server.
52pub use tools::ToolWrapper;
53
54/// Main agent server type, responsible for handling requests and managing tools/providers.
55pub use agent::AgentServer;
56
57/// Enum of supported AI providers.
58pub use providers::Providers;
59
60pub use message::Message;