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): move stop hook policy into tinyagents
Steven Enamakel82798d2f2d22
diff --git a/crates/openhuman-core/src/agent/mod.rs b/crates/openhuman-core/src/agent/mod.rsindex 667868086a..fddb0ab201 100644--- a/crates/openhuman-core/src/agent/mod.rs+++ b/crates/openhuman-core/src/agent/mod.rs@@ -51,7 +51,6 @@ pub(crate) mod registration;/// session runtime. Generic history, transcript delta, prefix and tool/// snapshots are owned by `tinyagents-runtime`.pub mod session_host;-pub mod stop_hooks;/// Product-specific adapters around `tinyagents_orchestration::subagent`./// Generic lifecycle ordering and task-key coalescing live in TinyAgents;/// definitions, prompts, tools, policy, checkpoints and progress remain here.diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session.rs b/crates/openhuman-core/src/agent/session_host/runtime_session.rsindex 96a3712a8b..c829b6a61d 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_session.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_session.rs@@ -427,8 +427,8 @@ impl OpenHumanTurnPrelude {if let Some(block) = tinyagents_graph::goals::active_goal_context_block(goal) {context.push_str(&block);}- if let Some(hook) = crate::agent::goals::runtime::GoalBudgetStopHook::for_goal(- &self.workspace_dir,+ if let Some(hook) = tinyagents_hooks::stop::GoalBudgetStopHook::for_goal(+ crate::storage::sessions::stores_or_ephemeral(&self.workspace_dir).kv,goal,) {run_context.stop_hooks.push(Arc::new(hook));diff --git a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rsindex c53b73b394..b4cef0f54b 100644--- a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs+++ b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs@@ -575,7 +575,7 @@ impl OpenHumanRunContext {/// 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)+ crate::agent::tinyagents::turn_policy::tool_call_limit(max_iterations, self.tool_call_limit)}/// Applies the host environment an entry point handed to the session:diff --git a/crates/openhuman-core/src/agent/tinyagents/mod.rs b/crates/openhuman-core/src/agent/tinyagents/mod.rsindex fb9ab38f0e..2ce16596b9 100644--- a/crates/openhuman-core/src/agent/tinyagents/mod.rs+++ b/crates/openhuman-core/src/agent/tinyagents/mod.rs@@ -49,7 +49,6 @@ mod policy_denial;pub(crate) mod reaper;mod routes;mod steering_forwarder;-pub(crate) mod stop_hooks;pub(crate) mod tool_registration;mod turn_exec;mod turn_middleware;diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_policy.rs b/crates/openhuman-core/src/agent/tinyagents/turn_policy.rsindex d14a9b4055..39758f9ed4 100644--- a/crates/openhuman-core/src/agent/tinyagents/turn_policy.rs+++ b/crates/openhuman-core/src/agent/tinyagents/turn_policy.rs@@ -137,7 +137,7 @@ pub(crate) fn run_policy_for_provider() -> RunPolicy {run_policy(&TurnPolicyOptions {max_model_calls: max_iterations,- max_tool_calls: crate::agent::stop_hooks::tool_call_limit(max_iterations, tool_call_cap),+ max_tool_calls: tool_call_limit(max_iterations, tool_call_cap),max_depth: MAX_SPAWN_DEPTH,local_provider,response_cache_enabled,@@ -145,6 +145,12 @@ pub(crate) fn run_policy_for_provider(})}+/// Default per-turn tool budget, narrowed by an explicit host cap.+pub(crate) fn tool_call_limit(max_iterations: usize, cap: Option<usize>) -> usize {+ let default = max_iterations.saturating_mul(8).max(8);+ cap.map_or(default, |cap| default.min(cap))+}+/// True when `name` is a sub-agent spawn/delegation tool that a **child** run/// must never be able to invoke (issue #4452), re-asserted at registration as/// defense-in-depth so a misconfigured allowlist cannot reintroduce sub-agent