Skip to content

Rust SDK

rho-sdk is Rho's embeddable, headless Rust agent runtime. It provides provider-neutral messages, sessions, completion and streaming runs, custom provider and tool extension points, cancellation, host input, compaction, workspace policy, approvals, diagnostics, and versioned snapshots.

rho-sdk 1.0.0 is published on crates.io. The pages in this section document the stable 1.0 public API and compatibility policy. See known limitations for behavior that did not fully meet the drafted release-candidate gates before publication.

Start here

  1. Read installation and support for dependency, runtime, platform, feature, and Rust-version status.
  2. Read concepts to understand runtime, session, run, and host ownership.
  3. Choose or implement a provider.
  4. Register only the tools and capabilities the host intends to grant.
  5. Consume events and cancellation and persist session snapshots as needed.
  6. Review the security model and threat model before enabling sensitive operations.

Current capability map

CapabilityCurrent SDK contract
Final answerSession::complete returns a typed RunOutcome
StreamingSession::start returns a bounded, ordered RunEvent stream
ProvidersPublic ModelProvider trait and deterministic ScriptedProvider
ToolsPublic Tool trait, registry, progress metadata, host input, and scoped authorization
SessionsOne mutable run at a time, explicit history inspection, reset, provider replacement, and reasoning changes
CancellationShared cooperative token, run cancellation handle, runtime shutdown, and safe run-drop fallback
CompactionHost-supplied Compactor, optional automatic policy, explicit manual compaction
PersistenceVersioned JSON SessionSnapshot and an atomic in-memory adapter, with no SQLite requirement
SecurityNo sensitive capability by default; workspace, policy, approval handler, provider, and tools are host supplied
DiagnosticsSecret-free-by-contract configuration snapshot, subject to adapter redaction obligations

Examples

The repository contains compiling examples for:

Run one from a repository checkout:

bash
cargo run -p rho-sdk --example simple_completion

Documentation map