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
chore: files changed crates/openhuman-core/src/agent/subagent_host/ops/runner.rs,crates/openhuman-co
Steven Enamakel38228c4eca97
diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rsindex ee96d6aa04..2fa327bcf9 100644--- a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs+++ b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs@@ -25,7 +25,7 @@ use crate::agent_registry::host_definition::{AgentDefinition, AgentDefinitionReguse 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 tinytools::ToolSpec;+use tinytools::{Tool, ToolSpec};use tinytools_std::file_state::with_file_state_agent_id;use super::prompt::compose_subagent_system_prompt;@@ -283,6 +283,12 @@ pub(crate) async fn run_subagent_direct_with_native_context(// tool through HostOperationContext.//let mut parent_for_subagent = parent.clone();+ // The direct-child list belongs to the agent now being run. It is not+ // the originating parent's list: each definition's allowlist governs+ // only that actor's own children.+ parent_for_subagent.agent_definition_id = definition.id.clone();+ parent_for_subagent.allowed_subagent_ids =+ definition.allowed_subagent_ids().into_iter().collect();if let Some(descriptor) = options.workspace_descriptor.clone() {parent_for_subagent.workspace_descriptor = Some(descriptor);}@@ -297,6 +303,8 @@ pub(crate) async fn run_subagent_direct_with_native_context(&loaded_config,native,nested_spawn_depth_available,+ attempted_depth,+ max_depth,)).await})@@ -398,6 +406,8 @@ async fn run_typed_mode(config: &LoadedConfig,native: crate::agent::tinyagents::NativeSubagentRunContext,nested_spawn_depth_available: bool,+ active_child_depth: usize,+ max_depth: usize,) -> Result<SubagentRunOutcome, SubagentRunError> {let started = Instant::now();@@ -493,8 +503,11 @@ async fn run_typed_mode(if names.iter().any(|tool| tool == name)))};+ let nested_spawn_ids = definition.allowed_subagent_ids();let nested_spawn_allowed = |name: &str| {- nested_spawn_depth_available && explicitly_declares_nested_spawn(name)+ nested_spawn_depth_available+ && !nested_spawn_ids.is_empty()+ && explicitly_declares_nested_spawn(name)};let before = allowed_indices.len();allowed_indices.retain(|&i| {@@ -544,14 +557,43 @@ async fn run_typed_mode(&parent.all_tools,child_rules.as_deref(),);- let filtered_specs: Vec<ToolSpec> = listed+ let mut filtered_specs: Vec<ToolSpec> = listed.iter().map(|&i| parent.all_tool_specs[i].as_ref().clone()).collect();+ let nested_spawn_tool = if nested_spawn_allowed("spawn_subagent") {+ Some(crate::agent::orchestration::tools::SpawnSubagentTool::scoped(+ nested_spawn_ids.clone(),+ ))+ } else {+ None+ };+ if let Some(tool) = &nested_spawn_tool {+ if let Some(spec) = filtered_specs+ .iter_mut()+ .find(|spec| spec.name == "spawn_subagent")+ {+ *spec = tool.spec();+ }+ }let allowed_names: HashSet<String> = allowed_indices.iter().map(|&i| parent.all_tools[i].name().to_string()).collect();+ #[cfg(test)]+ if active_child_depth > 0 {+ eprintln!(+ "NESTED_SPAWN_ADMISSION_TRACE agent={} active_child_depth={} max_depth={} depth_room={} explicit_spawn={} parent_ceiling_unrestricted={} parent_ceiling_contains_spawn={} final_allowlist_contains_spawn={}",+ definition.id,+ active_child_depth,+ max_depth,+ nested_spawn_depth_available,+ explicitly_declares_nested_spawn("spawn_subagent"),+ parent.subagent_tool_ceiling_names.is_empty(),+ parent.subagent_tool_ceiling_names.contains("spawn_subagent"),+ allowed_names.contains("spawn_subagent"),+ );+ }let filtered_specs = dedup_visible_tool_specs(filtered_specs);tracing::debug!(@@ -765,13 +807,20 @@ async fn run_typed_mode(}let (output, iterations, agg_usage, early_exit_tool, hit_cap, breaker_halt, failure_cause) =+ let mut child_run_context = options+ .run_context+ .for_subagent(definition, config.as_ref().ok().map(AsRef::as_ref));+ child_run_context.parent = Some(parent.clone());+ let dynamic_tools = nested_spawn_tool+ .map(|tool| vec![Box::new(tool) as Box<dyn Tool>])+ .unwrap_or_default();super::graph::run_subagent_via_graph(subagent_source.clone(),&model,temperature,&mut history,parent.all_tools.clone(),- Vec::new(),+ dynamic_tools,filtered_specs.clone(),allowed_names,definition_iter_cap(&options.run_context, definition),@@ -781,9 +830,7 @@ async fn run_typed_mode(task_id,definition.iteration_policy == IterationPolicy::Extended,options.thread_id.clone(),- options- .run_context- .for_subagent(definition, config.as_ref().ok().map(AsRef::as_ref)),+ child_run_context,options.worker_thread_id.clone(),parent.workspace_dir.clone(),workspace_descriptor.clone(),diff --git a/crates/openhuman-core/src/agent/tinyagents/tool_registration.rs b/crates/openhuman-core/src/agent/tinyagents/tool_registration.rsindex 4aac629a91..f760fe8129 100644--- a/crates/openhuman-core/src/agent/tinyagents/tool_registration.rs+++ b/crates/openhuman-core/src/agent/tinyagents/tool_registration.rs@@ -237,6 +237,16 @@ pub(crate) fn turn_admission(has_thread: bool,nested_spawn_depth: Option<NestedSpawnDepth>,) -> ToolAdmission {+ #[cfg(test)]+ if nested_spawn_depth.is_some() {+ eprintln!(+ "NESTED_SPAWN_TOOL_ADMISSION_TRACE depth_grant={nested_spawn_depth:?} allowlist_contains_spawn={} spawn_candidates={:?}",+ allowed+ .as_ref()+ .is_none_or(|names| names.contains("spawn_subagent")),+ candidate_spawn_tools(tool_sets),+ );+ }ToolAdmission {allowed: allowed.clone(),// A sub-agent scope on the turn forces this on in the driver.diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_plan.rs b/crates/openhuman-core/src/agent/tinyagents/turn_plan.rsindex 8158f3c9ff..044f77fff2 100644--- a/crates/openhuman-core/src/agent/tinyagents/turn_plan.rs+++ b/crates/openhuman-core/src/agent/tinyagents/turn_plan.rs@@ -120,6 +120,22 @@ impl TurnPlanner<(), OpenHumanRunContext> for OpenHumanTurnPlanner {) -> Result<TurnPlan<(), OpenHumanRunContext>, RuntimeError> {let mut plan = TurnPlan::new(self.models.clone());plan.policy = self.policy.clone();+ #[cfg(test)]+ if request.run_context.config.depth() > 0 {+ eprintln!(+ "NESTED_SPAWN_RUN_CONFIG_TRACE depth={} max_depth={} host_spawn_depth={} allowlist_contains_spawn={} grant={:?}",+ request.run_context.config.depth(),+ request.run_context.config.max_depth(),+ request.run_context.data.spawn_depth,+ self.allowed+ .as_ref()+ .is_none_or(|allowed| allowed.contains("spawn_subagent")),+ NestedSpawnDepth::try_new(+ request.run_context.config.depth(),+ request.run_context.config.max_depth(),+ ),+ );+ }plan.tools = host_tool_set_builder_for_turn(&self.tool_sets,&self.allowed,