Skip to content

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

feat(composio): add connected integrations module

Steven Enamakel6ab2afd61c9c
diff --git a/crates/openhuman-core/src/integrations/composio/connected_integrations.rs b/crates/openhuman-core/src/integrations/composio/connected_integrations.rs
index 164e8f5933..852ca020a6 100644
--- a/crates/openhuman-core/src/integrations/composio/connected_integrations.rs
+++ b/crates/openhuman-core/src/integrations/composio/connected_integrations.rs
@@ -22,7 +22,7 @@ pub use cache::{
invalidate_connected_integrations_cache,
};
pub use fetch::{
- fetch_connected_integrations, fetch_connected_integrations_status, fetch_toolkit_actions,
+ fetch_connected_integrations, fetch_connected_integrations_status,
FetchConnectedIntegrationsStatus,
};
diff --git a/crates/openhuman-core/src/integrations/composio/connected_integrations/fetch.rs b/crates/openhuman-core/src/integrations/composio/connected_integrations/fetch.rs
index f0be3477fd..c5e62b49f2 100644
--- a/crates/openhuman-core/src/integrations/composio/connected_integrations/fetch.rs
+++ b/crates/openhuman-core/src/integrations/composio/connected_integrations/fetch.rs
@@ -1,8 +1,7 @@
//! The public fetch surface for connected integrations:
//! [`fetch_connected_integrations`] / [`fetch_connected_integrations_status`]
//! (cache-fronted, calling [`super::fetch_uncached::fetch_connected_integrations_uncached`]
-//! on a miss) and the just-in-time [`fetch_toolkit_actions`], plus their
-//! small toolkit-membership/description helpers.
+//! on a miss), plus their small toolkit-membership/description helpers.
use std::sync::atomic::Ordering;
use std::time::Instant;
@@ -190,73 +189,3 @@ pub(crate) fn resolve_toolkit_description(
crate::integrations::composio::providers::toolkit_description(slug).to_string()
})
}
-
-/// Just-in-time fetch of every available action for a single Composio
-/// toolkit, returned in the [`ConnectedIntegrationTool`] shape the
-/// `integrations_agent` spawn path expects.
-///
-/// Unlike [`fetch_connected_integrations`] (which bulk-fetches every
-/// connected toolkit's tools once per session and caches the result),
-/// this helper is uncached and scoped to a single toolkit — meant to
-/// be called at `integrations_agent` spawn time so the sub-agent's
-/// prompt always reflects the toolkit's current action catalogue.
-///
-/// The filter `starts_with("{TOOLKIT}_")` matches
-/// `fetch_connected_integrations_uncached`'s own namespacing rule so
-/// siblings like `github` / `git` don't leak into each other's buckets.
-///
-/// `tags` narrows the result by Composio action tag (OR semantics). Only
-/// honoured for the GitHub toolkit; passed through to `list_tools` so the
-/// backend can skip the repo-list force-include and return a focused set.
-///
-/// Returns an empty vec when the backend has no actions for the
-/// toolkit (valid steady state for a freshly-authorised integration
-/// whose catalogue hasn't been published yet). Returns `Err` only for
-/// transport / auth failures the caller should surface to the user.
-pub async fn fetch_toolkit_actions(
- config: &Config,
- client: &ComposioClient,
- toolkit: &str,
- tags: Option<&[String]>,
-) -> anyhow::Result<Vec<ConnectedIntegrationTool>> {
- let toolkit_slug = toolkit.trim();
- if toolkit_slug.is_empty() {
- anyhow::bail!("fetch_toolkit_actions: toolkit must not be empty");
- }
- let effective_tags = if should_forward_tags(Some(&[toolkit_slug.to_string()])) {
- tags
- } else {
- None
- };
- tracing::debug!(toolkit = %toolkit_slug, ?effective_tags, "[composio] fetch_toolkit_actions");
- let resp = client
- .list_tools(Some(&[toolkit_slug.to_string()]), effective_tags)
- .await
- .map_err(|e| anyhow::anyhow!("list_tools failed for toolkit `{toolkit_slug}`: {e}"))?;
- let action_prefix = format!("{}_", toolkit_slug.to_uppercase());
- // Apply curated whitelist + user scope so spawn-time tool
- // discovery agrees with the bulk path and the meta-tool layer.
- let pref = crate::integrations::composio::ops::load_user_scope_pref(config, toolkit_slug).await;
- let actions: Vec<ConnectedIntegrationTool> = resp
- .tools
- .into_iter()
- .filter(|t| t.function.name.starts_with(&action_prefix))
- .filter(|t| {
- crate::integrations::composio::providers::is_action_visible_with_pref(
- &t.function.name,
- &pref,
- )
- })
- .map(|t| ConnectedIntegrationTool {
- name: t.function.name,
- description: t.function.description.unwrap_or_default(),
- parameters: t.function.parameters,
- })
- .collect();
- tracing::debug!(
- toolkit = %toolkit_slug,
- action_count = actions.len(),
- "[composio] fetch_toolkit_actions: done"
- );
- Ok(actions)
-}
diff --git a/crates/openhuman-core/src/integrations/composio/mod.rs b/crates/openhuman-core/src/integrations/composio/mod.rs
index fcae10903b..c2b404615d 100644
--- a/crates/openhuman-core/src/integrations/composio/mod.rs
+++ b/crates/openhuman-core/src/integrations/composio/mod.rs
@@ -72,7 +72,7 @@ pub use client::ComposioClient;
pub use identity::connection_identity;
pub use ops::{
cached_active_integrations, cached_active_integrations_including_expired, connected_set_hash,
- fetch_connected_integrations, fetch_connected_integrations_status, fetch_toolkit_actions,
+ fetch_connected_integrations, fetch_connected_integrations_status,
invalidate_connected_integrations_cache, FetchConnectedIntegrationsStatus,
};
pub use periodic::{record_sync_success, start_periodic_sync};
diff --git a/crates/openhuman-core/src/integrations/composio/ops/mod.rs b/crates/openhuman-core/src/integrations/composio/ops/mod.rs
index 1ede599a4a..fc727a2702 100644
--- a/crates/openhuman-core/src/integrations/composio/ops/mod.rs
+++ b/crates/openhuman-core/src/integrations/composio/ops/mod.rs
@@ -83,7 +83,7 @@ pub(crate) use user_scopes::{
pub use super::connected_integrations::{
cached_active_integrations, cached_active_integrations_including_expired, connected_set_hash,
- fetch_connected_integrations, fetch_connected_integrations_status, fetch_toolkit_actions,
+ fetch_connected_integrations, fetch_connected_integrations_status,
invalidate_connected_integrations_cache, FetchConnectedIntegrationsStatus,
};