Skip to content

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

feat(config): add inbound config schema

Steven Enamakel52965b00d296
diff --git a/crates/openhuman-core/src/config/schema/inbound.rs b/crates/openhuman-core/src/config/schema/inbound.rs
new file mode 100644
index 0000000000..00d9d3c3b9
--- /dev/null
+++ b/crates/openhuman-core/src/config/schema/inbound.rs
@@ -0,0 +1,65 @@
+//! `[inbound]` — inbound event queues (the `tinyeventqueues` module).
+//!
+//! Composio triggers and agent webhooks are ingested into the module, which
+//! persists them on the host's storage, rejects redeliveries, filters and
+//! paces them, and calls the host back to run triage (`Deliver`) — retrying a
+//! deferred triage at the time it asked for instead of dropping it.
+//!
+//! The component switch is `[components] eventqueues`; `enabled` here turns
+//! the routing off while leaving the component on. With either off — or with
+//! the module unavailable on this host — events take the direct triage path.
+//!
+//! | setting | meaning |
+//! | --- | --- |
+//! | `enabled` | route inbound events through the queues |
+//! | `queues_path` | a `queues.json` replacing the shipped one |
+//! | `pipeline_path` | a `pipeline.json` replacing the shipped one |
+//! | `queue_url` | where the queues live: `storage` (default) or a broker URL |
+//! | `triage_timeout_ms` | how long one delivered event's triage may take |
+
+use std::path::PathBuf;
+
+use schemars::JsonSchema;
+use serde::{Deserialize, Serialize};
+
+/// Default bound on one delivered event's triage: below the module's shortest
+/// lane lease (two minutes), so a slow triage retries rather than racing a
+/// redelivery of the same turn.
+pub const DEFAULT_TRIAGE_TIMEOUT_MS: u64 = 90_000;
+
+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
+#[serde(default)]
+pub struct InboundConfig {
+ /// Route Composio triggers and agent webhooks through the inbound event
+ /// queues. Off, they take the direct triage path.
+ pub enabled: bool,
+ /// A `queues.json` (a storage `QueueManifest`) replacing the shipped one.
+ /// The host declares exactly these queues on the module's scope.
+ pub queues_path: Option<PathBuf>,
+ /// A `pipeline.json` replacing the shipped one: gate, coalescing,
+ /// salience, lanes, cadences and retry tuning.
+ pub pipeline_path: Option<PathBuf>,
+ /// Where the queues live: unset or `storage` keeps them in the module's
+ /// storage scope; `amqp://` / `amqps://` selects a `RabbitMQ` broker
+ /// (only in builds with the storage `rabbitmq` driver). Never logged.
+ pub queue_url: Option<String>,
+ /// How long one delivered event's triage may take, in milliseconds,
+ /// before the delivery is retried.
+ pub triage_timeout_ms: u64,
+}
+
+impl Default for InboundConfig {
+ fn default() -> Self {
+ Self {
+ enabled: true,
+ queues_path: None,
+ pipeline_path: None,
+ queue_url: None,
+ triage_timeout_ms: DEFAULT_TRIAGE_TIMEOUT_MS,
+ }
+ }
+}
+
+#[cfg(test)]
+#[path = "inbound_tests.rs"]
+mod tests;
diff --git a/crates/openhuman-core/src/config/schema/inbound_tests.rs b/crates/openhuman-core/src/config/schema/inbound_tests.rs
new file mode 100644
index 0000000000..9c8fe207e4
--- /dev/null
+++ b/crates/openhuman-core/src/config/schema/inbound_tests.rs
@@ -0,0 +1,20 @@
+use super::*;
+
+#[test]
+fn defaults_route_through_the_shipped_queues_in_storage() {
+ let c = InboundConfig::default();
+ assert!(c.enabled);
+ assert_eq!(c.queues_path, None);
+ assert_eq!(c.pipeline_path, None);
+ assert_eq!(c.queue_url, None);
+ assert_eq!(c.triage_timeout_ms, DEFAULT_TRIAGE_TIMEOUT_MS);
+}
+
+#[test]
+fn a_partial_section_keeps_the_other_defaults() {
+ let c: InboundConfig =
+ toml::from_str("enabled = false\nqueues_path = \"/etc/oh/queues.json\"").unwrap();
+ assert!(!c.enabled);
+ assert_eq!(c.queues_path, Some(PathBuf::from("/etc/oh/queues.json")));
+ assert_eq!(c.triage_timeout_ms, DEFAULT_TRIAGE_TIMEOUT_MS);
+}
diff --git a/crates/openhuman-core/src/config/schema/mod.rs b/crates/openhuman-core/src/config/schema/mod.rs
index 8b043abaf6..fcd24cd9ba 100644
--- a/crates/openhuman-core/src/config/schema/mod.rs
+++ b/crates/openhuman-core/src/config/schema/mod.rs
@@ -60,6 +60,7 @@ pub(crate) use load::CONFIG_OWNER_MISMATCH_MARKER;
pub mod claude_agent_sdk;
pub use claude_agent_sdk::ClaudeAgentSdkConfig;
mod local_ai;
+mod inbound;
mod memes;
pub(crate) mod memory;
mod modules;
@@ -96,6 +97,7 @@ pub use identity_cost::{
BudgetAction, BudgetPeriod, BudgetPolicy, BudgetScope, CostConfig, ModelPricing,
};
pub use local_ai::{LocalAiConfig, LocalAiUsage};
+pub use inbound::InboundConfig;
pub use memes::MemesConfig;
pub use memory::{
migrate_legacy_source, MemoryAgentConfig, MemoryConfig, MemoryConversationsConfig,
diff --git a/crates/openhuman-core/src/config/schema/types/config.rs b/crates/openhuman-core/src/config/schema/types/config.rs
index eae391f025..2fe0ee358c 100644
--- a/crates/openhuman-core/src/config/schema/types/config.rs
+++ b/crates/openhuman-core/src/config/schema/types/config.rs
@@ -470,6 +470,11 @@ pub struct Config {
#[serde(default)]
pub memes: MemesConfig,
+ /// Inbound event queues (`[inbound]`); the switch is
+ /// `[components] eventqueues`.
+ #[serde(default)]
+ pub inbound: InboundConfig,
+
/// Per-dependency switches (`[components]`). Narrow-only; applied at the
/// next core start.
#[serde(default)]
diff --git a/crates/openhuman-core/src/config/schema/types/config_clone.rs b/crates/openhuman-core/src/config/schema/types/config_clone.rs
index 0fb450e1d7..040cf037bf 100644
--- a/crates/openhuman-core/src/config/schema/types/config_clone.rs
+++ b/crates/openhuman-core/src/config/schema/types/config_clone.rs
@@ -93,6 +93,7 @@ impl Clone for Config {
custom_embeddings: self.custom_embeddings.clone(),
tokenjuice: self.tokenjuice.clone(),
memes: self.memes.clone(),
+ inbound: self.inbound.clone(),
components: self.components.clone(),
hosting: self.hosting.clone(),
storage: self.storage.clone(),
diff --git a/crates/openhuman-core/src/config/schema/types/defaults.rs b/crates/openhuman-core/src/config/schema/types/defaults.rs
index c629f3d76d..cbdb34cb33 100644
--- a/crates/openhuman-core/src/config/schema/types/defaults.rs
+++ b/crates/openhuman-core/src/config/schema/types/defaults.rs
@@ -106,6 +106,7 @@ impl Default for Config {
custom_embeddings: None,
tokenjuice: TokenjuiceConfig::default(),
memes: MemesConfig::default(),
+ inbound: InboundConfig::default(),
components: ComponentsConfig::default(),
hosting: HostingConfig::default(),
storage: StorageConfig::default(),