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