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): simplify subagent lifecycle logic
Steven Enamakel055967696aac
diff --git a/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs b/crates/openhuman-core/src/agent/subagent_host/lifecycle.rsindex 82e767de9f..11c34465a8 100644--- a/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs+++ b/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs@@ -510,36 +510,7 @@ impl OpenHumanSubagentHost {}).unwrap_or_else(|| PathBuf::from(".openhuman/subagent_checkpoints"))}));- Box::pin(self.run_leader(parent, task_key, child, input, false, checkpoint_dir)).await- }-- async fn continue_with_key(- self,- parent: &RunContext<crate::agent::tinyagents::host::OpenHumanRunContext>,- task_key: SubagentTaskKey,- input: String,- ) -> Result<SubagentRunOutcome, SubagentRunError> {- let child_config = RunConfig::new(format!("subagent-{}", uuid::Uuid::new_v4()));- let (_, child) = crate::agent::tinyagents::host::direct_subagent_child(- parent,- task_key.task_id.clone(),- child_config,- )- .map_err(|error| SubagentRunError::Provider(anyhow::anyhow!(error.to_string())))?;- let checkpoint_dir =- absolute_checkpoint_dir(self.options.checkpoint_dir.clone().unwrap_or_else(|| {- parent- .data- .parent- .as_ref()- .map(|context| {- context- .workspace_dir- .join(".openhuman/subagent_checkpoints")- })- .unwrap_or_else(|| PathBuf::from(".openhuman/subagent_checkpoints"))- }));- Box::pin(self.run_leader(parent, task_key, child, input, true, checkpoint_dir)).await+ Box::pin(self.run_leader(parent, task_key, child, input, checkpoint_dir)).await}async fn run_leader(@@ -548,7 +519,6 @@ impl OpenHumanSubagentHost {task_key: SubagentTaskKey,child: RunContext<crate::agent::tinyagents::host::OpenHumanRunContext>,input: String,- continuation: bool,checkpoint_dir: PathBuf,) -> Result<SubagentRunOutcome, SubagentRunError> {let fallback_agent_id = self.definition.id.clone();@@ -561,22 +531,17 @@ impl OpenHumanSubagentHost {shared_subagent_flight(&parent.data.dispatch_ctx(), &checkpoint_dir),parent.data.dispatch_ctx(),)?;- let request = if continuation {- SubagentRequest::continue_with_key(task_key.clone(), child, request, input, None, None)- .await- } else {- // `direct_subagent_child` derives the same key for the host's- // durable lookup; this constructor independently proves that the- // execution context is the supplied parent's direct child.- SubagentRequest::fresh_from_parent(- parent,- child,- task_key.task_id.clone(),- request,- input,- None,- )- }+ // `direct_subagent_child` derives the same key for the host's durable+ // lookup; this constructor independently proves that the execution+ // context is the supplied parent's direct child.+ let request = SubagentRequest::fresh_from_parent(+ parent,+ child,+ task_key.task_id.clone(),+ request,+ input,+ None,+ ).map_err(map_lifecycle_error)?;let cancellation = parent.cancellation.clone();match Box::pin(driver.driver.run(request, cancellation)).await {diff --git a/crates/openhuman-core/src/agent/subagent_host/mod.rs b/crates/openhuman-core/src/agent/subagent_host/mod.rsindex c43605452b..f4512efb7a 100644--- a/crates/openhuman-core/src/agent/subagent_host/mod.rs+++ b/crates/openhuman-core/src/agent/subagent_host/mod.rs@@ -33,7 +33,7 @@//! | File | Contents |//! | ----------------- | ----------------------------------------------------------- |//! | `types.rs` | `SubagentRun{Options,Outcome,Error}`, `SubagentMode` |-//! | `ops/` | `run_subagent`, typed/fork mode, TinyAgents graph route |+//! | `ops/` | typed/fork mode and TinyAgents graph route |//! | `tool_prep.rs` | Tool filtering + prompt loading + prompt protocol block |mod autonomous;@@ -61,15 +61,10 @@ pub(crate) use lifecycle::detached_subagent_parent;pub(crate) use lifecycle::load_subagent_checkpoint;pub(crate) use lifecycle::load_terminal_outcome;pub(crate) use lifecycle::resume_async_via_driver_tool;-#[cfg(test)]-pub(crate) use lifecycle::run_subagent_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::{- continue_subagent, continue_subagent_with_parent, run_subagent, run_subagent_with_parent,- OpenHumanSubagentHost,-};+pub use lifecycle::OpenHumanSubagentHost;pub use types::{SubagentCheckpointData, SubagentMode, SubagentRunError, SubagentRunOptions, SubagentRunOutcome,SubagentRunStatus, SubagentUsage,