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): use harness PlanExitTool and ModelBudget
Steven Enamakele50970b377fc
diff --git a/crates/openhuman-core/src/agent/registration.rs b/crates/openhuman-core/src/agent/registration.rsindex e5c0d3f4cd..4451ddc819 100644--- a/crates/openhuman-core/src/agent/registration.rs+++ b/crates/openhuman-core/src/agent/registration.rs@@ -5,7 +5,7 @@ use super::orchestration::tools::{SpawnAsyncSubagentTool, SpawnParallelAgentsTool, SpawnSubagentTool, SteerSubagentTool,WaitSubagentTool,};-use super::tools::{PlanExitTool, TodoTool};+use super::tools::TodoTool;use crate::config::Config;#[cfg(feature = "skills")]use crate::skills::run_workflow::{AwaitWorkflowTool, RunWorkflowTool};@@ -58,7 +58,20 @@ pub(crate) fn dialogue_tools(action_dir: &Path, root_config: &Config) -> Vec<Box// Interactive plan-review gate: parks the live turn on a thread-scoped// plan the user must approve before execution (Codex/Claude plan mode).Box::new(crate::plan_review::RequestPlanReviewTool::new()),- Box::new(PlanExitTool::new()),+ Box::new(tinyagents_harness::tool::PlanExitTool::new(std::sync::Arc::new(+ |context| {+ let thread_id = context.thread_id()?;+ let dispatch_ctx = crate::agent::tinyagents::host::run_context::dispatch_ctx_for_tool(Some(context));+ let tenant = dispatch_ctx.tenant().ok()?;+ if crate::plan_review::gate::global()+ .parked_review_for_thread(&tenant, thread_id)+ .is_some()+ {+ return None;+ }+ Some(crate::threads::run_mode::handle_for_thread(&dispatch_ctx, thread_id))+ },+ ))),// Workflow composition: `run_workflow` runs another workflow as a// subagent and (by default) waits on its result like a function call;// `await_workflow` re-attaches to a run that outlived its inline wait.diff --git a/crates/openhuman-core/src/agent/tinyagents/budget.rs b/crates/openhuman-core/src/agent/tinyagents/budget.rsindex 2b8f5a9ef2..265db5bb17 100644--- a/crates/openhuman-core/src/agent/tinyagents/budget.rs+++ b/crates/openhuman-core/src/agent/tinyagents/budget.rs@@ -1,39 +1,12 @@//! Host budget policy, handed to the turn once at admission and carried//! explicitly to children (`HostTurnEnv::model_budget` -> `OpenHumanRunContext`).-use std::sync::Arc;/// Product recursion ceiling shared by native and MCP delegation.pub(crate) const MAX_SPAWN_DEPTH: usize = 3;pub use tinyinference_llm::model::budget::{Budget, BudgetExceeded, BudgetSnapshot, CallBudget, Spend, SpendLimits,};-use tinyinference_llm::model::ChatModel;--/// A shared ledger and conservative reservation bounds for every physical call.-#[derive(Debug, Clone)]-pub struct ModelBudget {- /// Run/turn ledger. Children of a turn share it.- pub ledger: Budget,- /// Per-call input, output and charge upper bounds for all allowed routes.- pub call: CallBudget,-}-impl ModelBudget {- /// Wait for live reservations when settled spend still affords admission.- /// Clones and child turns inherit this opt-in; internal retries stay fail-fast.- pub fn wait_for_capacity(mut self) -> Self {- self.ledger = self.ledger.wait_for_capacity();- self- }-- /// Apply the policy below retries and fallback selection.- pub(crate) fn wrap(&self, model: Arc<dyn ChatModel<()>>) -> Arc<dyn ChatModel<()>> {- Arc::new(tinyinference_llm::model::budget::BudgetedModel::new(- Arc::new(tinyagents_harness::cost::GatewayChargeModel::new(model)),- self.ledger.clone(),- self.call,- ))- }-}+pub use tinyagents_harness::cost::ModelBudget;/// Effective host depth ceiling, never wider than product policy.pub(crate) fn depth(context: &super::host::OpenHumanRunContext) -> usize {context@@ -58,10 +31,10 @@ impl crate::inference::turn_models::TurnModels {let Some(budget) = budget else {return self;};- self.primary = budget.wrap(self.primary);- self.summarizer = budget.wrap(self.summarizer);+ self.primary = budget.wrap_model(self.primary);+ self.summarizer = budget.wrap_model(self.summarizer);for (_, route) in &mut self.routes {- *route = budget.wrap(route.clone());+ *route = budget.wrap_model(route.clone());}self}