Skip to content

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

feat(embed): give each agent its own Composio credential

oxoxDev85b0b0c8ec9e
diff --git a/crates/openhuman-embed/src/agent/build.rs b/crates/openhuman-embed/src/agent/build.rs
index 1d57aa8868..277d995647 100644
--- a/crates/openhuman-embed/src/agent/build.rs
+++ b/crates/openhuman-embed/src/agent/build.rs
@@ -1,8 +1,8 @@
//! Turning an [`AgentSpec`] into an [`AgentInner`] on a [`Runtime`].
//!
//! Order matters and is fixed here: validate the id, lay out directories,
-//! assemble the per-agent `Config` (base → access → provider → MCP → escape
-//! hatch), build the definition, copy skills, check the
+//! assemble the per-agent `Config` (base → access → provider → MCP →
+//! Composio → escape hatch), build the definition, copy skills, check the
//! narrowing rules, derive the context.
use std::path::Path;
@@ -71,6 +71,11 @@ pub(crate) fn instantiate(runtime: &Runtime, spec: AgentSpec) -> Result<AgentInn
);
}
+ if let Some(credential) = parts.composio {
+ log::debug!("[embed][agent] id={id} pins its own composio credential");
+ config.composio.pin_host_credential(credential);
+ }
+
if let Some(f) = parts.config_fn {
f(&mut config);
// Every agent shares the runtime's credential store and keyring; a
diff --git a/crates/openhuman-embed/src/agent/spec.rs b/crates/openhuman-embed/src/agent/spec.rs
index 8542135722..c694d61d19 100644
--- a/crates/openhuman-embed/src/agent/spec.rs
+++ b/crates/openhuman-embed/src/agent/spec.rs
@@ -3,12 +3,13 @@
//! An [`AgentSpec`] is pure data: it is applied by
//! [`Runtime::agent`](crate::Runtime::agent), in a fixed order, onto a clone
//! of the runtime's base config — access tier, provider model, MCP servers,
-//! then the [`config`](AgentSpec::config) escape hatch last — and onto a
+//! Composio credential, then the [`config`](AgentSpec::config) escape hatch
+//! last — and onto a
//! [`AgentDefinitionSpec`].
use std::path::PathBuf;
-use openhuman_core::config::Config;
+use openhuman_core::config::{ComposioHostCredential, Config};
use openhuman_core::core::runtime::DomainSet;
use openhuman_core::security::TrustedAccess;
use openhuman_core::tools::toolpacks::ToolGroups;
@@ -47,6 +48,7 @@ pub struct AgentSpec {
include_user_skills: bool,
action_dir: Option<PathBuf>,
trusted: Vec<(String, TrustedAccess)>,
+ composio: Option<ComposioHostCredential>,
config_fn: Option<ConfigEdit>,
host_tools: Option<openhuman_core::agent::HostTools>,
}
@@ -76,6 +78,7 @@ impl AgentSpec {
include_user_skills: false,
action_dir: None,
trusted: Vec::new(),
+ composio: None,
config_fn: None,
host_tools: None,
}
@@ -188,6 +191,17 @@ impl AgentSpec {
self
}
+ /// This agent's own Composio credential.
+ ///
+ /// The built-in Composio tools then call Composio with this key and
+ /// entity only: never the runtime's stored Composio key, and never
+ /// another agent's. Connected-integration caches are partitioned by it.
+ #[must_use]
+ pub fn composio(mut self, credential: ComposioHostCredential) -> Self {
+ self.composio = Some(credential);
+ self
+ }
+
/// Arbitrary edits to the agent's config, applied last.
///
/// The escape hatch for the config fields the spec does not model — not
@@ -289,6 +303,7 @@ impl AgentSpec {
include_user_skills: self.include_user_skills,
action_dir: self.action_dir,
trusted: self.trusted,
+ composio: self.composio,
config_fn: self.config_fn,
host_tools: self.host_tools,
}
@@ -312,6 +327,7 @@ pub(crate) struct AgentSpecParts {
pub(crate) include_user_skills: bool,
pub(crate) action_dir: Option<PathBuf>,
pub(crate) trusted: Vec<(String, TrustedAccess)>,
+ pub(crate) composio: Option<ComposioHostCredential>,
pub(crate) config_fn: Option<ConfigEdit>,
pub(crate) host_tools: Option<openhuman_core::agent::HostTools>,
}
@@ -323,6 +339,7 @@ impl std::fmt::Debug for AgentSpec {
.field("id", &self.id)
.field("access", &self.access)
.field("action_dir", &self.action_dir)
+ .field("composio", &self.composio)
.finish_non_exhaustive()
}
}
diff --git a/crates/openhuman-embed/src/agent/spec_tests.rs b/crates/openhuman-embed/src/agent/spec_tests.rs
index 76e31ab233..cc5005f658 100644
--- a/crates/openhuman-embed/src/agent/spec_tests.rs
+++ b/crates/openhuman-embed/src/agent/spec_tests.rs
@@ -45,3 +45,16 @@ fn tool_groups_may_only_narrow_the_runtime() {
let err = check_tool_groups_narrow(&widened, &runtime).expect_err("widens");
assert!(matches!(err, AgentError::WidensRuntime(_)), "{err:?}");
}
+
+#[test]
+fn composio_credential_is_carried_to_the_build_step_and_kept_out_of_debug() {
+ use openhuman_core::config::ComposioHostCredential;
+ let spec = AgentSpec::new("alpha")
+ .composio(ComposioHostCredential::direct("ck_secret_alpha").entity_id("tenant-a"));
+ let debug = format!("{spec:?}");
+ assert!(!debug.contains("ck_secret_alpha"), "{debug}");
+ let parts = spec.into_parts();
+ let credential = parts.composio.expect("composio credential");
+ assert_eq!(credential.api_key(), "ck_secret_alpha");
+ assert_eq!(credential.entity(), "tenant-a");
+}
diff --git a/crates/openhuman-embed/src/lib.rs b/crates/openhuman-embed/src/lib.rs
index 480b140069..4f922b220c 100644
--- a/crates/openhuman-embed/src/lib.rs
+++ b/crates/openhuman-embed/src/lib.rs
@@ -64,6 +64,7 @@ pub use openhuman_core::api::transport::{
BackendTransportError, TransportProfile,
};
pub use openhuman_core::api::{product_identity, set_product_identity, ProductIdentity};
+pub use openhuman_core::config::ComposioHostCredential;
pub use openhuman_core::config::Config as RuntimeConfig;
pub use openhuman_core::security::TrustedAccess;
pub use openhuman_core::tools::toolpacks::{GroupMode, ToolGroups};