terraphim_router 1.16.34

Unified routing engine for LLM and Agent providers
Documentation
//! Unified routing engine for LLM and Agent providers.
//!
//! This crate provides capability-based routing that works with both
//! LLM models and spawned agents, using the same routing logic.
//!
//! # Example
//!
//! ```
//! use terraphim_router::{Router, RoutingContext};
//!
//! fn route_task() {
//!     let router = Router::new();
//!     
//!     let decision = router.route(
//!         "Implement a secure authentication system",
//!         &RoutingContext::default(),
//!     ).unwrap();
//!     
//!     println!("Routed to: {}", decision.provider.id);
//! }
//! ```

#[cfg(feature = "file-watch")]
pub mod discovery;
pub mod engine;
pub mod fallback;
pub mod keyword;
pub mod knowledge_graph;
pub mod metrics;
pub mod registry;
pub mod strategy;
pub mod types;

#[cfg(feature = "file-watch")]
pub use discovery::ProviderDirectoryWatcher;
pub use engine::{Router, RoutingEngine};
pub use fallback::{FallbackRouter, FallbackStrategy};
pub use keyword::KeywordRouter;
pub use knowledge_graph::KnowledgeGraphRouter;
pub use metrics::{RouterMetrics, Timer};
#[cfg(feature = "persistence")]
pub use registry::PersistedProviderRegistry;
pub use registry::{ProviderRegistry, RegistryEvent};
pub use strategy::{
    CapabilityFirst, CostOptimized, LatencyOptimized, PreferenceFilter, RoundRobin,
    RoutingStrategy, StrategyRegistry, WeightedStrategy,
};
pub use types::{RoutingContext, RoutingDecision, RoutingError, RoutingResult};

/// Re-export capability types for convenience
pub use terraphim_types::capability::{Capability, CostLevel, Latency, Provider, ProviderType};