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(agent): migrate inference provider usage to tinyinference_llm
Steven Enamakelca1b424d1127
diff --git a/crates/openhuman-core/src/agent/agent_tests.rs b/crates/openhuman-core/src/agent/agent_tests.rsindex 3a92465445..c8e495acd4 100644--- a/crates/openhuman-core/src/agent/agent_tests.rs+++ b/crates/openhuman-core/src/agent/agent_tests.rs@@ -88,7 +88,7 @@ impl ChatModel<()> for ScriptedProvider {guard.remove(0)};Ok(- crate::inference::provider::model::native_model_response_for_request(+ tinyinference_llm::model::response_to_model_response(&response, &request,),)diff --git a/crates/openhuman-core/src/agent/agent_turn_loop_nudge_tests.rs b/crates/openhuman-core/src/agent/agent_turn_loop_nudge_tests.rsindex 9e006f8639..2407339e07 100644--- a/crates/openhuman-core/src/agent/agent_turn_loop_nudge_tests.rs+++ b/crates/openhuman-core/src/agent/agent_turn_loop_nudge_tests.rs@@ -55,7 +55,7 @@ impl ChatModel<()> for RecordingProvider {}};Ok(- crate::inference::provider::model::native_model_response_for_request(+ tinyinference_llm::model::response_to_model_response(&response, &request,),)diff --git a/crates/openhuman-core/src/agent/cost_tests.rs b/crates/openhuman-core/src/agent/cost_tests.rsindex 6be5acc672..3c8078b96d 100644--- a/crates/openhuman-core/src/agent/cost_tests.rs+++ b/crates/openhuman-core/src/agent/cost_tests.rs@@ -10,7 +10,7 @@ fn counts(input: u64, output: u64, cached: u64) -> BilledUsage {/// the harness `StopHookMetrics` impl, priced through the catalog lookup.fn record(turn: &mut tinyagents_harness::cost::TurnCost, model: &str, usage: &BilledUsage) {use tinyagents_hooks::stop::StopHookMetrics as _;- let response = crate::inference::provider::model::native_model_response_for_request(+ let response = tinyinference_llm::model::response_to_model_response(&crate::inference::provider::ChatResponse {text: Some("ok".into()),usage: Some(*usage),diff --git a/crates/openhuman-core/src/agent/session_host/driver/grounded_close.rs b/crates/openhuman-core/src/agent/session_host/driver/grounded_close.rsindex 10310953f5..fbdcacd351 100644--- a/crates/openhuman-core/src/agent/session_host/driver/grounded_close.rs+++ b/crates/openhuman-core/src/agent/session_host/driver/grounded_close.rs@@ -85,7 +85,7 @@ impl RepairUsage {trace: Option<&SupplementalTrace>,) {self.record(- response.and_then(crate::inference::provider::model::usage_info_from_response),+ response.and_then(tinyinference_llm::usage::usage_info_from_response),kind != tinyagents_harness::close::CloseRequestKind::Verification,trace,);diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/checkpoint.rs b/crates/openhuman-core/src/agent/subagent_host/ops/checkpoint.rsindex 840e965141..0ed7441bb4 100644--- a/crates/openhuman-core/src/agent/subagent_host/ops/checkpoint.rs+++ b/crates/openhuman-core/src/agent/subagent_host/ops/checkpoint.rs@@ -86,7 +86,7 @@ impl CapSummaryModel for HostCapSummaryModel<'_> {&response,);}- let usage = crate::inference::provider::model::usage_info_from_response(&response);+ let usage = tinyinference_llm::usage::usage_info_from_response(&response);*self.usage.lock()diff --git a/crates/openhuman-core/src/agent/tinyagents/context_wiring.rs b/crates/openhuman-core/src/agent/tinyagents/context_wiring.rsindex 2ee8e89f85..cf7c5050b2 100644--- a/crates/openhuman-core/src/agent/tinyagents/context_wiring.rs+++ b/crates/openhuman-core/src/agent/tinyagents/context_wiring.rs@@ -19,7 +19,7 @@ use tinyagents_harness::summarization::{use crate::agent::tinyagents::host::OpenHumanRunContext;use crate::agent::tinyagents::memory_summarizer::MemoryRecallSummarizer;-use crate::inference::provider::model::TurnChatModel;+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 tolddiff --git a/crates/openhuman-core/src/agent/tinyagents/middleware/turn_context.rs b/crates/openhuman-core/src/agent/tinyagents/middleware/turn_context.rsindex 6ecb42aa99..f709e30dd5 100644--- a/crates/openhuman-core/src/agent/tinyagents/middleware/turn_context.rs+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/turn_context.rs@@ -273,7 +273,7 @@ impl Middleware<(), crate::agent::tinyagents::host::OpenHumanRunContext>.filter(|_| !response.served_from_cache){let host_usage =- crate::inference::provider::model::usage_info_from_response(response)+ tinyinference_llm::usage::usage_info_from_response(response).unwrap_or(crate::inference::provider::BilledUsage::from_counts(usage.input_tokens,diff --git a/crates/openhuman-core/src/agent/tinyagents/routes.rs b/crates/openhuman-core/src/agent/tinyagents/routes.rsindex ffab35fc27..e280983908 100644--- a/crates/openhuman-core/src/agent/tinyagents/routes.rs+++ b/crates/openhuman-core/src/agent/tinyagents/routes.rs@@ -157,7 +157,7 @@ impl ModelMiddleware<(), crate::agent::tinyagents::host::OpenHumanRunContext>output_per_mtok_usd: Some(price.output_per_mtok_usd),})};- let billed = crate::inference::provider::model::usage_info_from_response(&response);+ let billed = tinyinference_llm::usage::usage_info_from_response(&response);let estimated_cost_usd = if response.served_from_cache|| billed.is_some_and(|usage| usage.charge_reported && !usage.cost_is_estimate){diff --git a/crates/openhuman-core/src/agent/tinyagents/supplemental_trace.rs b/crates/openhuman-core/src/agent/tinyagents/supplemental_trace.rsindex 66a979b9c5..6232b6a27e 100644--- a/crates/openhuman-core/src/agent/tinyagents/supplemental_trace.rs+++ b/crates/openhuman-core/src/agent/tinyagents/supplemental_trace.rs@@ -120,7 +120,7 @@ impl SupplementalTrace {.map(|rate| rate * 1_000_000.0),output_per_mtok_usd: price.output_per_token.map(|rate| rate * 1_000_000.0),});- let billed = crate::inference::provider::model::usage_info_from_response(response);+ let billed = tinyinference_llm::usage::usage_info_from_response(response);let estimated_cost_usd = if response.served_from_cache|| billed.is_some_and(|usage| usage.charge_reported && !usage.cost_is_estimate){diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs b/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rsindex fd948a961d..13f20c8052 100644--- a/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs+++ b/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs@@ -37,7 +37,7 @@ 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::provider::model::TurnChatModel;+use crate::inference::turn_models::TurnChatModel;use super::ToolPolicyEnforcement;@@ -181,7 +181,7 @@ pub(super) fn install_turn_middleware(harness.push_model_middleware(Arc::new(tinyagents_harness::middleware::library::UsageCarryMiddleware::new(move |response| {if let Some(usage) =- crate::inference::provider::model::usage_info_from_response(response)+ tinyinference_llm::usage::usage_info_from_response(response){usage_carry.lock()diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_plan.rs b/crates/openhuman-core/src/agent/tinyagents/turn_plan.rsindex 86e84f897f..4ecb88a7c5 100644--- a/crates/openhuman-core/src/agent/tinyagents/turn_plan.rs+++ b/crates/openhuman-core/src/agent/tinyagents/turn_plan.rs@@ -23,7 +23,7 @@ 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::provider::model::TurnChatModel;+use crate::inference::turn_models::TurnChatModel;/// The run policy for one turn, and whether it carries a cross-route fallback.///diff --git a/crates/openhuman-core/src/flows/caps_host/prompt.rs b/crates/openhuman-core/src/flows/caps_host/prompt.rsindex 1d335d3904..a5ec797dd7 100644--- a/crates/openhuman-core/src/flows/caps_host/prompt.rs+++ b/crates/openhuman-core/src/flows/caps_host/prompt.rs@@ -45,7 +45,7 @@ pub(crate) fn model_response_to_completion_value(.map(crate::agent::tinyagents::ta_call_to_oh_call).collect::<Vec<_>>(),"usage": usage_to_json(- &crate::inference::provider::model::usage_info_from_response(response)+ &tinyinference_llm::usage::usage_info_from_response(response)),"reasoning_content": tinyagents_runtime::transcript::reasoning_from_content(&response.message.content