Skip to main content

ares_server/
lib.rs

1//! ARES agent library facade.
2//!
3//! Downstream crates inject [`Execute`], [`Tools`], and [`Llm`] on a Cordis
4//! [`Context`] and run an agent with no HTTP stack on the graph.
5//!
6//! ```rust
7//! use ares_server::{Context, Execute, Tools, Llm};
8//! ```
9//!
10//! The `ares-server` binary (same package) binds the Axum router only when
11//! the `http` feature is on, and ships only with `http` and `cli`. Default
12//! features are the server defaults: postgres, openai, ares-vector, mcp,
13//! inventory, rhai-policy, http, cli, script-tools. For an embed-only build
14//! use `default-features = false` and pick the providers you need (e.g.
15//! `features = ["openai"]`); no axum, clap, sqlx, ollama, boa, or rhai then
16//! enters the graph.
17//!
18//! Public surface: [`Context`], [`Execute`], [`Tools`], [`Llm`], [`Store`]
19//! (postgres), [`Plugin`], [`Loader`], [`Dispatch`], [`register_plugins`].
20//! Construct in-memory [`Llm`] with [`Llm::from_client`] for the library proof.
21
22pub use ares_agent::{AgentConfig, AgentRegistry, AgentRequest, Execute, ExecutionResult};
23pub use ares_llm::coordinator::ConversationMessage;
24pub use ares_llm::{LLMClient, LLMResponse, Llm};
25pub use ares_tools::{Calculator, Tool, Tools};
26pub use ares_types::types::ToolDefinition;
27pub use ares_types::{AppError, TenantContext, TenantTier};
28pub use ares_types::types::{Message, ToolCall};
29
30pub use ares_agent::{AgentResponse, AgentSource, ContextProvider, ExecutionMetadata, RunTracker};
31pub use ares_llm::{ProviderConfig, ProviderRegistry};
32pub use ares_llm::client::TokenUsage;
33pub use ares_tools::{CalculatorConfig, CalculatorService};
34
35pub use cordis::loader::Entry;
36pub use cordis::{CordisError, Disposable, EventsService, FiberId, ServiceInitFuture, TypedEvent};
37
38/// Daemon-side supervised-worker protocol: restart loop and child spawn.
39pub mod supervisor;
40pub use cordis::{Context, Dispatch, Loader, Plugin, PluginRegistry, Service};
41
42/// Tenant database. Gated so `--no-default-features` builds do not enable
43/// postgres.
44#[cfg(feature = "postgres")]
45pub use ares_store::Store;
46
47/// Register capability-crate loader factories on `reg`.
48///
49pub fn register_plugins(reg: &PluginRegistry) {
50    cordis::register_plugins(reg);
51    ares_store::register_plugins(reg);
52    ares_tools::register_plugins(reg);
53    ares_llm::register_plugins(reg);
54    ares_agent::register_plugins(reg);
55    #[cfg(feature = "http")]
56    ares_http::register_plugins(reg);
57}