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): preserve selected models for hosted turns
Steven Enamakel8bcd62360afd
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/bundle.rs b/crates/openhuman-core/src/agent/tinyagents/host/bundle.rsindex 8a56d9a5fb..2429c9021f 100644--- a/crates/openhuman-core/src/agent/tinyagents/host/bundle.rs+++ b/crates/openhuman-core/src/agent/tinyagents/host/bundle.rs@@ -65,6 +65,8 @@ pub struct OpenHumanHostInvocationInputs {pub base: Arc<OpenHumanHostBase>,pub tool_sets: Vec<Arc<Vec<Box<dyn Tool>>>>,pub tool_policy: Option<Arc<ToolPolicySession>>,+ /// The current turn's already-selected model route set.+ pub model_resolver: Option<Arc<dyn ModelResolver<()>>>,}/// OpenHuman's ten concrete capability adapters plus their erased crate bundle.@@ -96,7 +98,7 @@ impl OpenHumanHostBundleFactory {inputs: OpenHumanHostInvocationInputs,turn: &OpenHumanRunContext,) -> OpenHumanHostBundle {- Self::build(+ let mut bundle = Self::build(OpenHumanHostBundleInputs {config: inputs.base.config.clone(),definitions: inputs.base.definitions.clone(),@@ -109,7 +111,11 @@ impl OpenHumanHostBundleFactory {post_turn_hooks: inputs.base.post_turn_hooks.clone(),},turn,- )+ );+ if let Some(model_resolver) = inputs.model_resolver {+ bundle.capabilities.models = model_resolver;+ }+ bundle}/// Constructs all ten concrete adapters from a single session input set.diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_models.rs b/crates/openhuman-core/src/agent/tinyagents/turn_models.rsindex b470622f92..bfb820b11f 100644--- a/crates/openhuman-core/src/agent/tinyagents/turn_models.rs+++ b/crates/openhuman-core/src/agent/tinyagents/turn_models.rs@@ -3,10 +3,13 @@use std::sync::Arc;+use async_trait::async_trait;+use crate::agent::tinyagents::model::{BuiltTurnModels, ProfileOverrideModel, TierRoutes, TurnChatModel,};use crate::agent::tinyagents::routes;+use tinyagents_harness::host::{ModelResolveRequest, ModelResolver};use tinyinference_llm::model::{ResolvedModelRoute, RouteRecordingModel};pub(crate) fn tinyagents_depth_error(@@ -82,6 +85,37 @@ impl TurnModels {}}+/// Host resolver for one live invocation. It exposes the exact pre-built+/// primary and fallback route models already selected by OpenHuman, rather+/// than constructing a fresh config-routed model during hosted preparation.+pub(crate) struct TurnModelResolver {+ primary: TurnChatModel,+ routes: std::collections::HashMap<String, TurnChatModel>,+}++impl TurnModelResolver {+ pub(crate) fn from_turn_models(models: &TurnModels) -> Self {+ Self {+ primary: models.primary.clone(),+ routes: models.routes.iter().cloned().collect(),+ }+ }+}++#[async_trait]+impl ModelResolver<()> for TurnModelResolver {+ async fn resolve(+ &self,+ request: &ModelResolveRequest,+ ) -> tinyagents_harness::Result<TurnChatModel> {+ Ok(request+ .model_pin()+ .and_then(|name| self.routes.get(name))+ .cloned()+ .unwrap_or_else(|| self.primary.clone()))+ }+}+/// Build the per-turn [`TurnModels`] **crate-natively** from `(role, config)` —/// the Phase 3 P3-B cutover of [`build_turn_models`]: instead of wrapping one host/// `Provider` per tier in a [`native model adapter`], each tier is built as a crate-native