cots 0.2.0

Cots.ai SDK for Rust. cots::agents::AgentClient — configure once with tenant_id/agent_id, then guard() every governed action through the PEP/PDP before executing it.
Documentation
//! Cots.ai SDK for Rust.
//!
//! `cots::agents` is the agent interceptor client: configure once with your
//! `tenant_id`/`agent_id`, then call [`agents::AgentClient::guard`] around
//! every real-world action your agent takes — it calls the interceptor
//! (PEP/PDP) first and only runs your callback if the decision is `allowed`
//! (immediately) or `require_approval` (after a human decides). `blocked`
//! never runs your callback at all.
//!
//! Future modules (e.g. `cots::policy`, `cots::audit`) would live alongside
//! `agents` here, each gated behind its own Cargo feature if the crate grows
//! enough that pulling in every module's dependencies stops being cheap.
//!
//! ```no_run
//! use cots::agents::{AgentClient, AgentConfig, NormalizedAction};
//!
//! # async fn example() -> Result<(), cots::SdkError> {
//! let agent = AgentClient::new(AgentConfig::new("ten_xxx", "agt_xxx"));
//!
//! let result = agent
//!     .guard(NormalizedAction::new("Slack", "send_slack_message"), || async {
//!         // send the real Slack message here
//!         "sent"
//!     })
//!     .await?;
//! # Ok(())
//! # }
//! ```

pub mod agents;

#[derive(Debug, thiserror::Error)]
pub enum SdkError {
    #[error("configuration error: {0}")]
    Config(String),
    #[error("http error: {0}")]
    Http(#[from] reqwest::Error),
    #[error("control plane returned an error ({status}): {body}")]
    Api { status: u16, body: String },
}