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
agent: install the deliverable check from its module
killbill3273c7b579b5
diff --git a/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs b/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rsindex dd8427090c..8346156332 100644--- a/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs+++ b/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs@@ -586,28 +586,12 @@ pub(super) fn assemble_turn_harness(&tool_outcome_sink,memory_turn,);- verify_before_finish::install(- &mut harness,- subagent_scope.is_some(),- tool_policy.as_ref().map(|p| p.agent_definition_id.as_str()),- &wrap_up_fired,- );+ let is_subagent = subagent_scope.is_some();+ let agent_id = tool_policy.as_ref().map(|p| p.agent_definition_id.as_str());+ verify_before_finish::install(&mut harness, is_subagent, agent_id, &wrap_up_fired);// The rungs above all *tell* the turn to produce its deliverable; this one- // looks. Same scope as the requirements check: a sub-agent answers to its- // parent, and the parent's own request is the one that names a file.- if verify_before_finish::applies(- subagent_scope.is_some(),- tool_policy.as_ref().map(|p| p.agent_definition_id.as_str()),- ) {- let turn_budget = harness- .policy()- .limits- .max_wall_clock_ms- .map(std::time::Duration::from_millis);- harness.push_middleware(Arc::new(middleware::UnmetDeliverableMiddleware::new(- turn_budget,- )));- }+ // looks, on the same scope as the requirements check.+ middleware::install_unmet_deliverable(&mut harness, is_subagent, agent_id);// Direct web lookup is bounded. Once enough search/fetch results have// returned, the web tools leave the request so the run works with what itdiff --git a/crates/openhuman-core/src/agent/tinyagents/middleware.rs b/crates/openhuman-core/src/agent/tinyagents/middleware.rsindex 04b85c3529..0f30bb5d4a 100644--- a/crates/openhuman-core/src/agent/tinyagents/middleware.rs+++ b/crates/openhuman-core/src/agent/tinyagents/middleware.rs@@ -63,7 +63,7 @@ pub(crate) use tool_policy::ToolPolicyMiddleware;pub(crate) use turn_context::{render_unanswered_steps, TranscriptSnapshot, TranscriptSnapshotSink, TurnContextMiddleware,};-pub(crate) use unmet_deliverable::UnmetDeliverableMiddleware;+pub(super) use unmet_deliverable::install as install_unmet_deliverable;/// Render the canonical TinyTools content blocks at the OpenHuman boundary./// Middleware that used the retired string-shaped harness result must notdiff --git a/crates/openhuman-core/src/agent/tinyagents/middleware/unmet_deliverable.rs b/crates/openhuman-core/src/agent/tinyagents/middleware/unmet_deliverable.rsindex 88e97fe48b..2b6f446a26 100644--- a/crates/openhuman-core/src/agent/tinyagents/middleware/unmet_deliverable.rs+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/unmet_deliverable.rs@@ -31,7 +31,7 @@//! and the cost of the second case is one advisory sentence.use std::collections::{HashMap, HashSet};-use std::sync::Mutex;+use std::sync::{Arc, Mutex};use async_trait::async_trait;use tinyagents_harness::context::RunContext;@@ -39,6 +39,7 @@ use tinyagents_harness::error::{Result, TinyAgentsError};use tinyagents_harness::middleware::library::TurnClock;use tinyagents_harness::middleware::Middleware;use tinyagents_harness::middleware::ToolInvocationIdentity;+use tinyagents_harness::runtime::AgentHarness;use tinyagents_harness::tinyinference_llm::message::Message;use tinyagents_harness::tinyinference_llm::model::{ModelRequest, ModelResponse};use tinytools::{ToolContent, ToolResult as TaToolResult};@@ -318,8 +319,7 @@ impl<C: Send + Sync> Middleware<(), C> for UnmetDeliverableMiddleware {/// The clock-driven rungs: at half-time a requested path that still does/// not exist is pointed out on the tool result the model is about to/// read, and at 80% the note says to stop exploring and meet the stated- /// limits. Each is appended once per run, and each asks the loop for- /// reasoning on the next call: these are the moments thinking pays.+ /// limits. Each is appended once per run.async fn after_tool(&self,ctx: &mut RunContext<C>,@@ -355,7 +355,6 @@ impl<C: Send + Sync> Middleware<(), C> for UnmetDeliverableMiddleware {"[unmet_deliverable] late note: stop exploring, meet the stated limits");append_note(result, &late_note(&clock));- ctx.request_reasoning();return Ok(());}if band >= HALF_TIME_BAND && !half_noted {@@ -370,7 +369,6 @@ impl<C: Send + Sync> Middleware<(), C> for UnmetDeliverableMiddleware {"[unmet_deliverable] half-time note: requested path still absent");append_note(result, &half_time_note(&missing, &clock));- ctx.request_reasoning();}}Ok(())@@ -421,6 +419,32 @@ impl<C: Send + Sync> Middleware<(), C> for UnmetDeliverableMiddleware {}}+/// Install the check on `harness` on the same scope as the requirements check+/// (`verify_before_finish::applies`): root orchestrator turns only, since a+/// sub-agent answers to its parent and the parent's own request is the one+/// that names a file. The policy-level wall clock is handed over because the+/// middleware cannot read `RunPolicy` from the run context.+pub(crate) fn install<C: Send + Sync + 'static>(+ harness: &mut AgentHarness<(), C>,+ is_subagent: bool,+ agent_definition_id: Option<&str>,+) {+ if !crate::agent::tinyagents::verify_before_finish::applies(is_subagent, agent_definition_id) {+ tracing::debug!(+ is_subagent,+ agent = agent_definition_id.unwrap_or("<none>"),+ "[unmet_deliverable] not installed for this turn"+ );+ return;+ }+ let turn_budget = harness+ .policy()+ .limits+ .max_wall_clock_ms+ .map(std::time::Duration::from_millis);+ harness.push_middleware(Arc::new(UnmetDeliverableMiddleware::new(turn_budget)));+}+#[cfg(test)]#[path = "unmet_deliverable_tests.rs"]mod tests;diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware/unmet_deliverable_tests.rs b/crates/openhuman-core/src/agent/tinyagents/middleware/unmet_deliverable_tests.rsindex d14bf0db93..f3a9a7f918 100644--- a/crates/openhuman-core/src/agent/tinyagents/middleware/unmet_deliverable_tests.rs+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/unmet_deliverable_tests.rs@@ -203,3 +203,62 @@ async fn a_request_naming_no_missing_file_is_left_alone() {.expect("run succeeds");assert_eq!(run.text().as_deref(), Some("done"));}++/// `install` puts the check on a root orchestrator turn with the policy's wall+/// clock, and on nothing else: a sub-agent's answer goes to its parent.+#[tokio::test]+async fn install_covers_root_orchestrator_turns_only() {+ let missing =+ std::env::temp_dir().join(format!("oh-unmet-install-{}.json", std::process::id()));+ let _ = std::fs::remove_file(&missing);+ let request = format!("Do the work and write it to {}", missing.display());+ let script = || {+ Arc::new(ScriptedModel::new(vec![+ tool_round("c0", "writer"),+ tinyagents_harness::tinyinference_llm::model::ModelResponse::assistant(+ "here is what I found".to_string(),+ ),+ tool_round("c1", "writer"),+ tinyagents_harness::tinyinference_llm::model::ModelResponse::assistant(+ "written and answered".to_string(),+ ),+ ]))+ };+ let policy = || RunPolicy {+ limits: RunLimits::default()+ .with_max_model_calls(20)+ .with_max_tool_calls(20)+ .with_max_wall_clock_ms(Some(600_000)),+ ..RunPolicy::default()+ };++ let mut root: AgentHarness<()> = AgentHarness::new();+ root.register_model("mock", script());+ root.register_tool(Arc::new(FakeTool::returning("writer", "ok")));+ root.with_policy(policy());+ install(&mut root, false, Some("orchestrator"));+ let run = root+ .invoke_default(&(), vec![Message::user(request.clone())])+ .await+ .expect("run succeeds");+ assert_eq!(+ run.text().as_deref(),+ Some("written and answered"),+ "a root orchestrator turn is held for the file it never wrote"+ );++ let mut sub: AgentHarness<()> = AgentHarness::new();+ sub.register_model("mock", script());+ sub.register_tool(Arc::new(FakeTool::returning("writer", "ok")));+ sub.with_policy(policy());+ install(&mut sub, true, Some("orchestrator"));+ let run = sub+ .invoke_default(&(), vec![Message::user(request)])+ .await+ .expect("run succeeds");+ assert_eq!(+ run.text().as_deref(),+ Some("here is what I found"),+ "a sub-agent turn is not checked"+ );+}