Skip to content

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

feat(config): add composio disabled mode and env override

Steven Enamakel94c8e440e2d3
diff --git a/crates/openhuman-core/src/config/schema/load/env_overlay.rs b/crates/openhuman-core/src/config/schema/load/env_overlay.rs
index 92cd30874c..91ff60de30 100644
--- a/crates/openhuman-core/src/config/schema/load/env_overlay.rs
+++ b/crates/openhuman-core/src/config/schema/load/env_overlay.rs
@@ -105,6 +105,16 @@ impl Config {
}
}
+ // One-launch override of `composio.mode`: `backend | direct | disabled`.
+ // The factory rejects an unknown spelling loudly, so no validation here.
+ if let Some(raw) = env.get("OPENHUMAN_COMPOSIO_MODE") {
+ let trimmed = raw.trim();
+ if !trimmed.is_empty() {
+ tracing::debug!(mode = trimmed, "OPENHUMAN_COMPOSIO_MODE overrides composio.mode");
+ self.composio.mode = trimmed.to_ascii_lowercase();
+ }
+ }
+
// One-launch override of how the Jev tool ranker is reached
// (`agent.tool_search.jev_route`): `auto | tinyhumans | typesafe |
// openrouter`. The ranker validates the spelling and falls back to
diff --git a/crates/openhuman-core/src/config/schema/load_env_overlay_tests.rs b/crates/openhuman-core/src/config/schema/load_env_overlay_tests.rs
index 6752330e10..77b65fc29f 100644
--- a/crates/openhuman-core/src/config/schema/load_env_overlay_tests.rs
+++ b/crates/openhuman-core/src/config/schema/load_env_overlay_tests.rs
@@ -605,6 +605,16 @@ fn env_overlay_tool_dispatcher_overrides_the_agent_field_when_non_blank() {
assert_eq!(cfg.agent.tool_dispatcher, "native");
}
+#[test]
+fn env_overlay_composio_mode_overrides_when_non_blank() {
+ let mut cfg = Config::default();
+ assert_eq!(cfg.composio.mode, "backend");
+ cfg.apply_env_overlay_with(&HashMapEnv::new().with("OPENHUMAN_COMPOSIO_MODE", " Disabled "));
+ assert_eq!(cfg.composio.mode, "disabled");
+ cfg.apply_env_overlay_with(&HashMapEnv::new().with("OPENHUMAN_COMPOSIO_MODE", " "));
+ assert_eq!(cfg.composio.mode, "disabled");
+}
+
#[test]
fn env_overlay_jev_route_and_base_url_override_tool_search_when_non_blank() {
let mut cfg = Config::default();
diff --git a/crates/openhuman-core/src/config/schema/mod.rs b/crates/openhuman-core/src/config/schema/mod.rs
index b6ef56e4cc..c2b4a819f0 100644
--- a/crates/openhuman-core/src/config/schema/mod.rs
+++ b/crates/openhuman-core/src/config/schema/mod.rs
@@ -125,7 +125,7 @@ pub use tools::{
McpClientIdentityConfig, McpServerConfig, McpToolExposure, MultimodalConfig,
MultimodalFileConfig, SearchConfig, SearchEngineCredentials, SearchPresentation,
SearchProviderSettings, SearchRoute, SearxngConfig, SecretsConfig, SeltzConfig,
- WebSearchConfig, COMPOSIO_MODE_BACKEND, COMPOSIO_MODE_DIRECT, MANAGED_SEARCH_PROVIDERS,
+ WebSearchConfig, COMPOSIO_MODE_BACKEND, COMPOSIO_MODE_DIRECT, COMPOSIO_MODE_DISABLED, MANAGED_SEARCH_PROVIDERS,
SEARCH_ENGINE_BRAVE, SEARCH_ENGINE_DISABLED, SEARCH_ENGINE_EXA, SEARCH_ENGINE_MANAGED,
SEARCH_ENGINE_PARALLEL, SEARCH_ENGINE_QUERIT, SEARCH_ENGINE_TAVILY, SEARCH_PROVIDERS,
SEARCH_ROLES, SEARCH_ROLE_ANSWER, SEARCH_ROLE_CONTENTS, SEARCH_ROLE_SEARCH,
diff --git a/crates/openhuman-core/src/config/schema/tools/integrations.rs b/crates/openhuman-core/src/config/schema/tools/integrations.rs
index 047b1eb0fd..21a3238bd9 100644
--- a/crates/openhuman-core/src/config/schema/tools/integrations.rs
+++ b/crates/openhuman-core/src/config/schema/tools/integrations.rs
@@ -21,6 +21,10 @@ use serde::{Deserialize, Serialize};
/// sink. See `composio/tools/direct.rs` for the underlying client.
pub const COMPOSIO_MODE_BACKEND: &str = "backend";
pub const COMPOSIO_MODE_DIRECT: &str = "direct";
+/// Composio off: no client, no agent tools, and no hosted `list_toolkits` /
+/// connections round trip on the first turn. For headless and benchmark hosts
+/// that have no Composio account (or no backend) to ask.
+pub const COMPOSIO_MODE_DISABLED: &str = "disabled";
fn default_composio_mode() -> String {
COMPOSIO_MODE_BACKEND.into()
@@ -48,7 +52,8 @@ pub struct ComposioConfig {
/// Routing mode for the main Composio integration flow. One of
/// [`COMPOSIO_MODE_BACKEND`] (default — proxied through the OpenHuman
/// backend) or [`COMPOSIO_MODE_DIRECT`] (BYO API key, calls
- /// `backend.composio.dev` directly).
+ /// `backend.composio.dev` directly) or [`COMPOSIO_MODE_DISABLED`] (off).
+ /// `OPENHUMAN_COMPOSIO_MODE` overrides it for one launch.
///
/// The user-provided API key for direct mode is *not* stored in the
/// TOML — it lives in the encrypted keychain via
diff --git a/crates/openhuman-core/src/config/schema/tools/mod.rs b/crates/openhuman-core/src/config/schema/tools/mod.rs
index 819d69ee59..971c1590d3 100644
--- a/crates/openhuman-core/src/config/schema/tools/mod.rs
+++ b/crates/openhuman-core/src/config/schema/tools/mod.rs
@@ -11,7 +11,7 @@ pub use browser::{BrowserComputerUseConfig, BrowserConfig};
pub use http::{CurlConfig, HttpRequestConfig};
pub use integrations::{
ComposioConfig, ComposioDirectBaseUrls, ComposioHostCredential, IntegrationToggle,
- IntegrationsConfig, SecretsConfig, COMPOSIO_MODE_BACKEND, COMPOSIO_MODE_DIRECT,
+ IntegrationsConfig, SecretsConfig, COMPOSIO_MODE_BACKEND, COMPOSIO_MODE_DIRECT, COMPOSIO_MODE_DISABLED,
};
pub use mcp::{
GitbooksConfig, HttpHeader, McpAuthConfig, McpClientConfig, McpClientIdentityConfig,
diff --git a/crates/openhuman-core/src/integrations/composio/client/factory.rs b/crates/openhuman-core/src/integrations/composio/client/factory.rs
index f57d6b5cc8..c2259d875e 100644
--- a/crates/openhuman-core/src/integrations/composio/client/factory.rs
+++ b/crates/openhuman-core/src/integrations/composio/client/factory.rs
@@ -26,6 +26,7 @@ use crate::config::schema::{COMPOSIO_MODE_BACKEND, COMPOSIO_MODE_DIRECT};
// without the "unreachable pattern" warning chain.
const MODE_BACKEND_PAT: &str = COMPOSIO_MODE_BACKEND;
const MODE_DIRECT_PAT: &str = COMPOSIO_MODE_DIRECT;
+const MODE_DISABLED_PAT: &str = crate::config::schema::COMPOSIO_MODE_DISABLED;
/// The route [`resolve_composio_route`] selected.
///
@@ -99,6 +100,8 @@ fn direct_client(
/// stored key takes precedence so the encrypted keychain remains the
/// source of truth — `config.toml` is a fallback for power users.
///
+/// - `"disabled"` — Composio is off; always `Err`, so no tools register.
+///
/// A host-pinned credential (`config.composio.host_credential`) takes
/// precedence over both the mode and the credential store.
///
@@ -156,10 +159,14 @@ pub fn resolve_composio_route(config: &crate::config::Config) -> anyhow::Result<
);
Ok(ComposioRoute::Direct(client))
}
+ MODE_DISABLED_PAT => {
+ tracing::debug!("[composio-factory] composio disabled by config");
+ Err(anyhow::anyhow!("composio is disabled (composio.mode = \"disabled\")"))
+ }
unknown => {
tracing::warn!(mode = %unknown, "[composio-factory] unknown composio mode");
Err(anyhow::anyhow!(
- "unknown composio mode: \"{unknown}\". Supported: \"backend\", \"direct\""
+ "unknown composio mode: \"{unknown}\". Supported: \"backend\", \"direct\", \"disabled\""
))
}
}
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 9bca9a3369..bf8d417678 100644
--- a/crates/openhuman-core/src/integrations/composio/connected_integrations/fetch.rs
+++ b/crates/openhuman-core/src/integrations/composio/connected_integrations/fetch.rs
@@ -64,6 +64,11 @@ pub enum FetchConnectedIntegrationsStatus {
pub async fn fetch_connected_integrations_status(
config: &Config,
) -> FetchConnectedIntegrationsStatus {
+ // Composio switched off: nothing to ask. An authoritative empty set also
+ // keeps the first turn from awaiting a hosted round trip.
+ if config.composio.mode.trim() == crate::config::schema::COMPOSIO_MODE_DISABLED {
+ return FetchConnectedIntegrationsStatus::Authoritative(Vec::new());
+ }
// The offline local token is a core identity, never a TinyHumans backend
// credential. Asking the hosted integrations endpoint with it yields 401,
// can race the scheduler gate into signed-out state, and cannot discover a