Skip to main content

Crate rpc_agent

Crate rpc_agent 

Source
Expand description

§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:

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.

Modules§

error

Structs§

AgentServer
Main agent server type, responsible for handling requests and managing tools/providers.
AgentServerBuilder
Builder for configuring and launching an AgentServer. Builder for creating an AgentServer.
ToolWrapper
Wrapper type for integrating tools into the agent server. A wrapper around a Tool that implements Clone.

Enums§

Message
Represents a message to be sent to the AI provider.
Providers
Enum of supported AI providers. Supported AI providers for the agent server.