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): centralize spawn tool detection in ToolScope
Steven Enamakel0c35c6eda05f
diff --git a/crates/openhuman-core/src/agent/harness/definition/execution_spec.rs b/crates/openhuman-core/src/agent/harness/definition/execution_spec.rsindex 1a39cb5916..2ba4e81b56 100644--- a/crates/openhuman-core/src/agent/harness/definition/execution_spec.rs+++ b/crates/openhuman-core/src/agent/harness/definition/execution_spec.rs@@ -49,6 +49,24 @@ pub enum ToolScope {Named(Vec<String>),}+/// The tools through which an agent spawns sub-agents of its own choosing.+/// A named scope that lists none of them delegates only to what its host+/// declared, never to an inherited roster.+pub const SPAWN_TOOL_NAMES: &[&str] = &[+ "spawn_subagent",+ "spawn_async_subagent",+ "spawn_parallel_agents",+ "spawn_worker_thread",+];++impl ToolScope {+ /// Whether this is a named scope that lists one of [`SPAWN_TOOL_NAMES`].+ pub fn names_a_spawn_tool(&self) -> bool {+ matches!(self, ToolScope::Named(names)+ if names.iter().any(|name| SPAWN_TOOL_NAMES.contains(&name.as_str())))+ }+}+/// Sandbox mode for a sub-agent's tool execution. Serialises as a simple/// `snake_case` string in TOML (`none` / `read_only` / `sandboxed`). In/// the future this may map directly into a `SecurityPolicy` builder.diff --git a/crates/openhuman-core/src/agent/session_host/builder/mod.rs b/crates/openhuman-core/src/agent/session_host/builder/mod.rsindex 9e7712013b..816b8411d4 100644--- a/crates/openhuman-core/src/agent/session_host/builder/mod.rs+++ b/crates/openhuman-core/src/agent/session_host/builder/mod.rs@@ -261,15 +261,7 @@ pub(super) fn summarizes_tool_output(agent_id: &str, config: &crate::config::Conpub(super) fn should_synthesize_delegation_tools(def: &AgentDefinition) -> bool {match &def.tools {ToolScope::Wildcard => !def.subagents.is_empty(),- ToolScope::Named(names) => names.iter().any(|name| {- matches!(- name.as_str(),- "spawn_subagent"- | "spawn_async_subagent"- | "spawn_parallel_agents"- | "spawn_worker_thread"- )- }),+ ToolScope::Named(_) => def.tools.names_a_spawn_tool(),}}diff --git a/crates/openhuman-embed/src/agent/build.rs b/crates/openhuman-embed/src/agent/build.rsindex eaf66e5a97..d60182f4b0 100644--- a/crates/openhuman-embed/src/agent/build.rs+++ b/crates/openhuman-embed/src/agent/build.rs@@ -236,6 +236,22 @@ pub(crate) fn instantiate(runtime: &Runtime, spec: AgentSpec) -> Result<AgentInnopt_named_belt_into_discovery(&mut definition.tools);}+ // A named scope is an explicit allowlist: unless it names a spawn tool it+ // delegates only to the sub-agents its host declares, never to the+ // inherited built-in roster (which would otherwise come back as+ // `delegate_*` tools the scope never listed).+ if matches!(+ definition.tools,+ openhuman_core::agent::harness::definition::ToolScope::Named(_)+ ) && !definition.tools.names_a_spawn_tool()+ && !definition.subagents.is_empty()+ {+ log::debug!(+ "[embed][agent] id={id} named scope names no spawn tool; dropping {} inherited sub-agent(s)",+ definition.subagents.len()+ );+ definition.subagents.clear();+ }let definitions = own_catalogue(&catalogue, &id, &mut definition, parts.subagents)?;// ── narrowing ────────────────────────────────────────────────────────