synthiaresearch 0.1.2

Rust SDK for the Synthia API
Documentation
//! Rust SDK for the [Synthia](https://github.com/SynthiaResearch/synthia-sdk) API.
//!
//! Synthia interviews your agent to model its users, generates a calibrated
//! dataset of adversarial scenarios, plays each one in a deterministic
//! simulator, and judges every rollout. Your agent runs on your infrastructure;
//! only replies and traced tool calls cross the wire.
//!
//! This SDK mirrors the JavaScript and Python SDKs — same methods, same request
//! bodies, same server contract, `snake_case` names. `docs/reference/js-api.md`
//! is the long-form reference; the Rust-specific divergences (async, `Result`,
//! options structs) are listed in `docs/reference/rust-api.md`.
//!
//! Every SDK publishes as `synthiaresearch` — npm, PyPI, and crates.io.

// Server payload shapes, generated from packages/api-contract/openapi.json by
// scripts/generate-sdk-types.sh. Never hand-edit; fix the FastAPI response
// model and regenerate.
pub mod types;

pub mod client;
pub mod error;
pub mod redact;
pub mod sandbox;

pub use crate::client::{
    AgentReply, Content, Dataset, Datasets, EvalOptions, EvalOutcome, GenerateOptions,
    GenerationJob, ModelRef, PrepareOptions, PrepareResult, ProbeAgent, ProbeOptions, QualityCheck,
    Reply, RolloutAgent, RolloutRef, RolloutResult, Rollouts, RunOptions, ScenarioOptions, Seeds,
    Synthia, SynthiaOptions, ToolCall, TraceIngestOptions, TraceRecorder, Traces, UserModels,
    ValidationRun, WaitOptions,
};
pub use crate::error::{Error, Result};
pub use crate::sandbox::{py_json, Report, ToolEvent, ToolSandbox};

/// The SDK version reported to the server on the session handshake.
///
/// Derived from Cargo rather than duplicated in a constant: the JS SDK keeps a
/// hand-written `SDK_VERSION` in step with its package.json and it drifted
/// once. Python derives its version the same way, from installed package
/// metadata.
pub const SDK_VERSION: &str = env!("CARGO_PKG_VERSION");

/// Default base URL for the hosted API. Override with `SYNTHIA_BASE_URL`.
pub const DEFAULT_BASE_URL: &str = "https://synthia-research--synthia-api-web.modal.run";

// Hand-written types own the bare names (the local sandbox surface); the
// server payload shapes take an `Api` prefix where they would collide. Mirrors
// client.ts:20 (`export type ApiToolCall = Api<"ToolCall">`) and client.py:32
// (`ToolCall as ApiToolCall`). The prefix is applied HERE, at the consumption
// boundary — never in the generator, so adding a colliding hand-written type
// never means touching codegen.
pub use crate::types::{
    Rollout as ApiRollout, ToolCall as ApiToolCall, TranscriptTurn as ApiTranscriptTurn,
};