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): parameterize tool hooks by run context
Steven Enamakel9706b66f7cbd
diff --git a/crates/openhuman-core/src/agent/session_host/turn_checkpoint.rs b/crates/openhuman-core/src/agent/session_host/turn_checkpoint.rsindex bdfa6264dc..5a4788ce64 100644--- a/crates/openhuman-core/src/agent/session_host/turn_checkpoint.rs+++ b/crates/openhuman-core/src/agent/session_host/turn_checkpoint.rs@@ -116,15 +116,15 @@ call a tool. Answer instead, and you will be asked to conclude next.";/// One completed tool call, carrying enough of its **actual output** to stand/// in for an answer (issue #6014).///-/// Deliberately not [`ToolCallRecord`](crate::agent::hooks::ToolCallRecord), and the difference is a contract rather+/// Deliberately not the harness's `ToolOutcomeRecord`, and the difference is a contract rather/// than a convenience: that type's `output_summary` is produced by-/// [`sanitize_tool_output`](crate::agent::hooks::sanitize_tool_output),+/// the harness's failure classification,/// which by design "never contains raw tool output or PII" and renders a/// success as `"{tool}: ok (N chars)"`. It feeds the learning pipeline, where/// stripping payloads is the point. A checkpoint the user reads has the/// opposite requirement — it is a substitute for the answer the turn ran out/// of room to give — so it needs the content that type exists to remove.-/// Widening `ToolCallRecord` would have carried raw payloads into every+/// Widening the harness outcome record would have carried raw payloads into every/// learning record as a side effect.pub(crate) struct CheckpointToolResult {/// The tool that ran.diff --git a/crates/openhuman-core/src/agent/session_host/types.rs b/crates/openhuman-core/src/agent/session_host/types.rsindex 55a2cdf0cb..1b39899e4d 100644--- a/crates/openhuman-core/src/agent/session_host/types.rs+++ b/crates/openhuman-core/src/agent/session_host/types.rs@@ -280,7 +280,7 @@ pub struct OpenHumanSessionHost {/// distinguish "the agent paused mid-work" from "the agent asked a/// question" or "the agent finished" — `run_single` only returns the/// checkpoint/final text, with no other signal for which case occurred.- pub(super) post_turn_hooks: Vec<Arc<dyn PostTurnHook>>,+ pub(super) post_turn_hooks: Vec<Arc<dyn LearningSink>>,pub(super) event_session_id: String,pub(super) event_channel: String,/// Recency window handed to every turn's run context so integration@@ -582,7 +582,7 @@ pub struct SessionHostBuilder {pub(super) workflows: Option<Vec<tinyskills::Skill>>,/// OpenHumanSessionHost workflows to surface in the prompt. Populated from `load_workflows`/// at session start; defaults to empty when not explicitly set.- pub(super) post_turn_hooks: Vec<Arc<dyn PostTurnHook>>,+ pub(super) post_turn_hooks: Vec<Arc<dyn LearningSink>>,pub(super) event_session_id: Option<String>,pub(super) event_channel: Option<String>,pub(super) agent_definition_name: Option<String>,diff --git a/crates/openhuman-core/src/agent/tinyagents/live_harness.rs b/crates/openhuman-core/src/agent/tinyagents/live_harness.rsindex 838f6c0d05..cbd001cd82 100644--- a/crates/openhuman-core/src/agent/tinyagents/live_harness.rs+++ b/crates/openhuman-core/src/agent/tinyagents/live_harness.rs@@ -52,7 +52,7 @@ pub(crate) struct LiveToolSurface {pub(crate) has_thread: bool,/// The session's agent/turn tool callbacks, registered after the/// runtime's global ones.- pub(crate) tool_hooks: Vec<Arc<dyn tinyagents_hooks::tool::ToolHook>>,+ pub(crate) tool_hooks: Vec<Arc<dyn tinyagents_hooks::tool::ToolHook<super::host::OpenHumanRunContext>>>,/// The context the session acts under (its embedder hooks come from it).pub(crate) dispatch: crate::core::runtime::DispatchCtx,}diff --git a/crates/openhuman-embed/src/permission.rs b/crates/openhuman-embed/src/permission.rsindex 83bb0feb18..02b7f1afff 100644--- a/crates/openhuman-embed/src/permission.rs+++ b/crates/openhuman-embed/src/permission.rs@@ -26,7 +26,7 @@ impl<F> PermissionHook<F> {}#[async_trait::async_trait]-impl<F> ToolHook for PermissionHook<F>+impl<F> ToolHook<crate::seams::OpenHumanRunContext> for PermissionHook<F>whereF: for<'a> Fn(&'a ToolHookContext) -> PermissionFuture<'a> + Send + Sync,{diff --git a/crates/openhuman-embed/tests/runtime_agents.rs b/crates/openhuman-embed/tests/runtime_agents.rsindex d1d94b2d47..e226057bc9 100644--- a/crates/openhuman-embed/tests/runtime_agents.rs+++ b/crates/openhuman-embed/tests/runtime_agents.rs@@ -22,7 +22,7 @@ use wiremock::{Mock, ResponseTemplate};const API_KEY: &str = "th_test_key";struct RecordingBudgetStopHook {- inner: openhuman_core::agent::stop_hooks::BudgetStopHook,+ inner: tinyagents_hooks::stop::BudgetStopHook,reason: std::sync::Arc<std::sync::Mutex<Option<String>>>,}@@ -288,7 +288,7 @@ fn one_runtime_hosts_independently_configured_agents() {let budgeted_turn = budget_agent.turn("report a metered response").stop_hook(std::sync::Arc::new(RecordingBudgetStopHook {- inner: openhuman_core::agent::stop_hooks::BudgetStopHook::new(1.0),+ inner: tinyagents_hooks::stop::BudgetStopHook::new(1.0),reason: std::sync::Arc::clone(&stop_reason),})).send()