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
feat(composio): add deferred tool exposure for parent sessions
Steven Enamakeladba0dedc8cd
diff --git a/crates/openhuman-core/src/integrations/composio/action_tool.rs b/crates/openhuman-core/src/integrations/composio/action_tool.rsindex e56a600c04..797a652e0c 100644--- a/crates/openhuman-core/src/integrations/composio/action_tool.rs+++ b/crates/openhuman-core/src/integrations/composio/action_tool.rs@@ -12,6 +12,15 @@//! is deliberately excluded from `integrations_agent`'s tool list in that//! path so the model doesn't see two ways to call the same action.//!+//! A second constructor, [`ComposioActionTool::deferred`], builds the same+//! tool as a `ToolExposure::Deferred` registration for a parent session:+//! every action of every connected toolkit is synthesised beside the+//! delegation tools (`tools::orchestrator_tools`), stays off the wire, and+//! is found through the harness's `tool_search` bridge — so one clear action+//! ("send Alex a Slack message") is a search and a call, not a sub-agent+//! run. Those instances have no spawn-time config to anchor to and resolve+//! the live config through the core's read path instead.+//!//! Lifetime: these tools live for the duration of a single sub-agent//! spawn. Rather than baking a `ComposioClient` at construction time//! (which would silently bypass a mid-session@@ -53,7 +62,12 @@ pub struct ComposioActionTool {/// [`create_composio_client`] keeps dispatch in lockstep with the/// live config, matching/// [`super::tools::ComposioExecuteTool`]. See issue #1710.- config: Arc<Config>,+ ///+ /// `None` for a deferred instance synthesised for a parent session,+ /// which has no spawn-time config: it resolves the live config through+ /// [`config_rpc::load_config_with_timeout`] on every call — the+ /// embedder's config when one is bound, else the process-global one.+ config: Option<Arc<Config>>,/// Action slug as-shipped to Composio, e.g. `"GMAIL_SEND_EMAIL"`.action_name: String,/// Human-readable description from the Composio tool-list response.@@ -73,6 +87,12 @@ pub struct ComposioActionTool {/// executes normally. Held per tool instance, which lives for one/// `integrations_agent` spawn, so "seen" is scoped to that turn.gate: super::contract_gate::ContractGate,+ /// `Direct` for the sub-agent's spawn-time set, `Deferred` for the+ /// parent-session catalogue reached through `tool_search`.+ exposure: tinytools::ToolExposure,+ /// The toolkit slug (`gmail`, `slack`) for a deferred instance, so the+ /// search index can say where an action came from.+ family: Option<String>,}impl ComposioActionTool {@@ -91,6 +111,46 @@ impl ComposioActionTool {description: String,parameters: Option<Value>,connection_id: Option<String>,+ ) -> Self {+ Self::build(+ Some(config),+ action_name,+ description,+ parameters,+ connection_id,+ tinytools::ToolExposure::Direct,+ None,+ )+ }++ /// A `Deferred` instance for a parent session's searchable catalogue:+ /// off the wire, found through `tool_search`, resolving the live config+ /// per call. `toolkit` is the slug the action belongs to.+ pub fn deferred(+ toolkit: &str,+ action_name: String,+ description: String,+ parameters: Option<Value>,+ ) -> Self {+ Self::build(+ None,+ action_name,+ description,+ parameters,+ None,+ tinytools::ToolExposure::Deferred,+ Some(toolkit.to_string()),+ )+ }++ fn build(+ config: Option<Arc<Config>>,+ action_name: String,+ description: String,+ parameters: Option<Value>,+ connection_id: Option<String>,+ exposure: tinytools::ToolExposure,+ family: Option<String>,) -> Self {let parameters = parameters.unwrap_or_else(|| serde_json::json!({"type": "object"}));Self {@@ -100,6 +160,17 @@ impl ComposioActionTool {parameters,connection_id,gate: super::contract_gate::ContractGate::new(),+ exposure,+ family,+ }+ }++ /// The live config for one call: a reload anchored to the spawn-time+ /// snapshot when there is one, else the core's read path.+ async fn live_config(&self) -> Result<Config, String> {+ match self.config.as_deref() {+ Some(snapshot) => config_rpc::reload_config_snapshot_with_timeout(snapshot).await,+ None => config_rpc::load_config_with_timeout().await,}}}@@ -156,6 +227,14 @@ impl Tool for ComposioActionTool {ToolCategory::Workflow}+ fn exposure(&self) -> tinytools::ToolExposure {+ self.exposure+ }++ fn family(&self) -> Option<&str> {+ self.family.as_deref()+ }+fn display_label(&self, _args: &Value) -> Option<String> {// Composio slugs are UPPER_SNAKE (e.g. `GMAIL_SEND_EMAIL`). Render a// sentence-cased phrase ("Gmail send email") instead of the shouty@@ -204,8 +283,7 @@ impl Tool for ComposioActionTool {// fresh routing. Anchored to this tool's original config path rather than// re-resolving process-global `OPENHUMAN_WORKSPACE` (the tool is scoped to// the user/workspace it was created for).- let live_config =- match config_rpc::reload_config_snapshot_with_timeout(self.config.as_ref()).await {+ let live_config = match self.live_config().await {Ok(c) => c,Err(e) => {tracing::warn!(