ares-server 0.7.5

A.R.E.S - Agentic Retrieval Enhanced Server: A production-grade agentic chatbot server with multi-provider LLM support, tool calling, RAG, and MCP integration
Documentation
//! AI agent orchestration and management.
//!
//! This module provides the agent system for A.R.E.S, including:
//!
//! - **Agent Trait** - Base trait that all agents implement
//! - **ConfigurableAgent** - Dynamic agent created from TOML/TOON configuration
//! - **AgentRegistry** - Registry for creating and managing agent instances
//! - **Router** - Routes requests to appropriate specialized agents
//! - **Orchestrator** - Coordinates multi-step agent workflows
//!
//! ## Architecture
//!
//! All agents are now created dynamically via `ConfigurableAgent`, which reads
//! configuration from TOML files. Legacy hardcoded agents have been removed.
//!
//! ## Example
//!
//! ```rust,ignore
//! use ares::agents::{Agent, AgentRegistry};
//!
//! // Create registry from configuration
//! let registry = AgentRegistry::from_config(&config, provider_registry, tool_registry);
//!
//! // Get an agent instance
//! let agent = registry.get_agent("product")?;
//!
//! // Execute with context
//! let response = agent.execute("Help me with my order", &context).await?;
//! ```

pub mod configurable;
/// External context injection trait (OSS: NoOp, Managed: Eruka/custom).
pub mod context_provider;
/// Loop detection for agent outputs — prevents repetitive/stuck agents.
pub mod loop_detector;
/// Checkpoint/crash recovery — serialize agent state, restore on restart.
pub mod checkpoint;
/// Multi-agent orchestration for complex tasks.
#[cfg(feature = "postgres")]
pub mod orchestrator;
pub mod registry;
/// Request routing to specialized agents.
pub mod router;
/// Per-tenant agent creation from DB-stored configs.
#[cfg(feature = "postgres")]
pub mod tenant_agent;

use crate::llm::client::TokenUsage;
use crate::types::{AgentContext, AgentType, Result};
use async_trait::async_trait;

// Re-export commonly used types
pub use configurable::ConfigurableAgent;
pub use context_provider::{ContextProvider, NoOpContextProvider};
pub use registry::{AgentRegistry, AgentRegistryBuilder};

/// Response from agent execution, including content and optional token usage
pub struct AgentResponse {
    /// The generated text response
    pub content: String,
    /// Token usage from the LLM provider (None if unavailable)
    pub usage: Option<TokenUsage>,
    /// Metadata about the execution (model, provider, etc.)
    pub metadata: Option<ExecutionMetadata>,
}

/// Metadata about the execution of an agent
pub struct ExecutionMetadata {
    /// The name of the model used
    pub model_name: String,
    /// The name of the provider used
    pub provider_name: String,
}

/// Base trait for all agents
#[async_trait]
pub trait Agent: Send + Sync {
    /// Execute the agent with given input and context
    async fn execute(&self, input: &str, context: &AgentContext) -> Result<AgentResponse>;

    /// Get the agent's system prompt
    fn system_prompt(&self) -> String;

    /// Get the agent type
    fn agent_type(&self) -> AgentType;
}