Skip to content

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

fix(composio): correct tool schema field name for composio integration

Steven Enamakel90836d335aea
diff --git a/crates/openhuman-core/src/agent/learning/linkedin_enrichment/gmail_discovery.rs b/crates/openhuman-core/src/agent/learning/linkedin_enrichment/gmail_discovery.rs
index 4190ffb207..cfc4925034 100644
--- a/crates/openhuman-core/src/agent/learning/linkedin_enrichment/gmail_discovery.rs
+++ b/crates/openhuman-core/src/agent/learning/linkedin_enrichment/gmail_discovery.rs
@@ -17,22 +17,9 @@ use super::{canonical_linkedin_url, LINKEDIN_SCRAPER_ACTOR, LINKEDIN_USERNAME_RE
/// `payload.parts[].body.data`. We must decode those parts before
/// regex-matching; searching the raw JSON alone misses them.
pub(super) async fn search_gmail_for_linkedin(config: &Config) -> anyhow::Result<Option<String>> {
- use crate::integrations::composio::client::{
- create_composio_client, direct_execute, ComposioClientKind,
- };
use base64::engine::general_purpose::URL_SAFE_NO_PAD;
use base64::Engine;
- // Resolve through the mode-aware factory so a direct-mode user
- // with a stored API key can still drive Gmail enrichment from the
- // personal Composio tenant (#1710 Wave 2). Pre-fix this path used
- // `build_composio_client` and returned early for any user without
- // a backend session, silently disabling LinkedIn enrichment for
- // direct-mode users even when their LinkedIn/Gmail connections
- // were healthy on app.composio.dev.
- let client_kind = create_composio_client(config)
- .map_err(|e| anyhow::anyhow!("composio client unavailable: {e}"))?;
-
// `comm/in/<username>` — LinkedIn's own notification emails always use
// this form to refer to the email *recipient's* profile.
static COMM_RE: LazyLock<Regex> =
@@ -42,26 +29,17 @@ pub(super) async fn search_gmail_for_linkedin(config: &Config) -> anyhow::Result
"query": "from:linkedin.com",
"max_results": 10,
});
- let resp = match &client_kind {
- ComposioClientKind::Backend(client) => client
- .execute_tool("GMAIL_FETCH_EMAILS", Some(args))
- .await
- .map_err(|e| anyhow::anyhow!("GMAIL_FETCH_EMAILS failed: {e:#}"))?,
- ComposioClientKind::Direct(direct) => {
- tracing::debug!(
- "[linkedin_enrichment][composio-direct] GMAIL_FETCH_EMAILS via direct tenant"
- );
- direct_execute(
- direct,
- "GMAIL_FETCH_EMAILS",
- Some(args),
- &config.composio.entity_id,
- None,
- )
- .await
- .map_err(|e| anyhow::anyhow!("GMAIL_FETCH_EMAILS (direct) failed: {e:#}"))?
- }
- };
+ // The connector module owns the backend/direct split (#1710 Wave 2), so a
+ // direct-mode user with a stored key still drives enrichment from their
+ // personal tenant.
+ let resp = crate::integrations::composio::execute_dispatch::execute_composio_action(
+ config,
+ "GMAIL_FETCH_EMAILS",
+ Some(args),
+ None,
+ )
+ .await
+ .map_err(|e| anyhow::anyhow!("GMAIL_FETCH_EMAILS failed: {e}"))?;
if !resp.successful {
let err = resp.error.unwrap_or_else(|| "unknown error".into());
diff --git a/crates/openhuman-core/src/integrations/composio/catalog/probe.rs b/crates/openhuman-core/src/integrations/composio/catalog/probe.rs
index f0246558c2..ab934380ec 100644
--- a/crates/openhuman-core/src/integrations/composio/catalog/probe.rs
+++ b/crates/openhuman-core/src/integrations/composio/catalog/probe.rs
@@ -10,9 +10,6 @@ use serde_json::Value;
use super::contract::COMPOSIO_CATALOG_CACHE_TTL;
use super::contract::{CacheEntry, ToolContract};
use crate::config::Config;
-use crate::integrations::composio::client::{
- create_composio_client, direct_execute, ComposioClientKind,
-};
use crate::json_schema::compute_primary_array_path_from_value;
// ─────────────────────────────────────────────────────────────────────────────
@@ -311,19 +308,12 @@ pub(crate) async fn probe_tool_output_sample(
"[flows] get_tool_output_sample: probing the real live response (read-only, bounded, one call)"
);
- let kind = create_composio_client(config).map_err(|e| e.to_string())?;
let args_opt = if args.is_null() { None } else { Some(args) };
- let resp = match kind {
- ComposioClientKind::Backend(client) => client
- .execute_tool(slug, args_opt)
- .await
- .map_err(|e| format!("get_tool_output_sample: real call to `{slug}` failed: {e}"))?,
- ComposioClientKind::Direct(tool) => {
- direct_execute(&tool, slug, args_opt, &config.composio.entity_id, None)
- .await
- .map_err(|e| format!("get_tool_output_sample: real call to `{slug}` failed: {e}"))?
- }
- };
+ let resp = crate::integrations::composio::execute_dispatch::execute_composio_action(
+ config, slug, args_opt, None,
+ )
+ .await
+ .map_err(|e| format!("get_tool_output_sample: real call to `{slug}` failed: {e}"))?;
if !resp.successful {
let detail = resp
diff --git a/crates/openhuman-core/src/modules/memory_host.rs b/crates/openhuman-core/src/modules/memory_host.rs
index 197d5e23c1..bdba8f38dc 100644
--- a/crates/openhuman-core/src/modules/memory_host.rs
+++ b/crates/openhuman-core/src/modules/memory_host.rs
@@ -231,25 +231,18 @@ impl ComposioCallbacks {
entity_id: String,
connection_id: Option<String>,
) -> tinybus::Result<ComposioExecuteResponse> {
- use crate::integrations::composio::client::{
- create_composio_client, direct_execute, ComposioClientKind,
- };
let config = self.live_config().await.map_err(method_error)?;
- match create_composio_client(&config).map_err(|e| method_error(format!("{e:#}")))? {
- ComposioClientKind::Backend(client) => client
- .execute_tool(&tool, arguments)
- .await
- .map_err(|e| method_error(format!("{e:#}"))),
- ComposioClientKind::Direct(direct) => direct_execute(
- &direct,
- &tool,
- arguments,
- &entity_id,
- connection_id.as_deref(),
- )
- .await
- .map_err(|e| method_error(format!("{e:#}"))),
- }
+ // `entity_id` is the direct route's; the connector module reads it from
+ // its own configuration, which `module_config` derives from `config`.
+ let _ = entity_id;
+ crate::integrations::composio::execute_dispatch::execute_composio_action(
+ &config,
+ &tool,
+ arguments,
+ connection_id.as_deref(),
+ )
+ .await
+ .map_err(method_error)
}
/// The direct-mode Composio API key, or `None` when direct mode is unset.
diff --git a/crates/openhuman-core/src/tools/schemas/composio.rs b/crates/openhuman-core/src/tools/schemas/composio.rs
index 2e853dcd25..bd40b45e5d 100644
--- a/crates/openhuman-core/src/tools/schemas/composio.rs
+++ b/crates/openhuman-core/src/tools/schemas/composio.rs
@@ -23,32 +23,6 @@ pub(super) fn handle_composio_execute(params: Map<String, Value>) -> ControllerF
)
.await
.map_err(|e| format!("composio execute failed: {e}"))?;
- tracing::debug!(
- action = %action,
- mode = %config.composio.mode,
- "[tools][composio_execute] executing action"
- );
- let resp = match kind {
- ComposioClientKind::Backend(client) => {
- tracing::debug!(action = %action, "[tools][composio_execute] branch=backend");
- client
- .execute_tool(&action, action_args)
- .await
- .map_err(|e| format!("composio execute_tool (backend) failed: {e:#}"))?
- }
- ComposioClientKind::Direct(direct) => {
- tracing::debug!(action = %action, "[tools][composio_execute] branch=direct");
- direct_execute(
- &direct,
- &action,
- action_args,
- &config.composio.entity_id,
- None,
- )
- .await
- .map_err(|e| format!("composio execute_tool (direct) failed: {e:#}"))?
- }
- };
tracing::debug!(
action = %action,
successful = resp.successful,