The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
feat(agent): add host definition support for session and subagent hosts
Steven Enamakeleb98d2b2ccc5
diff --git a/crates/openhuman-app/Cargo.lock b/crates/openhuman-app/Cargo.lockindex 5109751d7f..7470d6733d 100644--- a/crates/openhuman-app/Cargo.lock+++ b/crates/openhuman-app/Cargo.lock@@ -3966,6 +3966,7 @@ dependencies = ["serde_json","tempfile","thiserror 2.0.20",+ "tinyagents-definition","tinyagents-graph","tinyagents-harness","tinyagents-session",diff --git a/crates/openhuman-core/src/agent/harness/host_definition.rs b/crates/openhuman-core/src/agent/harness/host_definition.rsindex a415349324..7d661cb492 100644--- a/crates/openhuman-core/src/agent/harness/host_definition.rs+++ b/crates/openhuman-core/src/agent/harness/host_definition.rs@@ -54,7 +54,7 @@ pub struct AgentExt {pub omit_safety_preamble: bool,/// Per-agent TokenJuice tool-result compression profile. `auto` keeps/// compression on for normal agents and resolves coding-model agents to- /// `light`; see [`AgentExt::effective_tokenjuice_compression`].+ /// `light`; see [`AgentExt::tokenjuice_for`].#[serde(default)]pub tokenjuice_compression: AgentTokenjuiceCompression,/// Whether this agent's turns can search and call the tools of every@@ -108,10 +108,8 @@ fn same_definition(a: &AgentDefinition, b: &AgentDefinition) -> bool {}}-/// Host accessors on the portable [`AgentDefinition`].+/// Host accessor on the portable [`AgentDefinition`].pub trait AgentDefinitionExt {- /// The concrete TokenJuice policy (see [`AgentExt::effective_tokenjuice_compression`]).- fn effective_tokenjuice_compression(&self) -> AgentTokenjuiceCompression;/// The prompt builder behind a `PromptSource::Dynamic(())` marker.fn prompt_fn(&self) -> Result<PromptBuilder>;}diff --git a/crates/openhuman-core/src/agent/harness/host_definition_tests.rs b/crates/openhuman-core/src/agent/harness/host_definition_tests.rsindex f537e8945b..27502678c7 100644--- a/crates/openhuman-core/src/agent/harness/host_definition_tests.rs+++ b/crates/openhuman-core/src/agent/harness/host_definition_tests.rs@@ -417,13 +417,10 @@ fn coding_hint_resolves_auto_tokenjuice_to_light() {use tinyjuice_bus::types::AgentTokenjuiceCompression as Profile;let ext = AgentExt::default();assert_eq!(- ext.effective_tokenjuice_compression(&ModelSpec::Hint(" Coding ".into())),+ ext.tokenjuice_for(&ModelSpec::Hint(" Coding ".into())),Profile::Light);- assert_eq!(- ext.effective_tokenjuice_compression(&ModelSpec::Inherit),- Profile::Full- );+ assert_eq!(ext.tokenjuice_for(&ModelSpec::Inherit), Profile::Full);}/// Pins tinyagents#441: existing definitions on disk spell an unrestricteddiff --git a/crates/openhuman-core/src/agent/session_host/builder/factory.rs b/crates/openhuman-core/src/agent/session_host/builder/factory.rsindex aadbe6eba5..7382bac21d 100644--- a/crates/openhuman-core/src/agent/session_host/builder/factory.rs+++ b/crates/openhuman-core/src/agent/session_host/builder/factory.rs@@ -669,7 +669,7 @@ impl OpenHumanSessionHost {.map(|def| def.extensions.omit_memory_context).unwrap_or(false);let effective_tokenjuice_compression = target_def- .map(|def| def.effective_tokenjuice_compression())+ .map(|def| def.extensions.tokenjuice_for(&def.model)).unwrap_or(tinyjuice_bus::types::AgentTokenjuiceCompression::Full);// Stamp the resolved agent definition id onto the OpenHumanSessionHost via thediff --git a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rsindex d19f2c5796..9203c72101 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::{- AgentDefinition, AgentDefinitionExt, AgentDefinitionRegistry,-};+use crate::agent::harness::host_definition::{AgentDefinition, AgentDefinitionRegistry};use crate::agent::prompts::{render_subagent_system_prompt_with_format, PromptContext, SubagentRenderOptions,};@@ -947,7 +945,7 @@ async fn run_typed_mode(// own channel in per-thread usage reads."subagent",// Agent TokenJuice profile → sub-agent context middleware (#4466).- definition.effective_tokenjuice_compression(),+ definition.extensions.tokenjuice_for(&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()),