Skip to content

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

feat(agent): add host definition support for subagent sessions

Steven Enamakelc20c738dbb9f
diff --git a/crates/openhuman-core/src/agent/harness/host_definition.rs b/crates/openhuman-core/src/agent/harness/host_definition.rs
index ad6b2544d2..68be9c9781 100644
--- a/crates/openhuman-core/src/agent/harness/host_definition.rs
+++ b/crates/openhuman-core/src/agent/harness/host_definition.rs
@@ -108,12 +108,6 @@ fn same_definition(a: &AgentDefinition, b: &AgentDefinition) -> bool {
}
}
-/// The concrete TokenJuice policy for `def` (see
-/// [`AgentExt::effective_tokenjuice_compression`]).
-pub fn effective_tokenjuice_compression(def: &AgentDefinition) -> AgentTokenjuiceCompression {
- def.extensions.effective_tokenjuice_compression(&def.model)
-}
-
/// The prompt builder behind a `PromptSource::Dynamic(())` marker.
pub fn dynamic_prompt_builder(def: &AgentDefinition) -> Result<PromptBuilder> {
def.extensions.prompt_builder.ok_or_else(|| {
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 8bc4ed7789..cfbfc18b88 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/factory.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/factory.rs
@@ -4,8 +4,7 @@ use super::dispatcher::{resolve_dispatcher_kind, DispatcherKind};
use super::host_tools::derive_turn_workspace_descriptor;
use super::should_synthesize_delegation_tools;
use crate::agent::harness::host_definition::{
- dynamic_prompt_builder, effective_tokenjuice_compression, AgentDefinitionRegistry,
- NO_TOOLS_SENTINEL,
+ dynamic_prompt_builder, AgentDefinitionRegistry, NO_TOOLS_SENTINEL,
};
use crate::agent::host_runtime;
use crate::agent::prompts::SystemPromptBuilder;
@@ -671,7 +670,7 @@ impl OpenHumanSessionHost {
.map(|def| def.extensions.omit_memory_context)
.unwrap_or(false);
let effective_tokenjuice_compression = target_def
- .map(|def| effective_tokenjuice_compression(def))
+ .map(|def| def.extensions.effective_tokenjuice_compression(&def.model))
.unwrap_or(tinyjuice_bus::types::AgentTokenjuiceCompression::Full);
// Stamp the resolved agent definition id onto the OpenHumanSessionHost via the
diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs
index 3db9023f01..5672be8c9d 100644
--- a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs
@@ -11,9 +11,7 @@ use std::time::Instant;
use crate::agent::harness::artifact_offload::{new_artifact_offload, offload_oversized_result};
use crate::agent::harness::fork_context::ParentExecutionContext;
-use crate::agent::harness::host_definition::{
- effective_tokenjuice_compression, AgentDefinition, AgentDefinitionRegistry,
-};
+use crate::agent::harness::host_definition::{AgentDefinition, AgentDefinitionRegistry};
use crate::agent::prompts::{
render_subagent_system_prompt_with_format, PromptContext, SubagentRenderOptions,
};
@@ -948,7 +946,7 @@ async fn run_typed_mode(
"subagent",
// Agent-level TokenJuice profile → sub-agent context middleware
// (#4466), so sub-agent tool outputs compact like the chat path.
- effective_tokenjuice_compression(definition),
+ definition.extensions.effective_tokenjuice_compression(&definition.model),
// The spawn-wide config snapshot supplies the `[context]`
// knobs the graph used to load for itself.
config.as_ref().ok().map(|c| c.as_ref()),