Skip to content

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

chore: files changed Cargo.toml,crates/openhuman-core/Cargo.toml,crates/openhuman-core/src/agent/cos

Steven Enamakel6bf68b0961e4
diff --git a/Cargo.toml b/Cargo.toml
index 71a6d4e8a0..5d976ce171 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -98,6 +98,7 @@ tinyinference-voice = { path = "vendor/tinyagents/vendor/tinyinference/crates/ti
# own for standalone builds); resolve those names to the one copy the host uses.
tinyagents-live = { path = "vendor/tinyagents/crates/tinyagents-live" }
tinyagents-harness = { path = "vendor/tinyagents/crates/tinyagents-harness" }
+tinyagents-hooks = { path = "vendor/tinyagents/crates/tinyagents-hooks" }
tinytools = { path = "vendor/tinyagents/vendor/tinytools/crates/tinytools" }
tinybus = { path = "vendor/tinybus/crates/tinybus" }
tinybus-macros = { path = "vendor/tinybus/crates/tinybus-macros" }
diff --git a/crates/openhuman-core/Cargo.toml b/crates/openhuman-core/Cargo.toml
index dff75e4c0c..d56bf77c5c 100644
--- a/crates/openhuman-core/Cargo.toml
+++ b/crates/openhuman-core/Cargo.toml
@@ -115,7 +115,8 @@ tinyflows-import = { path = "../../vendor/tinyflows/crates/tinyflows-import", de
# commit 612ea5e "refactor: split tinyagents into focused crates" and follow-on
# work): there is no longer a single `tinyagents` package. openhuman now depends
# directly on the members it actually uses — `tinyagents-harness` (agent loop,
-# tools, middleware), `tinyagents-graph` (durable state graphs),
+# tools, middleware), `tinyagents-hooks` (host-provided lifecycle and stop
+# hooks), `tinyagents-graph` (durable state graphs),
# `tinyagents-registry` (capability/model registry), and
# `tinyagents-session` (durable session history + run ledger, previously gated
# behind this crate's own `sqlite` feature — it is its own always-on crate now).
@@ -146,6 +147,7 @@ tinyagents-harness = { path = "../../vendor/tinyagents/crates/tinyagents-harness
"multimodal",
"builtin-tools",
] }
+tinyagents-hooks = { path = "../../vendor/tinyagents/crates/tinyagents-hooks" }
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/cost_tests.rs b/crates/openhuman-core/src/agent/cost_tests.rs
index 4ebf70afca..3cf7e4a903 100644
--- a/crates/openhuman-core/src/agent/cost_tests.rs
+++ b/crates/openhuman-core/src/agent/cost_tests.rs
@@ -9,7 +9,7 @@ fn counts(input: u64, output: u64, cached: u64) -> BilledUsage {
/// harness `ModelResponse` (the host's wire form, charge in `raw`) recorded by
/// the harness `StopHookMetrics` impl, priced through the catalog lookup.
fn record(turn: &mut tinyagents_harness::cost::TurnCost, model: &str, usage: &BilledUsage) {
- use tinyagents_harness::middleware::StopHookMetrics as _;
+ use tinyagents_hooks::stop::StopHookMetrics as _;
let response = crate::agent::tinyagents::model::native_model_response_for_request(
&crate::inference::provider::ChatResponse {
text: Some("ok".into()),
diff --git a/crates/openhuman-core/src/agent/goals/runtime.rs b/crates/openhuman-core/src/agent/goals/runtime.rs
index 7c43f1c910..c26d578db0 100644
--- a/crates/openhuman-core/src/agent/goals/runtime.rs
+++ b/crates/openhuman-core/src/agent/goals/runtime.rs
@@ -27,7 +27,7 @@ use tinyagents_graph::goals::{BudgetVerdict, GoalBudgetGuard, ThreadGoal, Thread
use super::store::{self, goals_store};
use crate::core::bus::BUS;
use crate::core::events::DomainEvent;
-use tinyagents_harness::middleware::{StopDecision, StopHook, TurnState};
+use tinyagents_hooks::stop::{StopDecision, StopHook, TurnState};
/// Load the goal for an explicitly supplied chat thread.
pub async fn load_for_thread(workspace_dir: &Path, thread_id: Option<&str>) -> Option<ThreadGoal> {
diff --git a/crates/openhuman-core/src/agent/hooks_scope.rs b/crates/openhuman-core/src/agent/hooks_scope.rs
index 153f398516..336b803a17 100644
--- a/crates/openhuman-core/src/agent/hooks_scope.rs
+++ b/crates/openhuman-core/src/agent/hooks_scope.rs
@@ -20,7 +20,7 @@ pub struct HookScope {
tools: Vec<Arc<dyn ToolHook>>,
post_turn: Vec<Arc<dyn PostTurnHook>>,
stop:
- Vec<Arc<dyn tinyagents_harness::middleware::StopHook<tinyagents_harness::cost::TurnCost>>>,
+ Vec<Arc<dyn tinyagents_hooks::stop::StopHook<tinyagents_harness::cost::TurnCost>>>,
}
impl HookScope {
@@ -37,7 +37,7 @@ impl HookScope {
/// Append a usage observer/budget policy checked after each model call.
pub fn push_stop(
&mut self,
- hook: Arc<dyn tinyagents_harness::middleware::StopHook<tinyagents_harness::cost::TurnCost>>,
+ hook: Arc<dyn tinyagents_hooks::stop::StopHook<tinyagents_harness::cost::TurnCost>>,
) {
self.stop.push(hook);
}
@@ -55,7 +55,7 @@ impl HookScope {
/// The scope's own stop policies, in registration order.
pub fn stop_hooks(
&self,
- ) -> &[Arc<dyn tinyagents_harness::middleware::StopHook<tinyagents_harness::cost::TurnCost>>]
+ ) -> &[Arc<dyn tinyagents_hooks::stop::StopHook<tinyagents_harness::cost::TurnCost>>]
{
&self.stop
}
diff --git a/crates/openhuman-core/src/agent/stop_hooks.rs b/crates/openhuman-core/src/agent/stop_hooks.rs
index 02116dab85..4853550991 100644
--- a/crates/openhuman-core/src/agent/stop_hooks.rs
+++ b/crates/openhuman-core/src/agent/stop_hooks.rs
@@ -22,7 +22,7 @@
use async_trait::async_trait;
use tinyagents_harness::cost::TurnCost;
-use tinyagents_harness::middleware::{StopDecision, StopHook, TurnState};
+use tinyagents_hooks::stop::{StopDecision, StopHook, TurnState};
/// Stop a turn when its cumulative cost reaches the configured USD cap.
#[derive(Debug, Clone, Copy)]
diff --git a/crates/openhuman-core/src/agent/tinyagents/budget_stop_turn_tests.rs b/crates/openhuman-core/src/agent/tinyagents/budget_stop_turn_tests.rs
index 1193724aa5..b35af166cf 100644
--- a/crates/openhuman-core/src/agent/tinyagents/budget_stop_turn_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/budget_stop_turn_tests.rs
@@ -6,7 +6,7 @@ use crate::agent::stop_hooks::BudgetStopHook;
use crate::agent::tinyagents::TurnModelSource;
use async_trait::async_trait;
use std::sync::Arc;
-use tinyagents_harness::middleware::{StopDecision, StopHook, TurnState};
+use tinyagents_hooks::stop::{StopDecision, StopHook, TurnState};
use tinyinference_llm::model::{ChatModel, ModelProfile, ModelRequest, ModelResponse};
use tinyinference_llm::tool::ToolCall;
use tinyinference_llm::usage::Usage;
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs
index 03e1c6e13e..37c203730a 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs
@@ -24,7 +24,7 @@ use crate::agent::tinyagents::{
};
use crate::agent::turn_origin::AgentTurnOrigin;
use tinyagents_definition::SandboxMode;
-use tinyagents_harness::middleware::StopHook;
+use tinyagents_hooks::stop::StopHook;
use tinyagents_harness::store::InMemoryStore as ToolResultArtifactIndexStore;
use tinyagents_harness::turn_outcome::{ToolCallOutcome, ToolOutcomeSink};
use tinyinference_llm::model::ResolvedModelRoute;
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware/memory_pack.rs b/crates/openhuman-core/src/agent/tinyagents/middleware/memory_pack.rs
index 622054807b..86a1fde7f2 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware/memory_pack.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/memory_pack.rs
@@ -7,7 +7,7 @@
//! ephemeral instruction, so the pack is never committed to the thread's
//! history or the provider's cached prefix.
-use tinyagents_harness::middleware::MemoryPackSource;
+use tinyagents_hooks::lifecycle::MemoryPackSource;
use crate::agent::tinyagents::host::OpenHumanRunContext;
@@ -28,8 +28,8 @@ impl MemoryPackSource<OpenHumanRunContext> for TurnMemoryPack {
/// The harness middleware over [`TurnMemoryPack`].
pub(crate) fn memory_pack_middleware(
-) -> tinyagents_harness::middleware::MemoryPackMiddleware<OpenHumanRunContext, TurnMemoryPack> {
- tinyagents_harness::middleware::MemoryPackMiddleware::new(TurnMemoryPack)
+) -> tinyagents_hooks::lifecycle::MemoryPackMiddleware<OpenHumanRunContext, TurnMemoryPack> {
+ tinyagents_hooks::lifecycle::MemoryPackMiddleware::new(TurnMemoryPack)
}
#[cfg(test)]
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware/packed_tool_route.rs b/crates/openhuman-core/src/agent/tinyagents/middleware/packed_tool_route.rs
index 77125b0c18..bdfd73b464 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware/packed_tool_route.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/packed_tool_route.rs
@@ -8,7 +8,7 @@
//! and that pack's group is `Withheld`. No session (sub-agent, channel/CLI
//! turns) means no routing, so the registration allowlist stays the boundary.
-use tinyagents_harness::middleware::{PackedToolRouteMiddleware, PackedToolRouter};
+use tinyagents_hooks::lifecycle::{PackedToolRouteMiddleware, PackedToolRouter};
use tinyagents_harness::tool::packs::USE_SKILL;
use tinytools::ToolPolicySession;
diff --git a/crates/openhuman-core/src/agent/tinyagents/stop_hooks.rs b/crates/openhuman-core/src/agent/tinyagents/stop_hooks.rs
index 3bf907c03f..0110e3cff7 100644
--- a/crates/openhuman-core/src/agent/tinyagents/stop_hooks.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/stop_hooks.rs
@@ -2,8 +2,7 @@
use std::sync::Arc;
use tinyagents_harness::cost::TurnCost;
-use tinyagents_harness::middleware::library::StopHookMiddleware;
-use tinyagents_harness::middleware::StopHook;
+use tinyagents_hooks::stop::{StopHook, StopHookMiddleware};
use tinyagents_harness::steering::SteeringHandle;
/// Install product policies and preserve the host-facing halt summary.
@@ -34,7 +33,7 @@ pub(super) fn install(
fn record_halt_summary(
halt_summary: &tinyagents_harness::turn_outcome::HaltSummarySlot,
- report: &tinyagents_harness::middleware::library::StopReport,
+ report: &tinyagents_hooks::stop::StopReport,
) {
*halt_summary
.lock()
diff --git a/crates/openhuman-core/src/agent/tinyagents/stop_hooks_tests.rs b/crates/openhuman-core/src/agent/tinyagents/stop_hooks_tests.rs
index 2396e0a76b..f11d96cc02 100644
--- a/crates/openhuman-core/src/agent/tinyagents/stop_hooks_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/stop_hooks_tests.rs
@@ -13,7 +13,7 @@ fn a_poisoned_halt_summary_does_not_abort_stop_reporting() {
.is_err());
record_halt_summary(
&slot,
- &tinyagents_harness::middleware::library::StopReport {
+ &tinyagents_hooks::stop::StopReport {
hook: "budget".into(),
reason: "limit reached".into(),
iteration: 2,
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs b/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs
index 7ab70460b8..3c93db3920 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs
@@ -20,10 +20,11 @@ use tinyagents_harness::middleware::{
};
use tinyagents_harness::middleware::{
plan_mode_middleware, ApprovalGateMiddleware, ArgRecoveryMiddleware, BudgetLimits,
- BudgetMiddleware, BudgetParityObserver, ContextCompressionMiddleware,
+ BudgetMiddleware, ContextCompressionMiddleware,
PromptCacheGuardMiddleware, RepeatProgressMiddleware, RunModeHandle,
ToolPolicyMiddleware as TaToolPolicyMiddleware,
};
+use tinyagents_hooks::lifecycle::BudgetParityObserver;
use tinyagents_harness::runtime::AgentHarness;
use tinyagents_harness::steering::SteeringHandle;
use tinyagents_harness::turn_outcome::{HaltSummarySlot, ToolOutcomeSink};