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): thread run context through harness assembly
Steven Enamakelfa3df73e7fc0
diff --git a/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs b/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rsindex 2336c32d73..59257c192a 100644--- a/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs+++ b/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs@@ -68,10 +68,12 @@ pub(super) fn assemble_turn_harness(Arc<dyn tinyagents_harness::middleware::StopHook<crate::agent::cost::TurnCost>>,>,// The turn's agent/turn tool callbacks (`OpenHumanRunContext::tool_hooks`),- // registered after the runtime's global ones.- scoped_tool_hooks: Vec<Arc<dyn crate::agent::hooks::ToolHook>>,- // The host's cap on real tool invocations (`OpenHumanRunContext::tool_call_limit`).- tool_call_cap: Option<usize>,+ // registered after the runtime's global ones, and the host's cap on real+ // tool invocations (`OpenHumanRunContext::tool_call_limit`).+ (scoped_tool_hooks, tool_call_cap): (+ Vec<Arc<dyn crate::agent::hooks::ToolHook>>,+ Option<usize>,+ ),tool_policy: Option<ToolPolicyEnforcement>,required_capabilities: Option<CapabilitySet>,deterministic_cacheable: bool,diff --git a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rsindex e4cea148a2..9e42378d7e 100644--- a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs+++ b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs@@ -558,6 +558,12 @@ impl OpenHumanRunContext {self.parent.insert(parent)}+ /// The real tool invocation budget for a turn of `max_iterations`: the+ /// product default, narrowed by the host's explicit cap.+ pub(crate) fn tool_call_limit_for(&self, max_iterations: usize) -> usize {+ crate::agent::stop_hooks::tool_call_limit(max_iterations, self.tool_call_limit)+ }+/// Applies the host environment an entry point handed to the session:/// shared budget, delegation depth, cancellation, deadline and hooks.#[must_use]diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs b/crates/openhuman-core/src/agent/tinyagents/turn_runner.rsindex 5857ca66b6..a5461aa127 100644--- a/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs+++ b/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs@@ -277,8 +277,7 @@ pub(super) async fn run_turn_via_tinyagents_body(early_exit_tools,context_mw,run_context.stop_hooks.clone(),- run_context.tool_hooks.clone(),- run_context.tool_call_limit,+ (run_context.tool_hooks.clone(), run_context.tool_call_limit),tool_policy.clone(),routes::turn_required_capabilities(model),deterministic_cacheable,@@ -360,10 +359,7 @@ pub(super) async fn run_turn_via_tinyagents_body("openhuman-agent-turn"}).with_max_model_calls(max_iterations)- .with_max_tool_calls(crate::agent::stop_hooks::tool_call_limit(- max_iterations,- run_context.tool_call_limit,- ))+ .with_max_tool_calls(run_context.tool_call_limit_for(max_iterations)).with_max_depth(super::budget::depth(&run_context)).with_tag("openhuman").with_tag(if subagent_scope.is_some() {