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
refactor(tinyagents): update model type to use trait object
Steven Enamakel28f0d8f736b4
diff --git a/crates/openhuman-core/src/agent/tinyagents/context_wiring.rs b/crates/openhuman-core/src/agent/tinyagents/context_wiring.rsindex cf7c5050b2..79b618f305 100644--- a/crates/openhuman-core/src/agent/tinyagents/context_wiring.rs+++ b/crates/openhuman-core/src/agent/tinyagents/context_wiring.rs@@ -19,7 +19,6 @@ use tinyagents_harness::summarization::{use crate::agent::tinyagents::host::OpenHumanRunContext;use crate::agent::tinyagents::memory_summarizer::MemoryRecallSummarizer;-use crate::inference::turn_models::TurnChatModel;use tinyagents_harness::turn_outcome::ToolOutcomeSink;/// Fractions of a capped turn's model-call budget at which the model is told@@ -56,7 +55,7 @@ pub(super) fn install_context_ladder(compaction_trigger_tokens: Option<u64>,compaction_strategy: crate::config::CompactionStrategy,microcompact_keep_recent: usize,- summarizer_model: TurnChatModel,+ summarizer_model: Arc<dyn tinyinference_llm::model::ChatModel<()>>,wrap_up_at_cap: bool,tool_outcome_sink: &ToolOutcomeSink,memory_turn: Option<Arc<crate::memory::lifecycle::hooks::MemoryTurn>>,@@ -123,7 +122,7 @@ fn compression_middleware(policy: SummarizationPolicy,strategy: crate::config::CompactionStrategy,context_window: Option<u64>,- summarizer_model: TurnChatModel,+ summarizer_model: Arc<dyn tinyinference_llm::model::ChatModel<()>>,model: &str,memory_turn: Option<Arc<crate::memory::lifecycle::hooks::MemoryTurn>>,) -> ContextCompressionMiddleware {diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs b/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rsindex 34dfae2024..0c07bc884b 100644--- a/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs+++ b/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs@@ -37,7 +37,6 @@ use crate::agent::tinyagents::middleware::turn_context::TurnContextMiddleware;use crate::agent::tinyagents::observability::{ProviderUsageCarry, SubagentScope, ToolFailureMap};use crate::agent::tinyagents::routes;use crate::agent::tinyagents::verify_before_finish;-use crate::inference::turn_models::TurnChatModel;use super::ToolPolicyEnforcement;@@ -82,7 +81,7 @@ pub(super) struct TurnMiddlewareInputs {/// This turn's memory binding: the compaction summarizer recalls under it.pub(super) memory_turn: Option<Arc<crate::memory::lifecycle::hooks::MemoryTurn>>,/// The context-window summarizer's model.- pub(super) summarizer_model: TurnChatModel,+ pub(super) summarizer_model: Arc<dyn tinyinference_llm::model::ChatModel<()>>,/// Shared `call_id -> (success, failure, elapsed_ms, output_chars)` side/// channel: middleware records each outcome for the bridge's/// `ToolCallCompleted`.diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_plan.rs b/crates/openhuman-core/src/agent/tinyagents/turn_plan.rsindex 4ecb88a7c5..9a97b4959c 100644--- a/crates/openhuman-core/src/agent/tinyagents/turn_plan.rs+++ b/crates/openhuman-core/src/agent/tinyagents/turn_plan.rs@@ -23,7 +23,6 @@ use crate::agent::tinyagents::host::OpenHumanRunContext;use crate::agent::tinyagents::routes;use crate::agent::tinyagents::tool_registration::host_tool_set_builder_for_turn;use crate::agent::tinyagents::turn_policy::run_policy_for_provider;-use crate::inference::turn_models::TurnChatModel;/// The run policy for one turn, and whether it carries a cross-route fallback.///@@ -84,12 +83,12 @@ pub(super) fn turn_run_policy(/// capability profile; the primary stays the default and dispatch target.pub(super) fn turn_models_for_plan(model: &str,- primary: TurnChatModel,- tier_routes: Vec<(String, TurnChatModel)>,+ primary: Arc<dyn tinyinference_llm::model::ChatModel<()>>,+ tier_routes: Vec<(String, Arc<dyn tinyinference_llm::model::ChatModel<()>>)>,error_slot: &tinyinference_llm::model::ModelErrorSlot,hosted_security_gate: bool,-) -> Vec<(String, TurnChatModel)> {- let slotted = |model: TurnChatModel| -> TurnChatModel {+) -> Vec<(String, Arc<dyn tinyinference_llm::model::ChatModel<()>>)> {+ let slotted = |model: Arc<dyn tinyinference_llm::model::ChatModel<()>>| -> Arc<dyn tinyinference_llm::model::ChatModel<()>> {if hosted_security_gate {model} else {@@ -104,7 +103,7 @@ pub(super) fn turn_models_for_plan(/// Everything the planner decides a turn from.pub(super) struct OpenHumanTurnPlanner {- pub(super) models: Vec<(String, TurnChatModel)>,+ pub(super) models: Vec<(String, Arc<dyn tinyinference_llm::model::ChatModel<()>>)>,pub(super) policy: RunPolicy,pub(super) tool_sets: Vec<SharedToolSet>,pub(super) allowed: Option<HashSet<String>>,