Skip to main content

Crate agent_io

Crate agent_io 

Source
Expand description

§BU Agent SDK

A Rust SDK for building AI agents with multi-provider LLM support.

§Features

  • Multi-provider LLM support (OpenAI, Anthropic, Google Gemini)
  • Tool/function calling with dependency injection
  • Streaming responses with event-based architecture
  • Context compaction for long-running conversations
  • Token usage tracking and cost calculation

§Quick Start

use std::sync::Arc;
use agent_io::{Agent, llm::ChatOpenAI, tools::FunctionTool};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let llm = ChatOpenAI::new("gpt-4o")?;
    let agent = Agent::builder()
        .with_llm(Arc::new(llm))
        .build()?;
     
    let response = agent.query("Hello!").await?;
    println!("{}", response);
    Ok(())
}

Re-exports§

pub use agent::Agent;
pub use agent::AgentEvent;
pub use llm::BaseChatModel;
pub use memory::EmbeddingProvider;
pub use memory::InMemoryStore;
pub use memory::MemoryManager;
pub use memory::MemoryStore;
pub use tokens::TokenCost;
pub use tools::Tool;
pub use observability::*;

Modules§

agent
Agent core implementation
llm
LLM abstraction layer for multiple providers
memory
Memory system for AI agents
observability
Observability module for agent_io with tracing integration.
tokens
Token usage tracking and cost calculation
tools
Tool system with dependency injection

Macros§

observe
Macro to create an observed function
observe_debug
Macro for debug-only observation

Enums§

Error
Error types for the SDK

Type Aliases§

Result
Result type alias for SDK operations