Skip to content

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

chore: files changed crates/openhuman-core/src/channels/runtime/dispatch/mod.rs,crates/openhuman-cor

Steven Enamakel3ef26265f0ad
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/mod.rs b/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/mod.rs
new file mode 100644
index 0000000000..b65d80b1b3
--- /dev/null
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/mod.rs
@@ -0,0 +1,13 @@
+//! Channel turns answered by a host-registered agent.
+
+use crate::config::Config;
+
+/// The agent `channel` is bound to in `config.agent.channel_agents`, if any.
+pub(crate) fn bound_agent_id<'a>(config: &'a Config, channel: &str) -> Option<&'a str> {
+ let _ = (config, channel);
+ None
+}
+
+#[cfg(test)]
+#[path = "mod_tests.rs"]
+mod tests;
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/mod_tests.rs b/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/mod_tests.rs
new file mode 100644
index 0000000000..a3b835d8ee
--- /dev/null
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/mod_tests.rs
@@ -0,0 +1,37 @@
+use super::*;
+
+fn bound(channel: &str, agent_id: &str) -> Config {
+ let mut config = Config::default();
+ config
+ .agent
+ .channel_agents
+ .insert(channel.to_string(), agent_id.to_string());
+ config
+}
+
+#[test]
+fn an_unbound_channel_names_no_agent() {
+ assert_eq!(bound_agent_id(&Config::default(), "telegram"), None);
+ assert_eq!(bound_agent_id(&bound("discord", "x"), "telegram"), None);
+}
+
+#[test]
+fn a_bound_channel_names_its_agent() {
+ let config = bound("telegram", "teeny-chat");
+ assert_eq!(bound_agent_id(&config, "telegram"), Some("teeny-chat"));
+}
+
+#[test]
+fn a_blank_binding_is_no_binding() {
+ assert_eq!(bound_agent_id(&bound("telegram", " "), "telegram"), None);
+}
+
+#[test]
+fn the_binding_is_read_from_toml() {
+ let config: crate::config::schema::AgentConfig =
+ toml::from_str("[channel_agents]\ntelegram = \"teeny-chat\"\n").unwrap();
+ assert_eq!(
+ config.channel_agents.get("telegram").map(String::as_str),
+ Some("teeny-chat")
+ );
+}
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/mod.rs b/crates/openhuman-core/src/channels/runtime/dispatch/mod.rs
index e944cb3f40..a6c6399870 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/mod.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/mod.rs
@@ -8,6 +8,7 @@
//! [`run_message_dispatch_loop`]) and approval-surface gate.
mod helpers;
+pub(crate) mod host_agent;
mod processor;
mod routing;
diff --git a/crates/openhuman-core/src/config/schema/agent.rs b/crates/openhuman-core/src/config/schema/agent.rs
index 64d01faf58..cbd76de64e 100644
--- a/crates/openhuman-core/src/config/schema/agent.rs
+++ b/crates/openhuman-core/src/config/schema/agent.rs
@@ -229,6 +229,22 @@ pub struct AgentConfig {
#[serde(default)]
pub channel_permissions: std::collections::HashMap<String, String>,
+ /// Channel name → id of the agent that answers that channel.
+ ///
+ /// An inbound message on a channel named here (`telegram = "teeny-chat"`)
+ /// runs as that agent instead of the orchestrator: the agent is looked up
+ /// through the host agent resolver
+ /// ([`crate::agent::host_agents`]), so an embedder's own agent answers
+ /// with its own system prompt and host tools. A channel that is not named
+ /// here is routed exactly as before. Keyed by channel name rather than set
+ /// on each provider's config because those provider structs belong to
+ /// `tinychannels`; routing a channel to an agent is host policy.
+ ///
+ /// A binding the resolver cannot satisfy is refused, never widened to
+ /// the orchestrator; see `channels::runtime::dispatch::host_agent`.
+ #[serde(default)]
+ pub channel_agents: std::collections::HashMap<String, String>,
+
/// Maximum byte length of a single tool-result body before the
/// TinyAgents tool-output middleware budget stage truncates it. Applied
/// inline at tool-execution time (before the result enters history),
@@ -487,6 +503,7 @@ impl Default for AgentConfig {
max_parallel_tools: default_max_parallel_tools(),
tool_dispatcher: default_agent_tool_dispatcher(),
channel_permissions: std::collections::HashMap::new(),
+ channel_agents: std::collections::HashMap::new(),
tool_result_budget_bytes: default_tool_result_budget_bytes(),
agent_timeout_secs: default_agent_timeout_secs(),
session_dual_write: default_session_dual_write(),