Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(embed): the storage example reads the driver from the runtime's capabilities

M3gA-Mind1e9f362a6e68
diff --git a/crates/openhuman-embed/examples/storage.rs b/crates/openhuman-embed/examples/storage.rs
index 0d6523bf8d..53504ca625 100644
--- a/crates/openhuman-embed/examples/storage.rs
+++ b/crates/openhuman-embed/examples/storage.rs
@@ -27,7 +27,6 @@ async fn run() -> anyhow::Result<()> {
.build()
.await?;
let storage = runtime.storage().expect("configured SQLite backend");
- assert_eq!(storage.driver(), "sqlite");
let scoped = storage.for_scope(&Scope::local())?;
let documents = scoped.documents();
documents
@@ -73,7 +72,8 @@ async fn run() -> anyhow::Result<()> {
// An explicit environment variable is the only path to a live database.
if let Ok(url) = std::env::var("OPENHUMAN_EXAMPLE_MONGODB_URL") {
let live = RuntimeBuilder::library().storage(url).build().await?;
- assert_eq!(live.storage().expect("MongoDB backend").driver(), "mongodb");
+ assert!(live.storage().is_some(), "MongoDB backend");
+ assert_eq!(live.capabilities().storage.driver.as_deref(), Some("mongodb"));
}
// ANCHOR_END: storage_mongodb
println!("SQLite put/get/delete and credential-safe MongoDB configuration verified");
diff --git a/docs/gitbooks/en/developing/embed/integrations/storage-drivers.md b/docs/gitbooks/en/developing/embed/integrations/storage-drivers.md
index f3449560a0..ace952eb34 100644
--- a/docs/gitbooks/en/developing/embed/integrations/storage-drivers.md
+++ b/docs/gitbooks/en/developing/embed/integrations/storage-drivers.md
@@ -24,7 +24,6 @@ The SQLite example sets `config.storage.url` to a `sqlite:` URL under a temporar
.build()
.await?;
let storage = runtime.storage().expect("configured SQLite backend");
- assert_eq!(storage.driver(), "sqlite");
let scoped = storage.for_scope(&Scope::local())?;
let documents = scoped.documents();
documents
@@ -73,7 +72,8 @@ Run `cargo run -p openhuman-embed --example storage --features storage-sqlite`.
// An explicit environment variable is the only path to a live database.
if let Ok(url) = std::env::var("OPENHUMAN_EXAMPLE_MONGODB_URL") {
let live = RuntimeBuilder::library().storage(url).build().await?;
- assert_eq!(live.storage().expect("MongoDB backend").driver(), "mongodb");
+ assert!(live.storage().is_some(), "MongoDB backend");
+ assert_eq!(live.capabilities().storage.driver.as_deref(), Some("mongodb"));
}
```