Skip to content

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

refactor(session_host): move from_config_with_definition to host_tools

Steven Enamakela03ab83cf35a
diff --git a/crates/openhuman-core/src/agent/session_host/builder/factory.rs b/crates/openhuman-core/src/agent/session_host/builder/factory.rs
index 232ab6b581..0bab80ecd2 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/factory.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/factory.rs
@@ -122,37 +122,6 @@ impl OpenHumanSessionHost {
)
}
- /// Build a session agent from a definition the caller already holds,
- /// rather than an id resolved through `AgentDefinitionRegistry::current()`
- /// or `config.agent_registry`.
- ///
- /// The definition is authoritative for this agent's prompt, tool scope,
- /// sandbox mode and delegation allowlist; it is stamped on the session so
- /// in-turn readers ([`OpenHumanSessionHost::resolved_definition`]) never fall back to a
- /// registry entry that happens to share its id. This is the constructor a
- /// library host uses to run many independently specified agents on one
- /// booted core.
- pub fn from_config_with_definition(
- ctx: &DispatchCtx,
- config: &Config,
- definition: &crate::agent::harness::host_definition::AgentDefinition,
- ) -> Result<Self> {
- log::debug!(
- "[agent] from_config_with_definition id={} sandbox={:?}",
- definition.id,
- definition.sandbox_mode,
- );
- Self::build_session_agent_inner(
- ctx,
- config,
- &definition.id,
- Some(definition),
- false,
- None,
- None,
- )
- }
-
/// Internal constructor that consumes the optionally-resolved agent
/// definition. Split out from [`OpenHumanSessionHost::from_config_for_agent`] so
/// the lookup + logging live in one place and the heavy-lifting
diff --git a/crates/openhuman-core/src/agent/session_host/builder/host_tools.rs b/crates/openhuman-core/src/agent/session_host/builder/host_tools.rs
index 03aaa3ad19..552c907c84 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/host_tools.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/host_tools.rs
@@ -380,4 +380,35 @@ impl OpenHumanSessionHost {
session_id,
)
}
+
+ /// Build a session agent from a definition the caller already holds,
+ /// rather than an id resolved through `AgentDefinitionRegistry::current()`
+ /// or `config.agent_registry`.
+ ///
+ /// The definition is authoritative for this agent's prompt, tool scope,
+ /// sandbox mode and delegation allowlist; it is stamped on the session so
+ /// in-turn readers ([`OpenHumanSessionHost::resolved_definition`]) never fall back to a
+ /// registry entry that happens to share its id. This is the constructor a
+ /// library host uses to run many independently specified agents on one
+ /// booted core.
+ pub fn from_config_with_definition(
+ ctx: &crate::core::runtime::DispatchCtx,
+ config: &Config,
+ definition: &crate::agent::harness::host_definition::AgentDefinition,
+ ) -> Result<Self> {
+ log::debug!(
+ "[agent] from_config_with_definition id={} sandbox={:?}",
+ definition.id,
+ definition.sandbox_mode,
+ );
+ OpenHumanSessionHost::build_session_agent_inner(
+ ctx,
+ config,
+ &definition.id,
+ Some(definition),
+ false,
+ None,
+ None,
+ )
+ }
}