Skip to content

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

chore(tinyagents): delegate halt summary to stop hook middleware

Steven Enamakel2ec08264570b
diff --git a/crates/openhuman-core/Cargo.toml b/crates/openhuman-core/Cargo.toml
index d56bf77c5c..98078b8638 100644
--- a/crates/openhuman-core/Cargo.toml
+++ b/crates/openhuman-core/Cargo.toml
@@ -147,7 +147,7 @@ tinyagents-harness = { path = "../../vendor/tinyagents/crates/tinyagents-harness
"multimodal",
"builtin-tools",
] }
-tinyagents-hooks = { path = "../../vendor/tinyagents/crates/tinyagents-hooks" }
+tinyagents-hooks = { path = "../../vendor/tinyagents/crates/tinyagents-hooks", default-features = false }
tinybox-bus = { path = "../../vendor/tinybox/crates/tinybox-bus", features = ["storage"] }
tiny-artifacts = { path = "../../vendor/tiny-artifacts/crates/tiny-artifacts" }
tinyagents-definition = { path = "../../vendor/tinyagents/crates/tinyagents-definition" }
diff --git a/crates/openhuman-core/src/agent/tinyagents/stop_hooks.rs b/crates/openhuman-core/src/agent/tinyagents/stop_hooks.rs
index 80d5cbde01..a7652a22e2 100644
--- a/crates/openhuman-core/src/agent/tinyagents/stop_hooks.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/stop_hooks.rs
@@ -17,6 +17,7 @@ pub(super) fn install(
harness.push_middleware(Arc::new(
StopHookMiddleware::new(model, hooks)
.with_metrics_seed(crate::agent::cost::turn_cost())
+ .with_halt_summary(halt_summary)
.with_stop_observer(move |report| {
tracing::warn!(
target: "stop_hooks",
@@ -25,24 +26,11 @@ pub(super) fn install(
model = %report.model,
"[stop_hooks] hook voted to stop the turn — pausing run: {}", report.reason
);
- record_halt_summary(&halt_summary, report);
}),
));
}
}
-fn record_halt_summary(
- halt_summary: &tinyagents_harness::turn_outcome::HaltSummarySlot,
- report: &tinyagents_hooks::stop::StopReport,
-) {
- *halt_summary
- .lock()
- .unwrap_or_else(std::sync::PoisonError::into_inner) = Some(format!(
- "Stopping after {} model call(s): {}",
- report.iteration, report.reason
- ));
-}
-
#[cfg(test)]
#[path = "stop_hooks_tests.rs"]
mod tests;