Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(agent): add turn middleware to tinyagents live harness

Steven Enamakele2292b20fa44
diff --git a/crates/openhuman-core/src/agent/session_host/builder/factory.rs b/crates/openhuman-core/src/agent/session_host/builder/factory.rs
index 2425c416ef..36687f1d6f 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/factory.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/factory.rs
@@ -389,7 +389,7 @@ impl OpenHumanSessionHost {
None => SystemPromptBuilder::with_defaults(),
};
let post_turn_hooks: Vec<Arc<dyn crate::agent::hooks::PostTurnHook>> =
- crate::agent::hooks::embedder_post_turn_hooks();
+ crate::agent::hooks::embedder_post_turn_hooks_in(&crate::core::runtime::DispatchCtx::ambient());
// Best-effort prewarm from the shared Composio cache. This avoids
// building the session with a knowingly stale `&[]` integration view
diff --git a/crates/openhuman-core/src/agent/tinyagents/live_harness.rs b/crates/openhuman-core/src/agent/tinyagents/live_harness.rs
index 22e4051844..1a85b13785 100644
--- a/crates/openhuman-core/src/agent/tinyagents/live_harness.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/live_harness.rs
@@ -121,7 +121,7 @@ pub(crate) fn assemble_live_tool_harness(
route_session,
),
));
- let mut embedder_tool_hooks = crate::agent::hooks::embedder_tool_hooks();
+ let mut embedder_tool_hooks = crate::agent::hooks::embedder_tool_hooks_in(&crate::core::runtime::DispatchCtx::ambient());
embedder_tool_hooks.extend(tool_hooks);
if !embedder_tool_hooks.is_empty() {
harness.push_middleware(Arc::new(
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs b/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs
index 19e23804dd..b406d4077d 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs
@@ -562,7 +562,7 @@ pub(super) fn install_turn_middleware(
// observation-only (never mutates the result), so running first in the
// reverse-order `after_tool` chain is safe — it cannot perturb the
// summarization/cap or tool-outcome capture layers.
- let mut embedder_tool_hooks = crate::agent::hooks::embedder_tool_hooks();
+ let mut embedder_tool_hooks = crate::agent::hooks::embedder_tool_hooks_in(&crate::core::runtime::DispatchCtx::ambient());
embedder_tool_hooks.extend(scoped_tool_hooks);
if !embedder_tool_hooks.is_empty() {
harness.push_middleware(Arc::new(