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): consolidate allowed subagent id logic into AgentDefinition
Steven Enamakel1afd2a07ee1c
diff --git a/crates/openhuman-core/src/agent/harness/definition/agent_definition.rs b/crates/openhuman-core/src/agent/harness/definition/agent_definition.rsindex 21275ba78c..8985cb991c 100644--- a/crates/openhuman-core/src/agent/harness/definition/agent_definition.rs+++ b/crates/openhuman-core/src/agent/harness/definition/agent_definition.rs@@ -208,18 +208,16 @@ pub struct AgentDefinition {/// agent's `delegate_name` override) and whose description is the/// target agent's [`AgentDefinition::when_to_use`].///- /// * [`SubagentEntry::Skills`] — a single collapsed- /// [`SkillDelegationTool`] named `delegate_to_integrations_agent`- /// that takes the toolkit slug as an argument and routes to the- /// generic `integrations_agent` with the corresponding- /// `skill_filter` pre-populated (#1335).+ /// * [`SubagentEntry::Skills`] — no delegation tool. The connected+ /// Composio toolkits' actions join this agent's `Deferred` catalogue+ /// (reached through `tool_search`, called directly), and the entry+ /// admits no sub-agent id: see [`AgentDefinition::allowed_subagent_ids`].////// `subagents` is intentionally separate from [`AgentDefinition::tools`]/// so that reading a TOML makes the distinction obvious: `tools` is/// "what I execute directly", `subagents` is "what I can delegate to".////// [`ArchetypeDelegationTool`]: crate::agent::orchestration::tools::ArchetypeDelegationTool- /// [`SkillDelegationTool`]: crate::agent::orchestration::tools::SkillDelegationTool#[serde(default, deserialize_with = "deserialize_subagent_entries")]pub subagents: Vec<SubagentEntry>,@@ -275,6 +273,24 @@ pub struct AgentDefinition {}impl AgentDefinition {+ /// The agent ids this definition may spawn, derived from+ /// [`AgentDefinition::subagents`]. Only [`SubagentEntry::AgentId`]+ /// entries admit a target; the `{ skills = "*" }` wildcard used to map to+ /// `integrations_agent` here, which is what let a chat agent spin up a+ /// sub-agent for one integration action it can now search for and call+ /// itself. The runner's spawn gate (`parent.allowed_subagent_ids`) reads+ /// this, so a definition without a bare id for an agent cannot reach it+ /// through `spawn_async_subagent` either.+ pub fn allowed_subagent_ids(&self) -> Vec<String> {+ self.subagents+ .iter()+ .filter_map(|entry| match entry {+ SubagentEntry::AgentId(id) => Some(id.clone()),+ SubagentEntry::Skills(_) => None,+ })+ .collect()+ }+/// Display name with fallback to id.pub fn display_name(&self) -> &str {self.display_name.as_deref().unwrap_or(&self.id)diff --git a/crates/openhuman-core/src/agent/harness/definition/subagents.rs b/crates/openhuman-core/src/agent/harness/definition/subagents.rsindex 24c000bcf5..bfbb0ed7c8 100644--- a/crates/openhuman-core/src/agent/harness/definition/subagents.rs+++ b/crates/openhuman-core/src/agent/harness/definition/subagents.rs@@ -22,11 +22,11 @@ use serde::{Deserialize, Deserializer, Serialize};pub enum SubagentEntry {/// Delegate to a specific built-in or custom agent by id.AgentId(String),- /// Expand at build time to a single collapsed- /// `delegate_to_integrations_agent` tool whose `toolkit` argument- /// selects which connected Composio toolkit to route to, with- /// `skill_filter` pre-set on the underlying `integrations_agent`- /// dispatch (#1335).+ /// Expand at build time to the connected Composio toolkits' actions as+ /// `Deferred` tools — off the wire, found through the harness's+ /// `tool_search`, and called directly by this agent. No sub-agent is+ /// reachable through this entry: it widens the searchable catalogue,+ /// not the spawnable set.Skills(SkillsWildcard),}diff --git a/crates/openhuman-core/src/agent/session_host/builder/mod.rs b/crates/openhuman-core/src/agent/session_host/builder/mod.rsindex f870468ed9..190b95ac99 100644--- a/crates/openhuman-core/src/agent/session_host/builder/mod.rs+++ b/crates/openhuman-core/src/agent/session_host/builder/mod.rs@@ -244,15 +244,5 @@ fn allowed_subagent_ids_for(agent_id: &str) -> Vec<String> {let Some(definition) = definition else {return Vec::new();};- definition- .subagents- .iter()- .filter_map(|entry| match entry {- SubagentEntry::AgentId(id) => Some(id.clone()),- SubagentEntry::Skills(wildcard) if wildcard.matches_all() => {- Some("integrations_agent".to_string())- }- SubagentEntry::Skills(_) => None,- })- .collect()+ definition.allowed_subagent_ids()}diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session.rs b/crates/openhuman-core/src/agent/session_host/runtime_session.rsindex d2bc0de7fc..0901c88328 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_session.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_session.rs@@ -1538,23 +1538,7 @@ impl OpenHumanSessionHost {run_queue: self.run_queue.clone(),allowed_subagent_ids: self.resolved_definition()- .map(|definition| {- definition- .subagents- .iter()- .filter_map(|entry| match entry {- crate::agent::harness::definition::SubagentEntry::AgentId(id) => {- Some(id.clone())- }- crate::agent::harness::definition::SubagentEntry::Skills(- wildcard,- ) if wildcard.matches_all() => {- Some("integrations_agent".to_string())- }- crate::agent::harness::definition::SubagentEntry::Skills(_) => None,- })- .collect()- })+ .map(|definition| definition.allowed_subagent_ids()).unwrap_or_default(),sandbox_mode: self.resolved_definition()diff --git a/crates/openhuman-core/src/agent/session_host/turn/tools.rs b/crates/openhuman-core/src/agent/session_host/turn/tools.rsindex 9c78c61065..3191120e21 100644--- a/crates/openhuman-core/src/agent/session_host/turn/tools.rs+++ b/crates/openhuman-core/src/agent/session_host/turn/tools.rs@@ -38,23 +38,7 @@ impl OpenHumanSessionHost {}let allowed_subagent_ids = self.resolved_definition()- .map(|definition| {- definition- .subagents- .iter()- .filter_map(|entry| match entry {- crate::agent::harness::definition::SubagentEntry::AgentId(id) => {- Some(id.clone())- }- crate::agent::harness::definition::SubagentEntry::Skills(wildcard)- if wildcard.matches_all() =>- {- Some("integrations_agent".to_string())- }- crate::agent::harness::definition::SubagentEntry::Skills(_) => None,- })- .collect()- })+ .map(|definition| definition.allowed_subagent_ids()).unwrap_or_default();harness::ParentExecutionContext {