Skip to content

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

fix(subagent): route spawn_subagent through the driver tool

Steven Enamakel230805408055
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent.rs
index 55f87b43d5..35f0f4d281 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent.rs
@@ -14,7 +14,7 @@
//!
use crate::agent::orchestration::tools::dispatch::{incomplete_stop, stopped_subagent_result};
use crate::agent::subagent_host::{
- run_subagent_with_parent, SubagentRunOptions, SubagentRunOutcome, SubagentRunStatus,
+ run_subagent_via_driver_tool, SubagentRunOptions, SubagentRunOutcome, SubagentRunStatus,
};
use crate::agent_registry::host_definition::AgentDefinitionRegistry;
use crate::core::runtime::DispatchCtx;
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_tool_impl.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_tool_impl.rs
index ea61a306bf..2490e19abe 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_tool_impl.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_tool_impl.rs
@@ -325,9 +325,14 @@ impl SpawnSubagentTool {
message_run_queue: None,
};
- let run =
- run_subagent_with_parent(live_parent, definition.clone(), prompt.clone(), options)
- .await;
+ let run = run_subagent_via_driver_tool(
+ live_parent,
+ definition.clone(),
+ prompt.clone(),
+ options,
+ )
+ .await
+ .map(|(outcome, _job_id)| outcome);
match run {
Ok(outcome) => {
let emit_lifecycle_effects = outcome.should_emit_lifecycle_effects();
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs
index 423bccc9ea..faf733069d 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs
@@ -58,6 +58,7 @@ async fn spawn_subagent_tool_runs_child_agent_e2e() {
assert!(
jobs.list().iter().any(|job| {
job.agent == "task_manager_agent"
+ && job.output.as_deref() == Some("spawn-subagent-child-answer")
&& job.status
== tinyagents_orchestration::subagent::SubAgentJobStatus::Completed
}),
@@ -178,6 +179,7 @@ async fn archetype_delegation_tool_runs_child_agent_e2e() {
assert!(
completed.iter().any(|job| {
job.agent == "task_manager_agent"
+ && job.output.as_deref() == Some("archetype-delegation-child-answer")
&& job.status
== tinyagents_orchestration::subagent::SubAgentJobStatus::Completed
}),