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 logs;
44pub mod prefixed_uuid;
45mod remote;
46pub(crate) mod serde_util;
47mod util;
48pub mod vector;
49mod weights;
50
51pub use remote::*;
52pub use weights::*;
53
54#[cfg(test)]
55mod serde_util_tests;
56#[cfg(test)]
57mod tests;
58
59#[cfg(test)]
60mod test_util;
61
62#[cfg(feature = "http")]
63pub mod http;
64
65#[cfg(feature = "http")]
66pub use http::*;
67
68#[cfg(feature = "mcp")]
69pub mod mcp;
70
71// `client_objectiveai_mcp` is the reverse-attach protocol's wire
72// envelope. The typed `server_request::Payload` and
73// `server_response::Payload` variants reference `mcp::tool::*` /
74// `mcp::resource::*` shapes, so the module is gated behind the same
75// feature. Pure-`http` consumers (no MCP) wouldn't have anything to
76// do with it anyway — the McpHandler trait + WS streaming path also
77// require this module.
78#[cfg(feature = "mcp")]
79pub mod client_objectiveai_mcp;
80
81#[cfg(feature = "cli")]
82pub mod cli;
83
84#[cfg(feature = "viewer")]
85pub mod viewer;