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(agent): split orchestration tools into per-tool modules
Steven Enamakel0a5ec81d660d
diff --git a/crates/openhuman-core/src/agent/orchestration/tools.rs b/crates/openhuman-core/src/agent/orchestration/tools.rsindex f7f0ff4bf5..4f4c87a692 100644--- a/crates/openhuman-core/src/agent/orchestration/tools.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools.rs@@ -57,22 +57,19 @@ mod worker_thread;pub(crate) use dispatch::DelegationDispatch;-/// Recreate the minimal live TinyAgents carrier for callers that invoke a-/// concrete tool directly inside `with_parent_context`. Normal agent turns-/// always arrive through the typed dispatchers with their original carrier;-/// this compatibility path keeps controller/test callers inside an explicit-/// parent context from losing their recursive delegation authority.-pub(crate) fn ambient_parent_run_context(+/// A minimal live TinyAgents carrier over `parent`, for tests that drive a+/// concrete tool directly (outside an agent turn) under an explicit parent+/// execution context. Normal agent turns always arrive through the typed+/// dispatchers with their original carrier.+#[cfg(test)]+pub(crate) fn live_parent_run_context(kind: &str,-) -> Option<- tinyagents_harness::context::RunContext<crate::agent::tinyagents::host::OpenHumanRunContext>,-> {- crate::agent::harness::current_parent().map(|parent| {- crate::agent::tinyagents::host::OpenHumanRunContext::new()- .with_host_env(&parent.host_env)- .with_parent(parent)- .into_tinyagents(tinyagents_harness::context::RunConfig::new(kind))- })+ parent: crate::agent::harness::ParentExecutionContext,+) -> tinyagents_harness::context::RunContext<crate::agent::tinyagents::host::OpenHumanRunContext> {+ crate::agent::tinyagents::host::OpenHumanRunContext::new()+ .with_host_env(&parent.host_env)+ .with_parent(parent)+ .into_tinyagents(tinyagents_harness::context::RunConfig::new(kind))}pub use archetype_delegation::{ArchetypeDelegationTool, DelegationTarget};diff --git a/crates/openhuman-core/src/agent/orchestration/tools/archetype_delegation.rs b/crates/openhuman-core/src/agent/orchestration/tools/archetype_delegation.rsindex b699dd5961..b005046cce 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/archetype_delegation.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/archetype_delegation.rs@@ -136,19 +136,7 @@ pub(crate) async fn execute_archetype_delegation(tool_context: Option<&dyn ToolRunContext>,run_context: crate::agent::tinyagents::host::OpenHumanRunContext,) -> anyhow::Result<ToolResult> {- if let Some(live_parent) = super::ambient_parent_run_context("direct-archetype-delegation") {- let run_context = live_parent.data.child();- return execute_archetype_delegation_with_live_parent(- agent_id,- tool_name,- args,- tool_context,- run_context,- Some(&live_parent),- )- .await;- }- execute_archetype_delegation_with_live_parent(+execute_archetype_delegation_with_live_parent(agent_id,tool_name,args,diff --git a/crates/openhuman-core/src/agent/orchestration/tools/close_subagent.rs b/crates/openhuman-core/src/agent/orchestration/tools/close_subagent.rsindex e0d8316b28..96e1e97a16 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/close_subagent.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/close_subagent.rs@@ -93,12 +93,8 @@ impl Tool for CloseSubagentTool {_options: ToolCallOptions,tool_context: Option<&dyn ToolRunContext>,) -> anyhow::Result<ToolResult> {- self.execute_with_parent_context(- args,- crate::agent::harness::current_parent(),- tool_context,- )- .await+ self.execute_with_parent_context(args, None, tool_context)+ .await}}diff --git a/crates/openhuman-core/src/agent/orchestration/tools/continue_subagent.rs b/crates/openhuman-core/src/agent/orchestration/tools/continue_subagent.rsindex fa14ef76a3..187d3d1dd2 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/continue_subagent.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/continue_subagent.rs@@ -226,18 +226,7 @@ impl Tool for ContinueSubagentTool {_options: ToolCallOptions,tool_context: Option<&dyn ToolRunContext>,) -> anyhow::Result<ToolResult> {- if let Some(live_parent) = super::ambient_parent_run_context("direct-continue-subagent") {- let run_context = live_parent.data.child();- return self- .execute_with_live_parent_context(- args,- tool_context,- run_context,- Some(&live_parent),- )- .await;- }- self.execute_with_parent_context(+self.execute_with_parent_context(args,tool_context,crate::agent::tinyagents::host::OpenHumanRunContext::new(),diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent.rsindex f715c0a3db..2d58fb55c3 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent.rs@@ -239,26 +239,7 @@ impl Tool for SpawnAsyncSubagentTool {options: ToolCallOptions,tool_context: Option<&dyn ToolRunContext>,) -> anyhow::Result<ToolResult> {- if let Some(live_parent) = super::ambient_parent_run_context("direct-async-subagent") {- let detached_data = live_parent.data.detached_child();- let detached_cancellation = detached_data.cancellation.clone();- let detached_parent = live_parent- .child(- RunConfig::new(format!("async-subagent-{}", uuid::Uuid::new_v4())),- detached_data,- )- .map_err(|error| anyhow::anyhow!(error.to_string()))?- .with_cancellation(detached_cancellation);- return self- .execute_with_live_parent_context(- args,- tool_context,- live_parent.data.child(),- detached_parent,- )- .await;- }- self.execute_with_context_inner(+self.execute_with_context_inner(args,options,tool_context,diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents.rsindex 1d57440564..7473f8b902 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents.rs@@ -239,18 +239,7 @@ impl Tool for SpawnParallelAgentsTool {tool_context: Option<&dyn ToolRunContext>,) -> anyhow::Result<ToolResult> {let parent_call_id = crate::tools::host_extensions::tool_call_id(tool_context);- if let Some(live_parent) = super::ambient_parent_run_context("direct-spawn-parallel") {- return execute_spawn_parallel_agents(- args,- live_parent.cancellation.clone(),- live_parent.workspace.clone(),- live_parent.data.child(),- Some(&live_parent),- parent_call_id,- )- .await;- }- let workspace_descriptor = tool_context.and_then(|ctx| ctx.workspace().cloned());+let workspace_descriptor = tool_context.and_then(|ctx| ctx.workspace().cloned());execute_spawn_parallel_agents(args,tinyagents_harness::CancellationToken::new(),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.rsindex 0975ea5a0b..422a93ed2c 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@@ -39,18 +39,7 @@ impl Tool for SpawnSubagentTool {_options: ToolCallOptions,tool_context: Option<&dyn ToolRunContext>,) -> anyhow::Result<ToolResult> {- if let Some(live_parent) = super::ambient_parent_run_context("direct-spawn-subagent") {- let run_context = live_parent.data.child();- return self- .execute_with_live_parent_context(- args,- tool_context,- run_context,- Some(&live_parent),- )- .await;- }- self.execute_with_parent_context(+self.execute_with_parent_context(args,tool_context,crate::agent::tinyagents::host::OpenHumanRunContext::new(),diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_worker_thread.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_worker_thread.rsindex ed6018d0e2..9ae691c2ca 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_worker_thread.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_worker_thread.rs@@ -145,18 +145,7 @@ impl Tool for SpawnWorkerThreadTool {_options: ToolCallOptions,tool_context: Option<&dyn ToolRunContext>,) -> anyhow::Result<ToolResult> {- if let Some(live_parent) = super::ambient_parent_run_context("direct-spawn-worker") {- let run_context = live_parent.data.child();- return self- .execute_with_live_parent_context(- args,- tool_context,- run_context,- Some(&live_parent),- )- .await;- }- self.execute_with_parent_context(+self.execute_with_parent_context(args,tool_context,crate::agent::tinyagents::host::OpenHumanRunContext::new(),