Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(composio): add execute dispatch for composio tools

Steven Enamakel1f31b932c703
diff --git a/crates/openhuman-core/src/integrations/composio/execute_dispatch.rs b/crates/openhuman-core/src/integrations/composio/execute_dispatch.rs
index 5a0826ba7b..20e4b28173 100644
--- a/crates/openhuman-core/src/integrations/composio/execute_dispatch.rs
+++ b/crates/openhuman-core/src/integrations/composio/execute_dispatch.rs
@@ -7,6 +7,7 @@
//! external-transfer disclosure, applied once before the call.
use crate::config::Config;
+use crate::security::approval::ApprovalChatContext;
use crate::security::egress::{emit_external_transfer, enforce_egress, EgressDescriptor};
use super::module_client::{self};
@@ -22,6 +23,7 @@ use tinyconnectors_bus::names::methods;
/// refusal is `Ok` with `successful: false`.
pub async fn execute_composio_action(
config: &Config,
+ chat: Option<&ApprovalChatContext>,
tool: &str,
arguments: Option<serde_json::Value>,
connection_id: Option<&str>,
@@ -37,7 +39,7 @@ pub async fn execute_composio_action(
tracing::debug!(tool = %tool, "[composio][dispatch] local-only egress block");
return Err(e.to_string());
}
- emit_external_transfer(egress);
+ emit_external_transfer(chat, egress);
// Resolve the mode-aware route on the host first: a module configured
// without a route answers with an opaque "no connector route" error, so a
diff --git a/crates/openhuman-core/src/integrations/composio/tools/execute.rs b/crates/openhuman-core/src/integrations/composio/tools/execute.rs
index 98e141a562..5f42c5888c 100644
--- a/crates/openhuman-core/src/integrations/composio/tools/execute.rs
+++ b/crates/openhuman-core/src/integrations/composio/tools/execute.rs
@@ -101,7 +101,7 @@ impl Tool for ComposioExecuteTool {
ToolCategory::Workflow
}
async fn execute(&self, args: Value) -> anyhow::Result<ToolResult> {
- let (config, outcome) = Box::pin(self.execute_unredacted(args, None, None)).await;
+ let (config, outcome) = Box::pin(self.execute_unredacted(args, None, None, None)).await;
redact_composio_outcome(&config, outcome)
}
async fn execute_with_context(
@@ -114,6 +114,9 @@ impl Tool for ComposioExecuteTool {
args,
sandbox_mode_for_tool(context),
task_recency_window_for_tool(context),
+ crate::agent::tinyagents::host::run_context::approval_for_tool(context)
+ .chat
+ .as_ref(),
))
.await;
redact_composio_outcome(&config, outcome)
@@ -307,6 +310,7 @@ impl ComposioExecuteTool {
// (#1710, #1797)).
let res = super::super::execute_dispatch::execute_composio_action(
&live_config,
+ chat,
&tool,
arguments,
None,
diff --git a/crates/openhuman-core/src/tools/schemas/composio.rs b/crates/openhuman-core/src/tools/schemas/composio.rs
index 1c3c2f56d0..1877237f3c 100644
--- a/crates/openhuman-core/src/tools/schemas/composio.rs
+++ b/crates/openhuman-core/src/tools/schemas/composio.rs
@@ -20,6 +20,8 @@ pub(super) fn handle_composio_execute(params: Map<String, Value>) -> ControllerF
// user's personal direct tenant, #1710); this only supplies the config.
let resp = crate::integrations::composio::execute_dispatch::execute_composio_action(
&config,
+ // An RPC call is not a chat turn: no chat to route the disclosure to.
+ None,
&action,
action_args,
None,