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(spawn_subagent): rename spawn_async_subagent to spawn_subagent
Steven Enamakel1ae252d8ee9f
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_host_impl.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_host_impl.rsindex 54afd0d725..4bbc5fb51a 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_host_impl.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_host_impl.rs@@ -1,4 +1,4 @@-impl SpawnAsyncSubagentTool {+impl SpawnSubagentTool {async fn execute_with_context_inner(&self,args: serde_json::Value,@@ -27,7 +27,7 @@ impl SpawnAsyncSubagentTool {}let Some(detached_parent) = detached_parent else {return Ok(ToolResult::error(- "spawn_async_subagent requires a live harness run context.",+ "spawn_subagent requires a live harness run context.",));};@@ -35,7 +35,7 @@ impl SpawnAsyncSubagentTool {Some(parent) => parent,None => {return Ok(ToolResult::error(- "spawn_async_subagent called outside of an agent turn",+ "spawn_subagent called outside of an agent turn",));}};@@ -44,7 +44,7 @@ impl SpawnAsyncSubagentTool {// effects. A scoped refusal cannot become an accepted/running reference.if let Err(error) = running_subagents::admit_spawn(&dispatch, &parent.workspace_dir) {return Ok(ToolResult::error(format!(- "spawn_async_subagent: registration refused: {error}"+ "spawn_subagent: registration refused: {error}")));}@@ -54,7 +54,7 @@ impl SpawnAsyncSubagentTool {Some(registry) => registry,None => {return Ok(ToolResult::error(- "spawn_async_subagent: AgentDefinitionRegistry has not been initialised",+ "spawn_subagent: AgentDefinitionRegistry has not been initialised",));}};@@ -63,7 +63,7 @@ impl SpawnAsyncSubagentTool {None => {let available: Vec<&str> = registry.list().iter().map(|d| d.id.as_str()).collect();return Ok(ToolResult::error(format!(- "spawn_async_subagent: unknown agent_id '{agent_id}'. Available: {}",+ "spawn_subagent: unknown agent_id '{agent_id}'. Available: {}",available.join(", "))));}@@ -77,13 +77,13 @@ impl SpawnAsyncSubagentTool {if !parent.allowed_subagent_ids.contains(&definition.id) {log::warn!(- "[spawn_async_subagent] blocked subagent outside allowlist parent={} requested={} allowed={:?}",+ "[spawn_subagent] blocked subagent outside allowlist parent={} requested={} allowed={:?}",parent.agent_definition_id,definition.id,parent.allowed_subagent_ids);return Ok(ToolResult::error(format!(- "spawn_async_subagent: agent '{}' is not in parent agent '{}' subagents.allowlist",+ "spawn_subagent: agent '{}' is not in parent agent '{}' subagents.allowlist",definition.id, parent.agent_definition_id)));}@@ -112,7 +112,7 @@ impl SpawnAsyncSubagentTool {tracing::debug!(workspace_root = %workspace.root.display(),policy_id = %workspace.policy_id,- "[spawn_async_subagent] using ToolExecutionContext workspace root"+ "[spawn_subagent] using ToolExecutionContext workspace root");workspace.root.clone()})@@ -156,12 +156,12 @@ impl SpawnAsyncSubagentTool {Ok(true) => {}Ok(false) => {return Ok(ToolResult::error(- "spawn_async_subagent: reusable session changed during fresh start; retry with the current session",+ "spawn_subagent: reusable session changed during fresh start; retry with the current session",));}Err(err) => {return Ok(ToolResult::error(format!(- "spawn_async_subagent: failed to close reusable session: {err}"+ "spawn_subagent: failed to close reusable session: {err}")));}}@@ -263,7 +263,7 @@ impl SpawnAsyncSubagentTool {&task_id,) {return Ok(ToolResult::error(- "spawn_async_subagent: parent thread is stopped or deleted",+ "spawn_subagent: parent thread is stopped or deleted",));}}@@ -279,7 +279,7 @@ impl SpawnAsyncSubagentTool {Ok(target) => target,Err(error) => {return Ok(ToolResult::error(format!(- "spawn_async_subagent: parent lifecycle admission failed: {error}"+ "spawn_subagent: parent lifecycle admission failed: {error}")));}};@@ -344,7 +344,7 @@ impl SpawnAsyncSubagentTool {err);return Ok(ToolResult::error(format!(- "spawn_async_subagent: failed to persist reusable sub-agent session: {err}"+ "spawn_subagent: failed to persist reusable sub-agent session: {err}")));}};@@ -403,7 +403,7 @@ impl SpawnAsyncSubagentTool {.unwrap_or_else(|| background_subagent_session_id.clone());let background_parent_thread_id = parent_thread_id.clone();log::debug!(- "[spawn_async_subagent] register task_id={} parent_session={} parent_thread_id={}",+ "[spawn_subagent] register task_id={} parent_session={} parent_thread_id={}",task_id,parent_session,background_parent_thread_id.as_deref().unwrap_or("none")@@ -489,7 +489,7 @@ impl SpawnAsyncSubagentTool {.await;}return Ok(ToolResult::error(format!(- "spawn_async_subagent: failed to register detached sub-agent: {error}"+ "spawn_subagent: failed to register detached sub-agent: {error}")));}diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_surface.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_surface.rsindex 6940c1af17..daff72c3d1 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_surface.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_surface.rs@@ -1,4 +1,4 @@-//! Tool: `spawn_async_subagent` - fire-and-forget sub-agent delegation.+//! Tool: `spawn_subagent` - fire-and-forget sub-agent delegation.//!//! Unlike `spawn_subagent`, this tool returns as soon as the child run is//! accepted. Completion/failure is reported through normal sub-agent lifecycle@@ -26,19 +26,19 @@ use tinyagents_session::transcript::TranscriptMessage;use tinytools::ToolRunContext;use tinytools::{PermissionLevel, Tool, ToolCallOptions, ToolResult};-pub struct SpawnAsyncSubagentTool {+pub struct SpawnSubagentTool {/// The ids this instance advertises in its `agent_id` enum. Empty means- /// the whole registry. See [`SpawnAsyncSubagentTool::scoped`].+ /// the whole registry. See [`SpawnSubagentTool::scoped`].advertised_ids: Vec<String>,}/// Harness dispatch for the detached child path. It owns the typed parent run/// so the spawned child receives the caller's carrier before `tokio::spawn`.-pub(crate) struct SpawnAsyncSubagentDispatch {+pub(crate) struct SpawnSubagentDispatch {tool: Arc<dyn Tool>,}-impl SpawnAsyncSubagentDispatch {+impl SpawnSubagentDispatch {pub(crate) fn new(tool: Arc<dyn Tool>) -> Self {Self { tool }}@@ -46,7 +46,7 @@ impl SpawnAsyncSubagentDispatch {#[async_trait]impl ToolDispatch<(), crate::agent::tinyagents::host::OpenHumanRunContext>- for SpawnAsyncSubagentDispatch+ for SpawnSubagentDispatch{fn tool(&self) -> Arc<dyn Tool> {self.tool.clone()@@ -63,7 +63,7 @@ impl ToolDispatch<(), crate::agent::tinyagents::host::OpenHumanRunContext>let context = ToolExecutionContext::from_run_context(parent, _call_id.clone());let detached_parent =crate::agent::subagent_host::detached_subagent_parent(parent, "async-subagent")?;- SpawnAsyncSubagentTool::new()+ SpawnSubagentTool::new().execute_with_live_parent_context(arguments,Some(&context),@@ -74,7 +74,7 @@ impl ToolDispatch<(), crate::agent::tinyagents::host::OpenHumanRunContext>}}-impl SpawnAsyncSubagentTool {+impl SpawnSubagentTool {pub fn new() -> Self {Self {advertised_ids: Vec::new(),@@ -84,7 +84,7 @@ impl SpawnAsyncSubagentTool {/// An instance whose schema advertises only `ids`, the parent's/// `[subagents]` allowlist.///- /// [`scope_spawn_async_subagent_spec`] narrows the session's spec view,+ /// [`scope_spawn_subagent_spec`] narrows the session's spec view,/// but on native tool calling the wire schema is read from the registered/// tool itself (`CanonicalSharedToolAdapter::for_name` → `Tool::spec`),/// so the narrowed view never reached the provider: a captured@@ -167,13 +167,13 @@ async fn steer_reusable_session(}}-impl Default for SpawnAsyncSubagentTool {+impl Default for SpawnSubagentTool {fn default() -> Self {Self::new()}}-/// Narrow a session's `spawn_async_subagent` schema to the ids the parent may+/// Narrow a session's `spawn_subagent` schema to the ids the parent may/// actually dispatch.////// The tool is registered once per process, so its `agent_id` enum is built@@ -184,7 +184,7 @@ impl Default for SpawnAsyncSubagentTool {/// (`builder::visible_tool_specs_for_policy`), the same place `use_skill`'s/// pack index is narrowed. A missing or empty allowlist leaves the spec alone:/// wildcard parents keep the full registry.-pub fn scope_spawn_async_subagent_spec(spec: &mut tinytools::ToolSpec, allowed: &[String]) {+pub fn scope_spawn_subagent_spec(spec: &mut tinytools::ToolSpec, allowed: &[String]) {if allowed.is_empty() {return;}@@ -210,9 +210,9 @@ pub fn scope_spawn_async_subagent_spec(spec: &mut tinytools::ToolSpec, allowed:}#[async_trait]-impl Tool for SpawnAsyncSubagentTool {+impl Tool for SpawnSubagentTool {fn name(&self) -> &str {- "spawn_async_subagent"+ "spawn_subagent"}fn description(&self) -> &str {@@ -310,10 +310,10 @@ impl Tool for SpawnAsyncSubagentTool {}}-impl SpawnAsyncSubagentTool {+impl SpawnSubagentTool {/// Drive the tool the way a live parent turn does, over an explicit/// `parent` execution context. Tests only: production turns reach the tool- /// through [`SpawnAsyncSubagentDispatch`] with their own carrier.+ /// through [`SpawnSubagentDispatch`] with their own carrier.#[cfg(test)]pub(crate) async fn execute_under_parent(&self,@@ -353,12 +353,12 @@ impl SpawnAsyncSubagentTool {}}-#[path = "spawn_async_subagent_completion.rs"]+#[path = "spawn_subagent_completion.rs"]mod completion;-include!("spawn_async_subagent_host_impl.rs");-include!("spawn_async_subagent_request.rs");-include!("spawn_async_subagent_projection.rs");+include!("spawn_subagent_host_impl.rs");+include!("spawn_subagent_request.rs");+include!("spawn_subagent_projection.rs");/// Settle a late registration refusal before an accepted response is built.#[cfg(test)]@@ -369,7 +369,7 @@ fn finish_spawn_registration(task_id: &str,) -> Result<(), String> {if let Err(error) = registration {- let refusal = format!("spawn_async_subagent: registration refused: {error}");+ let refusal = format!("spawn_subagent: registration refused: {error}");subagent_sessions::mark_failed(store, session_id, task_id, refusal.clone()).map_err(|failure| format!("{refusal}; failed to settle persisted session: {failure}"),)?;@@ -620,7 +620,7 @@ fn attach_workflow_proposal(Ok(json) => json,Err(err) => {log::warn!(- "[spawn_async_subagent] workflow proposal re-serialize failed task_id={task_id} error={err}"+ "[spawn_subagent] workflow proposal re-serialize failed task_id={task_id} error={err}");return summary;}@@ -630,7 +630,7 @@ fn attach_workflow_proposal(.and_then(|n| n.as_str()).unwrap_or("Untitled workflow");log::info!(- "[spawn_async_subagent] extracted workflow proposal '{name}' task_id={task_id} \+ "[spawn_subagent] extracted workflow proposal '{name}' task_id={task_id} \({} chars) — persisting to parent thread {:?}",proposal_json.len(),parent_thread_id@@ -656,7 +656,7 @@ fn attach_workflow_proposal();if let Err(err) = persisted {log::warn!(- "[spawn_async_subagent] workflow proposal persistence failed \+ "[spawn_subagent] workflow proposal persistence failed \thread_id={thread_id} task_id={task_id} error={err} — proposal still \rides the delivery notice");@@ -682,5 +682,5 @@ fn reusable_follow_up_message(prompt: &str, context: Option<&str>) -> String {}#[cfg(test)]-#[path = "spawn_async_subagent_tests.rs"]+#[path = "spawn_subagent_tests.rs"]mod tests;