Skip to main content

Crate ares

Crate ares 

Source
Expand description

§A.R.E.S - Agentic Retrieval Enhanced Server

A production-grade agentic chatbot server built in Rust with multi-provider LLM support, tool calling, RAG, MCP integration, and advanced research capabilities.

§Overview

A.R.E.S can be used in two ways:

  1. As a standalone server - Run the ares-server binary
  2. As a library - Import components into your own Rust project

§Quick Start (Library Usage)

Add to your Cargo.toml:

[dependencies]
ares-server = "0.5"

§Basic Example

use ares::{Provider, LLMClient};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Create an Ollama provider
    let provider = Provider::Ollama {
        base_url: "http://localhost:11434".to_string(),
        model: "llama3.2:3b".to_string(),
    };

    // Create a client and generate a response
    let client = provider.create_client().await?;
    let response = client.generate("Hello, world!").await?;
    println!("{}", response);

    Ok(())
}

§Using Tools

use ares::{ToolRegistry, tools::calculator::Calculator};
use std::sync::Arc;

let mut registry = ToolRegistry::new();
registry.register(Arc::new(Calculator));

// Tools can be used with LLM function calling
let tool_definitions = registry.definitions();

§Multi-Turn Tool Calling with ToolCoordinator

use ares::llm::{Provider, ToolCoordinator, ToolCallingConfig};
use ares::tools::ToolRegistry;
use std::sync::Arc;

let provider = Provider::from_env()?;
let client = provider.create_client().await?;
let registry = Arc::new(ToolRegistry::new());

// Create a unified coordinator that works with any LLM provider
let coordinator = ToolCoordinator::new(client, registry, ToolCallingConfig::default());

// Execute a tool-calling conversation
let result = coordinator.execute(Some("You are a helpful assistant."), "What is 25 * 4?").await?;
println!("Response: {}", result.content);
println!("Tool calls made: {}", result.tool_calls.len());

§Configuration-Driven Setup

use ares::{AresConfigManager, AgentRegistry, ProviderRegistry, ToolRegistry};
use std::sync::Arc;

// Load configuration from ares.toml
let config_manager = AresConfigManager::new("ares.toml")?;
let config = config_manager.config();

// Create registries from configuration
let provider_registry = Arc::new(ProviderRegistry::from_config(&config));
let tool_registry = Arc::new(ToolRegistry::with_config(&config));
let agent_registry = AgentRegistry::from_config(
    &config,
    provider_registry,
    tool_registry,
);

§Feature Flags

FeatureDescription
ollamaOllama local inference (default)
openaiOpenAI API support
llamacppDirect GGUF model loading
postgresPostgreSQL database (default)
qdrantQdrant vector database
mcpModel Context Protocol support

§Modules

  • agents - Agent framework for multi-agent orchestration
  • api - REST API handlers and routes
  • auth - JWT authentication and middleware
  • db - Database abstraction (PostgreSQL)
  • llm - LLM client implementations
  • tools - Tool definitions and registry
  • workflows - Declarative workflow engine
  • types - Common types and error handling

§Architecture

A.R.E.S uses a hybrid configuration system:

  • TOML (ares.toml): Infrastructure config (server, auth, providers)
  • TOON (config/*.toon): Behavioral config (agents, models, tools)

Both support hot-reloading for zero-downtime configuration changes.

Re-exports§

pub use agents::AgentRegistry;
pub use agents::AgentRegistryBuilder;
pub use db::tenants::TenantDb;postgres
pub use db::PostgresClient;postgres
pub use llm::client::LLMClientFactoryTrait;
pub use llm::ConfigBasedLLMFactory;
pub use llm::LLMClient;
pub use llm::LLMClientFactory;
pub use llm::LLMResponse;
pub use llm::Provider;
pub use llm::ProviderRegistry;
pub use models::ApiKey;
pub use models::Tenant;
pub use models::TenantContext;
pub use models::TenantQuota;
pub use models::TenantTier;
pub use tools::registry::ToolRegistry;
pub use types::AppError;
pub use types::ErrorCode;
pub use types::Result;
pub use utils::toml_config::AresConfig;
pub use utils::toml_config::AresConfigManager;
pub use utils::toon_config::DynamicConfigManager;
pub use workflows::WorkflowEngine;postgres
pub use workflows::WorkflowOutput;postgres
pub use workflows::WorkflowStep;postgres

Modules§

agents
AI agent orchestration and management. AI agent orchestration and management.
apipostgres
HTTP API handlers and routes. HTTP API Handlers and Routes
authpostgres
JWT authentication and middleware. JWT Authentication and Middleware
cli
Command-line interface and scaffolding. CLI module for A.R.E.S
db
Database clients (Turso/SQLite, Qdrant). Database Clients and Vector Stores
llm
LLM provider clients and abstractions. LLM Provider Clients and Abstractions
mcpmcp
Model Context Protocol (MCP) server integration.
memory
Conversation memory and context management. Memory management module for conversation context and user memory.
middlewarepostgres
Middleware for API key auth and usage tracking.
models
Multi-tenant models (Tenant, ApiKey, Quota).
rag
Retrieval Augmented Generation (RAG) components. Retrieval Augmented Generation (RAG) Pipeline
researchpostgres
Multi-agent research coordination. Multi-Agent Research Coordination
tools
Built-in tools (calculator, web search). Built-in Tools for Agent Capabilities
types
Core types (requests, responses, errors). Core types used throughout the A.R.E.S server.
utils
Configuration utilities (TOML, TOON). Configuration utilities (TOML, TOON).
workflowspostgres
Workflow engine for agent orchestration. Workflow Engine Module

Structs§

AppStatepostgres
Application state shared across handlers

Functions§

base_routerpostgres
Returns the base ARES router with all generic endpoints.