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
refactor(subagent_host): clean up async function signatures
Steven Enamakelfd1225b43df8
diff --git a/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs b/crates/openhuman-core/src/agent/subagent_host/lifecycle.rsindex 11c34465a8..6537189237 100644--- a/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs+++ b/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs@@ -85,13 +85,13 @@ pub(crate) async fn spawn_async_via_driver_tool(input: String,options: SubagentRunOptions,completion: impl Fn(- String,- Result<SubagentRunOutcome, String>,- bool,- ) -> Pin<Box<dyn Future<Output = ()> + Send>>- + Send- + Sync- + 'static,+ String,+ Result<SubagentRunOutcome, String>,+ bool,+ ) -> Pin<Box<dyn Future<Output = ()> + Send>>+ + Send+ + Sync+ + 'static,) -> Result<String, SubagentRunError> {spawn_async_via_driver_tool_using_jobs(parent, definition, input, options, None, None, completion,@@ -109,13 +109,13 @@ pub(crate) async fn resume_async_via_driver_tool(input: String,options: SubagentRunOptions,completion: impl Fn(- String,- Result<SubagentRunOutcome, String>,- bool,- ) -> Pin<Box<dyn Future<Output = ()> + Send>>- + Send- + Sync- + 'static,+ String,+ Result<SubagentRunOutcome, String>,+ bool,+ ) -> Pin<Box<dyn Future<Output = ()> + Send>>+ + Send+ + Sync+ + 'static,) -> Result<String, SubagentRunError> {spawn_async_via_driver_tool_using_jobs(parent,@@ -137,13 +137,13 @@ pub(crate) async fn spawn_async_via_driver_tool_with_jobs(options: SubagentRunOptions,jobs: tinyagents_harness_tools::subagents::SubAgentJobRegistry,completion: impl Fn(- String,- Result<SubagentRunOutcome, String>,- bool,- ) -> Pin<Box<dyn Future<Output = ()> + Send>>- + Send- + Sync- + 'static,+ String,+ Result<SubagentRunOutcome, String>,+ bool,+ ) -> Pin<Box<dyn Future<Output = ()> + Send>>+ + Send+ + Sync+ + 'static,) -> Result<String, SubagentRunError> {spawn_async_via_driver_tool_using_jobs(parent,@@ -165,13 +165,13 @@ async fn spawn_async_via_driver_tool_using_jobs(jobs: Option<tinyagents_harness_tools::subagents::SubAgentJobRegistry>,continuation: Option<(SubagentTaskKey, SubagentResume)>,completion: impl Fn(- String,- Result<SubagentRunOutcome, String>,- bool,- ) -> Pin<Box<dyn Future<Output = ()> + Send>>- + Send- + Sync- + 'static,+ String,+ Result<SubagentRunOutcome, String>,+ bool,+ ) -> Pin<Box<dyn Future<Output = ()> + Send>>+ + Send+ + Sync+ + 'static,) -> Result<String, SubagentRunError> {let task_id = continuation.as_ref()diff --git a/crates/openhuman-core/src/agent/subagent_host/lifecycle_tests.rs b/crates/openhuman-core/src/agent/subagent_host/lifecycle_tests.rsindex cca3458acb..fd717cfc8c 100644--- a/crates/openhuman-core/src/agent/subagent_host/lifecycle_tests.rs+++ b/crates/openhuman-core/src/agent/subagent_host/lifecycle_tests.rs@@ -9,8 +9,8 @@ use tinyagents_orchestration::subagent::{};use super::lifecycle::{- decode_driver_job_result, load_subagent_checkpoint, merged_resume_history,- OpenHumanDriverBundle, OpenHumanPersistence,+ OpenHumanDriverBundle, OpenHumanPersistence, decode_driver_job_result,+ load_subagent_checkpoint, merged_resume_history,};use super::{SubagentMode, SubagentRunError, SubagentRunOutcome, SubagentRunStatus, SubagentUsage};@@ -103,9 +103,11 @@ fn driver_error_does_not_hide_completed_mismatched_or_persistence_failures() {tinytools::ToolResult::error("provider transport failed"),] {let error = decode_driver_job_result(result, &bundle, &task_key).unwrap_err();- assert!(error- .to_string()- .contains("driver-backed async spawn failed"));+ assert!(+ error+ .to_string()+ .contains("driver-backed async spawn failed")+ );}bundle.failures.lock().unwrap().insert(@@ -131,9 +133,11 @@ fn driver_error_does_not_hide_completed_mismatched_or_persistence_failures() {&task_key,).unwrap_err();- assert!(error- .to_string()- .contains("driver-backed async spawn failed"));+ assert!(+ error+ .to_string()+ .contains("driver-backed async spawn failed")+ );bundle.host_outcome.lock().unwrap().insert(task_key.clone(),@@ -338,11 +342,12 @@ async fn tiny_session_port_recovers_legacy_key_from_owned_pause_and_hides_foreig.unwrap();assert_eq!(owned.len(), 1);assert_eq!(owned[0].lifecycle_key, Some(key));- assert!(port- .list_for_parent("foreign-session", Some("thread"))- .await- .unwrap()- .is_empty());+ assert!(+ port.list_for_parent("foreign-session", Some("thread"))+ .await+ .unwrap()+ .is_empty()+ );}#[tokio::test]diff --git a/crates/openhuman-core/src/agent/subagent_host/mod.rs b/crates/openhuman-core/src/agent/subagent_host/mod.rsindex f4512efb7a..af10fedd01 100644--- a/crates/openhuman-core/src/agent/subagent_host/mod.rs+++ b/crates/openhuman-core/src/agent/subagent_host/mod.rs@@ -56,6 +56,7 @@ mod persisted_compat_tests;// Public API — the entry point and the shapes it returns.pub use autonomous::{definition_iter_cap, subagent_iter_cap_with_autonomous_lift};+pub use lifecycle::OpenHumanSubagentHost;pub(crate) use lifecycle::checkpoint_resume;pub(crate) use lifecycle::detached_subagent_parent;pub(crate) use lifecycle::load_subagent_checkpoint;@@ -64,7 +65,6 @@ pub(crate) use lifecycle::resume_async_via_driver_tool;pub(crate) use lifecycle::spawn_async_via_driver_tool;#[cfg(test)]pub(crate) use lifecycle::spawn_async_via_driver_tool_with_jobs;-pub use lifecycle::OpenHumanSubagentHost;pub use types::{SubagentCheckpointData, SubagentMode, SubagentRunError, SubagentRunOptions, SubagentRunOutcome,SubagentRunStatus, SubagentUsage,diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rsindex b6a66d052a..dc15f8a783 100644--- a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs+++ b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs@@ -23,8 +23,8 @@ use crate::agent::subagent_host::types::{use crate::agent::tinyagents::budget::MAX_SPAWN_DEPTH;use crate::agent_registry::host_definition::{AgentDefinition, AgentDefinitionRegistry};use crate::inference::provider::AGENT_TURN_MAX_OUTPUT_TOKENS;-use tinyagents_definition::{validate_tier_transition, AgentTier, IterationPolicy, PromptSource};-use tinyagents_harness::context::{current_run_depth, with_run_depth, RunConfig, RunDepth};+use tinyagents_definition::{AgentTier, IterationPolicy, PromptSource, validate_tier_transition};+use tinyagents_harness::context::{RunConfig, RunDepth, current_run_depth, with_run_depth};use tinytools::ToolSpec;use tinytools_std::file_state::with_file_state_agent_id;diff --git a/crates/openhuman-core/src/agent/subagent_host/ops_tests_driver_bridge_tests.rs b/crates/openhuman-core/src/agent/subagent_host/ops_tests_driver_bridge_tests.rsindex 990d608c50..f71ddad178 100644--- a/crates/openhuman-core/src/agent/subagent_host/ops_tests_driver_bridge_tests.rs+++ b/crates/openhuman-core/src/agent/subagent_host/ops_tests_driver_bridge_tests.rs@@ -36,13 +36,10 @@ async fn prepared_subagent_runs_through_driver_jobs_dispatcher() {).await.expect("detached driver spawn should register");- let (outcome, _effects) = tokio::time::timeout(- std::time::Duration::from_secs(5),- completed_rx,- )- .await- .expect("detached driver should complete")- .expect("completion callback sends the host result");+ let (outcome, _effects) = tokio::time::timeout(std::time::Duration::from_secs(5), completed_rx)+ .await+ .expect("detached driver should complete")+ .expect("completion callback sends the host result");let outcome = outcome.expect("driver-backed child should complete");assert!(matches!(outcome.status, SubagentRunStatus::Completed));@@ -253,10 +250,12 @@ async fn independent_host_bundles_share_and_project_the_persisted_winner() {!leader.final_history.is_empty(),"winner history is preserved");- assert!(leader- .final_history- .iter()- .any(|row| { row.role == "tool" && row.tool_call_id.as_deref() == Some("call-1") }));+ assert!(+ leader+ .final_history+ .iter()+ .any(|row| { row.role == "tool" && row.tool_call_id.as_deref() == Some("call-1") })+ );assert_eq!(leader.usage.input_tokens, follower.usage.input_tokens);assert!(leader.usage.input_tokens > 0, "winner usage is preserved");assert_eq!(leader.artifact_paths, follower.artifact_paths);@@ -403,19 +402,21 @@ async fn closing_a_durable_driver_session_cancels_only_its_registered_child() {);let owner_scope: std::sync::Arc<dyn Fn(u64) -> String + Send + Sync> =std::sync::Arc::new(move |_| owner.clone());- assert!(port- .close("close-driver-session")- .await- .expect("Tiny close adapter cancels then closes the durable row"));+ assert!(+ port.close("close-driver-session")+ .await+ .expect("Tiny close adapter cancels then closes the durable row")+ );assert_eq!(jobs.get(job_id.as_str()).unwrap().status,SubAgentJobStatus::Running,"the job remains visible while cooperative cancellation unwinds");- assert!(port- .close("close-driver-session")- .await- .expect("repeated close is idempotent without re-cancelling"));+ assert!(+ port.close("close-driver-session")+ .await+ .expect("repeated close is idempotent without re-cancelling")+ );assert!(!parent_cancellation.is_cancelled(), "parent stays live");let tiny_store: std::sync::Arc<dyn TinySessionStore> = std::sync::Arc::new(port.clone());@@ -537,14 +538,14 @@ async fn closing_a_durable_driver_session_cancels_only_its_registered_child() {).await.expect("sibling driver remains usable");- let (sibling, _effects) = tokio::time::timeout(- std::time::Duration::from_secs(5),- sibling_rx,- )- .await- .expect("sibling driver should complete")- .expect("sibling completion callback sends the result");- assert!(matches!(sibling.expect("sibling child completes").status, SubagentRunStatus::Completed));+ let (sibling, _effects) = tokio::time::timeout(std::time::Duration::from_secs(5), sibling_rx)+ .await+ .expect("sibling driver should complete")+ .expect("sibling completion callback sends the result");+ assert!(matches!(+ sibling.expect("sibling child completes").status,+ SubagentRunStatus::Completed+ ));assert_eq!(provider.captured.lock().len(), 2);}diff --git a/crates/openhuman-core/src/agent/subagent_host/ops_tests_model_resolution_tests.rs b/crates/openhuman-core/src/agent/subagent_host/ops_tests_model_resolution_tests.rsindex 6189cc3103..13eab2443f 100644--- a/crates/openhuman-core/src/agent/subagent_host/ops_tests_model_resolution_tests.rs+++ b/crates/openhuman-core/src/agent/subagent_host/ops_tests_model_resolution_tests.rs@@ -1,5 +1,5 @@use super::*;-use crate::agent::subagent_host::{spawn_async_via_driver_tool_with_jobs, SubagentRunStatus};+use crate::agent::subagent_host::{SubagentRunStatus, spawn_async_via_driver_tool_with_jobs};use tinyagents_harness::context::{RunDepth, current_run_depth, with_run_depth};struct BlockingSubagentCloseTool {diff --git a/crates/openhuman-core/src/agent/subagent_host/ops_tests_trace_export_tests.rs b/crates/openhuman-core/src/agent/subagent_host/ops_tests_trace_export_tests.rsindex 8047f761fb..ab560023c7 100644--- a/crates/openhuman-core/src/agent/subagent_host/ops_tests_trace_export_tests.rs+++ b/crates/openhuman-core/src/agent/subagent_host/ops_tests_trace_export_tests.rs@@ -8,7 +8,7 @@ use super::*;async fn prepared_child_run_is_exported_from_its_native_journal_lineage() {use tinyagents_harness::events::AgentEvent;use tinyagents_harness::observability::trace_export::{- collector::SpanCollector, serialize::spans_to_ndjson, TraceContext,+ TraceContext, collector::SpanCollector, serialize::spans_to_ndjson,};let scratch = tempfile::tempdir().expect("isolated native trace fixture");@@ -85,10 +85,11 @@ async fn prepared_child_run_is_exported_from_its_native_journal_lineage() {).await.expect("detached driver child registers");- let (outcome, _effects) = tokio::time::timeout(std::time::Duration::from_secs(5), completion_rx)- .await- .expect("detached child completes")- .expect("completion callback sends the host outcome");+ let (outcome, _effects) =+ tokio::time::timeout(std::time::Duration::from_secs(5), completion_rx)+ .await+ .expect("detached child completes")+ .expect("completion callback sends the host outcome");let outcome = outcome.expect("driver-backed child run completes");assert!(matches!(outcome.status, SubagentRunStatus::Completed));assert_eq!(provider.captured.lock().len(), 1);@@ -244,9 +245,11 @@ async fn prepared_child_run_is_exported_from_its_native_journal_lineage() {.expect("native projection preserves the provider-reported charge");assert_eq!(generation.attributes["gen_ai.usage.input_tokens"], 120);assert_eq!(generation.attributes["gen_ai.usage.output_tokens"], 8);- assert!(generation- .attributes- .contains_key("gen_ai.pricing.input_per_mtok_usd"));+ assert!(+ generation+ .attributes+ .contains_key("gen_ai.pricing.input_per_mtok_usd")+ );let exported = spans_to_ndjson(tinyagents_harness::observability::trace_export::serialize::SpanEnvelope::Otel,spans,