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(openhuman-embed): parameterize StopHook over TurnCost
Steven Enamakel9d9e5deffaad
diff --git a/crates/openhuman-embed/src/agent/spec.rs b/crates/openhuman-embed/src/agent/spec.rsindex 0a45d619a8..f7426ef1b9 100644--- a/crates/openhuman-embed/src/agent/spec.rs+++ b/crates/openhuman-embed/src/agent/spec.rs@@ -346,7 +346,7 @@ impl AgentSpec {/// Observe cumulative usage after each model call or vote to stop before/// the next call. Return `StopDecision::Continue` for observation alone;/// a budget policy can return `StopDecision::Stop`. Scoped to this agent; no runtime-global policy is replaced.- pub fn stop_hook(mut self, hook: std::sync::Arc<dyn crate::seams::StopHook>) -> Self {+ pub fn stop_hook(mut self, hook: std::sync::Arc<dyn crate::seams::StopHook<crate::seams::TurnCost>>) -> Self {self.hooks.push_stop(hook);self}diff --git a/crates/openhuman-embed/src/lib.rs b/crates/openhuman-embed/src/lib.rsindex 150226287b..43e0d09f43 100644--- a/crates/openhuman-embed/src/lib.rs+++ b/crates/openhuman-embed/src/lib.rs@@ -199,6 +199,7 @@ pub use runtime::{pub mod seams {pub use openhuman_core::agent::hooks::{PostTurnHook, ToolHook};pub use openhuman_core::agent::hooks::{ToolHookContext, ToolHookDecision, TurnContext};+ pub use openhuman_core::agent::cost::TurnCost;pub use openhuman_core::agent::stop_hooks::{BudgetStopHook, StopDecision, StopHook, TurnState,};diff --git a/crates/openhuman-embed/src/turn.rs b/crates/openhuman-embed/src/turn.rsindex 3578538990..9e82a4aa67 100644--- a/crates/openhuman-embed/src/turn.rs+++ b/crates/openhuman-embed/src/turn.rs@@ -185,7 +185,7 @@ impl Turn {/// Observe cumulative usage after each model call or vote to stop before/// the next call. Return `StopDecision::Continue` for observation alone;/// a budget policy can return `StopDecision::Stop`. Scoped to this turn; no runtime-global policy is replaced.- pub fn stop_hook(mut self, hook: std::sync::Arc<dyn crate::seams::StopHook>) -> Self {+ pub fn stop_hook(mut self, hook: std::sync::Arc<dyn crate::seams::StopHook<crate::seams::TurnCost>>) -> Self {self.hooks.push_stop(hook);self}diff --git a/crates/openhuman-embed/tests/runtime_agents.rs b/crates/openhuman-embed/tests/runtime_agents.rsindex ba006cac7e..dbafd90ddc 100644--- a/crates/openhuman-embed/tests/runtime_agents.rs+++ b/crates/openhuman-embed/tests/runtime_agents.rs@@ -27,7 +27,7 @@ struct RecordingBudgetStopHook {}#[async_trait::async_trait]-impl openhuman_core::agent::stop_hooks::StopHook for RecordingBudgetStopHook {+impl openhuman_core::agent::stop_hooks::StopHook<openhuman_core::agent::cost::TurnCost> for RecordingBudgetStopHook {fn name(&self) -> &str {"budget"}diff --git a/crates/openhuman-embed/tests/usage_hooks.rs b/crates/openhuman-embed/tests/usage_hooks.rsindex fadcffa411..08735c00b0 100644--- a/crates/openhuman-embed/tests/usage_hooks.rs+++ b/crates/openhuman-embed/tests/usage_hooks.rs@@ -6,7 +6,7 @@ use common::{chat_completion, chat_requests, offline_config, route, runtime, scripted_provider,stub_backend, tool_call_completion,};-use openhuman_embed::seams::{StopDecision, StopHook, TurnState};+use openhuman_embed::seams::{StopDecision, StopHook, TurnState, TurnCost};use openhuman_embed::{AgentDefinitionSpec, AgentSpec, HostTurnTools, Runtime, Tool, ToolScopeSpec, Workspace,};@@ -20,7 +20,7 @@ struct Policy {stop: bool,}#[async_trait::async_trait]-impl StopHook for Policy {+impl StopHook<TurnCost> for Policy {fn name(&self) -> &str {"usage-budget"}