Skip to content

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

feat(storage): add lease_for_agent to session store providers

Steven Enamakel9bf85b7442d2
diff --git a/crates/openhuman-core/src/storage/sessions/host_stores.rs b/crates/openhuman-core/src/storage/sessions/host_stores.rs
index 2cf1b9f741..75b54433ac 100644
--- a/crates/openhuman-core/src/storage/sessions/host_stores.rs
+++ b/crates/openhuman-core/src/storage/sessions/host_stores.rs
@@ -20,7 +20,8 @@ use std::sync::{Arc, LazyLock, Mutex, PoisonError};
use super::tenant_router::TenantSessionStores;
use tinyagents_harness::multimodal::BlobAttachmentStash;
use tinyagents_session::port::{
- AgentStorageFactory, AgentStores, DriverSessionStores, SessionStoreProvider, TurnStates,
+ AgentStorageFactory, AgentStores, DriverSessionStores, SessionStoreLease,
+ SessionStoreLeaseError, SessionStoreProvider, TurnStates,
};
use tinyagents_session::run_ledger::{LedgerError, LedgerResult, RunLedgerStore};
use tinyagents_storage_kit::ScopedStorage;
@@ -485,6 +486,13 @@ impl SessionStoreProvider for WorkspaceSessionStores {
Self::current().run_ledger_for_agent(agent_id)
}
+ fn lease_for_agent(
+ &self,
+ agent_id: &str,
+ ) -> Result<SessionStoreLease, SessionStoreLeaseError> {
+ Self::current().lease_for_agent(agent_id)
+ }
+
fn conversations_for_agent(
&self,
agent_id: &str,
diff --git a/crates/openhuman-core/src/storage/sessions/rebound.rs b/crates/openhuman-core/src/storage/sessions/rebound.rs
index ec2bd1da9b..162b83452c 100644
--- a/crates/openhuman-core/src/storage/sessions/rebound.rs
+++ b/crates/openhuman-core/src/storage/sessions/rebound.rs
@@ -14,7 +14,10 @@
use std::sync::{Arc, LazyLock, Mutex, PoisonError, RwLock, Weak};
use super::tenant_router::TenantSessionStores;
-use tinyagents_session::port::{AgentStorageFactory, AgentStores, SessionStoreProvider};
+use tinyagents_session::port::{
+ AgentStorageFactory, AgentStores, SessionStoreLease, SessionStoreLeaseError,
+ SessionStoreProvider,
+};
use tinyagents_storage_kit::Blocking;
use tinystoragedrivers::{StorageBackend, StorageError};
@@ -147,6 +150,13 @@ impl SessionStoreProvider for ReboundSessionStores {
SessionStoreProvider::try_for_agent(self.current().as_ref(), agent_id)
}
+ fn lease_for_agent(
+ &self,
+ agent_id: &str,
+ ) -> Result<SessionStoreLease, SessionStoreLeaseError> {
+ self.current().lease_for_agent(agent_id)
+ }
+
fn bind_actor(
&self,
factory: AgentStorageFactory,
diff --git a/crates/openhuman-core/src/storage/sessions/tenant_router.rs b/crates/openhuman-core/src/storage/sessions/tenant_router.rs
index 224ad77ea2..cabccfd281 100644
--- a/crates/openhuman-core/src/storage/sessions/tenant_router.rs
+++ b/crates/openhuman-core/src/storage/sessions/tenant_router.rs
@@ -14,7 +14,8 @@ use std::sync::{Arc, Mutex, PoisonError};
use tinyagents_harness::store::SchemaAdmission;
use tinyagents_session::port::{
- AgentStorageFactory, AgentStores, ConditionedAgentStorageFactory, SessionStoreProvider,
+ AgentStorageFactory, AgentStores, ConditionedAgentStorageFactory, SessionStoreLease,
+ SessionStoreLeaseError, SessionStoreProvider,
};
use tinyagents_session::DriverSessionStores;
use tinyagents_storage_kit::{Blocking, Scope as PortScope, ScopedStorage};
@@ -167,6 +168,14 @@ impl SessionStoreProvider for TenantSessionStores {
provider.try_for_agent(&agent)
}
+ fn lease_for_agent(
+ &self,
+ agent_id: &str,
+ ) -> Result<SessionStoreLease, SessionStoreLeaseError> {
+ let (provider, agent) = self.route(agent_id);
+ provider.lease_for_agent(&agent)
+ }
+
fn bind_actor(
&self,
factory: AgentStorageFactory,