The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
feat(flows): store flow and delegation checkpoints on the storage backend
Steven Enamakel899b51aef9e0
diff --git a/Cargo.lock b/Cargo.lockindex 722dffebf4..1dbc5872b0 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -4626,6 +4626,7 @@ dependencies = ["tinyflows","tinyflows-catalog","tinyflows-copilot",+ "tinyflows-drivers","tinyflows-schedule","tinyflows-sqlite","tinyhosts",@@ -7156,9 +7157,11 @@ dependencies = ["rusqlite","serde","serde_json",+ "sha2 0.11.0","tinyagents-harness","tinyagents-tasks","tinyinference-llm",+ "tinystoragedrivers-core","tinytools","tokio","tracing",@@ -7557,6 +7560,20 @@ dependencies = ["serde_json",]+[[package]]+name = "tinyflows-drivers"+version = "0.1.0"+dependencies = [+ "async-trait",+ "serde",+ "serde_json",+ "sha2 0.11.0",+ "tinyflows",+ "tinystoragedrivers-core",+ "tokio",+ "tracing",+]+[[package]]name = "tinyflows-schedule"version = "0.1.0"diff --git a/crates/openhuman-core/Cargo.toml b/crates/openhuman-core/Cargo.tomlindex fd7f62e7b8..c33419d787 100644--- a/crates/openhuman-core/Cargo.toml+++ b/crates/openhuman-core/Cargo.toml@@ -81,6 +81,9 @@ tinyflows-catalog = { path = "../../vendor/tinyflows/crates/tinyflows-catalog",# The cron job/run store half (`schedule`) is unconditional, so `tinyflows-sqlite`# is too; only its `catalog` half (which needs the engine) rides the `flows` gate.tinyflows-sqlite = { path = "../../vendor/tinyflows/crates/tinyflows-sqlite", default-features = false, features = ["schedule"] }+# The flow engine's checkpointer and state on the storage ports, used instead of+# `flows/checkpoints.db` when a storage backend is configured (`storage`).+tinyflows-drivers = { path = "../../vendor/tinyflows/crates/tinyflows-drivers", optional = true }# The authoring copilot's words: the `workflow_builder` / `flow_discovery`# standing archetypes and the turn brief that opens a builder turn. Harness-free# by construction — it names no tool trait and no model client — so this host@@ -147,6 +150,7 @@ tinyagents-definition = { path = "../../vendor/tinyagents/crates/tinyagents-defitinyagents-live = { path = "../../vendor/tinyagents/crates/tinyagents-live", optional = true }tinyagents-graph = { path = "../../vendor/tinyagents/crates/tinyagents-graph", features = ["sqlite",+ "storage-drivers",] }tinyagents-registry = { path = "../../vendor/tinyagents/crates/tinyagents-registry" }tinyagents-session = { path = "../../vendor/tinyagents/crates/tinyagents-session", features = ["storage-drivers"] }@@ -912,7 +916,7 @@ media = ["tinyagents-harness/media"]# runtime `DomainSet::flows` flag (#4796): the feature narrows the compile-time# surface, `DomainSet` gates it at runtime.# NOTE: this gate does NOT drop `tinyagents` itself — 26+ domains consume it.-flows = ["dep:tinyflows", "dep:tinyflows-catalog", "dep:tinyflows-copilot", "tinyflows-sqlite/catalog"]+flows = ["dep:tinyflows", "dep:tinyflows-catalog", "dep:tinyflows-copilot", "dep:tinyflows-drivers", "tinyflows-sqlite/catalog"]# Skills domains: `openhuman::skills` (metadata/discovery/install),# `openhuman::skill_runtime` (SKILL.md execution + the skill_executor agent),# and `openhuman::skill_registry` (remote catalogs + the skill_setup agent).diff --git a/crates/openhuman-core/src/agent/orchestration/delegation.rs b/crates/openhuman-core/src/agent/orchestration/delegation.rsindex 93ed724f52..9afa6f4ba7 100644--- a/crates/openhuman-core/src/agent/orchestration/delegation.rs+++ b/crates/openhuman-core/src/agent/orchestration/delegation.rs@@ -81,11 +81,27 @@ pub(crate) async fn run_subagent_delegation_with_parent_context(// durable graphs simply expire (orphaned tasks are reconciled at boot per// 07.2). Checkpoint metadata (thread/checkpoint/parent/run ids) stays// inspectable through the crate `Checkpointer` API.- let checkpoint_db = config.workspace_dir.join("graph_checkpoints.db");- let checkpointer: Arc<dyn Checkpointer<DelegationState>> = Arc::new(- SqliteCheckpointer::<DelegationState>::open(&checkpoint_db)- .map_err(|e| format!("open durable graph checkpoint store: {e}"))?,- );+ //+ // With a storage backend configured (`crate::storage`) the checkpoints+ // live there instead, in the acting agent's scope.+ let checkpointer: Arc<dyn Checkpointer<DelegationState>> =+ match crate::storage::current_scoped()+ .map_err(|e| format!("resolve the storage scope for graph checkpoints: {e}"))?+ {+ Some(scoped) => Arc::new(+ tinyagents_graph::checkpoint::DriverCheckpointer::<DelegationState>::with_prefix(+ Arc::clone(scoped.documents()),+ "delegation_graph",+ ),+ ),+ None => {+ let checkpoint_db = config.workspace_dir.join("graph_checkpoints.db");+ Arc::new(+ SqliteCheckpointer::<DelegationState>::open(&checkpoint_db)+ .map_err(|e| format!("open durable graph checkpoint store: {e}"))?,+ )+ }+ };tracing::info!(target: LOG_TARGET,diff --git a/crates/openhuman-core/src/flows/tinyflows/caps/ops.rs b/crates/openhuman-core/src/flows/tinyflows/caps/ops.rsindex 0244e907c0..1a043215b0 100644--- a/crates/openhuman-core/src/flows/tinyflows/caps/ops.rs+++ b/crates/openhuman-core/src/flows/tinyflows/caps/ops.rs@@ -659,7 +659,9 @@ pub fn build_capabilities(config: Arc<Config>, state_namespace: impl Into<String/// Opens the durable, cross-process checkpointer a `flows_run` uses via/// `tinyflows::engine::run_with_checkpointer` — this host's-/// [`SqliteCheckpointer`], stored under `<workspace_dir>/flows/checkpoints.db`.+/// [`SqliteCheckpointer`], stored under `<workspace_dir>/flows/checkpoints.db`,+/// or, when the host configured a storage backend ([`crate::storage`]),+/// `tinyflows_drivers::DriverCheckpointer` over it in the acting agent's scope.////// It became host-owned when tinyflows vendored its state-graph runtime and/// dropped the SQLite backend with it (tinyflows PR #43). The port keeps the@@ -669,6 +671,14 @@ pub fn build_capabilities(config: Arc<Config>, state_namespace: impl Into<Stringpub fn open_flow_checkpointer(config: &Config,) -> anyhow::Result<Arc<dyn tinyflows::engine::Checkpointer<serde_json::Value>>> {+ if let Some(scoped) = crate::storage::current_scoped()? {+ tracing::debug!(target: "flows", "[flows] opening checkpointer on the storage backend");+ return Ok(Arc::new(+ tinyflows_drivers::DriverCheckpointer::<serde_json::Value>::new(Arc::clone(+ scoped.documents(),+ )),+ ));+ }let db_path = config.workspace_dir.join("flows").join("checkpoints.db");if let Some(parent) = db_path.parent() {std::fs::create_dir_all(parent)