Skip to content

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

refactor(tinyagents): use shared tool hooks middleware

Steven Enamakel4a7770db10ba
diff --git a/crates/openhuman-core/src/agent/tinyagents/live_harness.rs b/crates/openhuman-core/src/agent/tinyagents/live_harness.rs
index 3074684ca4..41de2d2627 100644
--- a/crates/openhuman-core/src/agent/tinyagents/live_harness.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/live_harness.rs
@@ -128,7 +128,9 @@ pub(crate) fn assemble_live_tool_harness(
embedder_tool_hooks.extend(tool_hooks);
if !embedder_tool_hooks.is_empty() {
harness.push_middleware(Arc::new(
- middleware::embedder_hooks::EmbedderToolHooksMiddleware::new(embedder_tool_hooks),
+ tinyagents_hooks::tool::ToolHooksMiddleware::<super::host::OpenHumanRunContext>::new(
+ embedder_tool_hooks,
+ ),
));
}
harness
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware.rs b/crates/openhuman-core/src/agent/tinyagents/middleware.rs
index 8fb4cbe17e..00ffd02bcd 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware.rs
@@ -26,7 +26,6 @@
pub(crate) mod approval;
pub(crate) mod credential_scrub;
-pub(crate) mod embedder_hooks;
pub(crate) mod failure_policy;
pub(crate) mod fetched_site;
pub(crate) mod memory_pack;
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs b/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs
index 79af97abb5..3df02fe1a2 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs
@@ -571,7 +571,9 @@ pub(super) fn install_turn_middleware(
embedder_tool_hooks.extend(scoped_tool_hooks);
if !embedder_tool_hooks.is_empty() {
harness.push_middleware(Arc::new(
- middleware::embedder_hooks::EmbedderToolHooksMiddleware::new(embedder_tool_hooks),
+ tinyagents_hooks::tool::ToolHooksMiddleware::<super::host::OpenHumanRunContext>::new(
+ embedder_tool_hooks,
+ ),
));
}