Skip to main content

objectiveai_sdk/
lib.rs

1//! ObjectiveAI SDK for Rust.
2//!
3//! This crate provides data structures, validation, and client-side compilation
4//! for the ObjectiveAI API - a platform for scoring, ranking, and simulating
5//! preferences using swarms of agents.
6//!
7//! # Core Concepts
8//!
9//! - **Agent**: A configured instance of a single upstream language model
10//! - **Swarm**: A collection of Agents used together for voting
11//! - **Vector Completion**: Runs multiple agents to vote on responses, producing weighted scores
12//! - **Function**: A composable scoring pipeline built from Vector Completions
13//! - **Profile**: Learned weights for a Function, trained on example data
14//!
15//! # Features
16//!
17//! - `http` (default): Enables the HTTP client for making API requests
18//!
19//! # Modules
20//!
21//! - [`auth`] - API authentication types
22//! - [`agent`] - Agent definitions, configuration, and completion APIs
23//! - [`swarm`] - Swarm definitions and validation
24//! - [`error`] - Error types
25//! - [`functions`] - Function definitions, execution, and client-side compilation
26//! - [`prefixed_uuid`] - UUID utilities
27//! - [`vector`] - Vector completion APIs
28//!
29//! When the `http` feature is enabled:
30//! - [`HttpClient`] - HTTP client for API requests
31//! - [`HttpError`] - HTTP error types
32
33pub mod agent;
34pub mod arbitrary_util;
35pub mod auth;
36pub mod data_url;
37pub mod error;
38pub mod functions;
39mod json_schema;
40pub mod laboratories;
41pub mod swarm;
42pub use json_schema::*;
43pub mod prefixed_uuid;
44mod remote;
45pub(crate) mod serde_util;
46mod util;
47pub mod vector;
48mod weights;
49
50pub use remote::*;
51pub use weights::*;
52
53#[cfg(test)]
54mod serde_util_tests;
55#[cfg(test)]
56mod tests;
57
58#[cfg(test)]
59mod test_util;
60
61#[cfg(feature = "http")]
62pub mod http;
63
64#[cfg(feature = "http")]
65pub use http::*;
66
67#[cfg(feature = "mcp")]
68pub mod mcp;
69
70// `client_objectiveai_mcp` is the reverse-attach protocol's wire
71// envelope. The typed `server_request::Payload` and
72// `server_response::Payload` variants reference `mcp::tool::*` /
73// `mcp::resource::*` shapes, so the module is gated behind the same
74// feature. Pure-`http` consumers (no MCP) wouldn't have anything to
75// do with it anyway — the McpHandler trait + WS streaming path also
76// require this module.
77#[cfg(feature = "mcp")]
78pub mod client_objectiveai_mcp;
79
80#[cfg(feature = "cli")]
81pub mod cli;
82
83#[cfg(feature = "viewer")]
84pub mod viewer;