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
feat(tinyagents): track turn outcomes and finalize runs
Steven Enamakel37af48ef1ec0
diff --git a/crates/openhuman-core/src/agent/tinyagents/mod.rs b/crates/openhuman-core/src/agent/tinyagents/mod.rsindex c043f4402a..ba9d9c553c 100644--- a/crates/openhuman-core/src/agent/tinyagents/mod.rs+++ b/crates/openhuman-core/src/agent/tinyagents/mod.rs@@ -85,9 +85,7 @@ pub(crate) use reasoning::{apply_requested_effort, parse_reasoning_effort};pub(crate) use topology::all_graph_topologies;pub use turn_models::TurnModelSource;pub(crate) use turn_models::TurnModels;-pub(crate) use turn_outcome::{- HaltSummarySlot, TinyagentsTurnOutcome, ToolCallOutcome, ToolOutcomeSink,-};+pub(crate) use turn_outcome::TinyagentsTurnOutcome;#[cfg(test)]pub(crate) use turn_policy::{agent_turn_wall_clock_ms, is_subagent_spawn_or_delegate_tool};pub(crate) use turn_policy::{diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_outcome.rs b/crates/openhuman-core/src/agent/tinyagents/turn_outcome.rsindex e5a8310aa3..e0909e8022 100644--- a/crates/openhuman-core/src/agent/tinyagents/turn_outcome.rs+++ b/crates/openhuman-core/src/agent/tinyagents/turn_outcome.rs@@ -3,6 +3,7 @@use tinyagents_session::transcript::TranscriptMessage;use tinyinference_llm::model::ResolvedModelRoute;+use tinyagents_harness::turn_outcome::ToolCallOutcome;use tinytools_agent::dialect::TranscriptEntry;/// The outcome of a turn driven on the `tinyagents` harness.@@ -83,48 +84,6 @@ pub(crate) struct TinyagentsTurnOutcome {pub compaction: Option<tinyagents_harness::summarization::CompactionCarry>,}-/// Whether a run's final response is a reply that ran out of output tokens-/// before producing anything: `finish_reason = length`, no visible text and no-/// tool call. See [`TinyagentsTurnOutcome::truncated`].-pub(crate) fn ended_out_of_output_budget(- final_response: Option<&tinyinference_llm::model::ModelResponse>,-) -> bool {- final_response.is_some_and(|response| {- response.finish_reason.as_deref() == Some("length")- && response.message.tool_calls.is_empty()- && response.text().trim().is_empty()- })-}--/// One tool call's execution outcome, captured at the tool boundary before the-/// harness discards the failure flag. `success` mirrors the absence of a-/// `TaToolResult::error`; `content` is the (possibly summarized/capped) result-/// text used to derive a sanitized post-turn summary.-#[derive(Debug, Clone)]-pub(crate) struct ToolCallOutcome {- pub call_id: String,- pub name: String,- /// The exact structured arguments supplied for this invocation. They are- /// captured at `before_tool`, while the native `ToolCall` is still- /// available, so post-commit hooks and transcript usage never have to- /// reconstruct arguments from provider prose.- pub arguments: serde_json::Value,- pub success: bool,- pub content: String,- /// Measured wall-clock runtime for this concrete tool invocation.- pub duration_ms: u64,-}--/// Shared sink the [`ToolOutcomeCaptureMiddleware`](super::middleware::ToolOutcomeCaptureMiddleware)-/// appends each tool call's outcome to, drained into the turn outcome.-pub(crate) type ToolOutcomeSink = std::sync::Arc<std::sync::Mutex<Vec<ToolCallOutcome>>>;--/// Shared slot the repeated-failure breaker writes a root-cause halt summary into-/// when it trips. The turn overrides its final text with this summary so the-/// no-progress halt surfaces the cause instead of an empty/last-model reply-/// (legacy `RepeatFailureGuard` parity).-pub(crate) type HaltSummarySlot = std::sync::Arc<std::sync::Mutex<Option<String>>>;-/// Feed an **unobserved** turn's aggregate usage into the global cost tracker.////// The per-call tracker feed lives in the event bridgediff --git a/crates/openhuman-core/src/agent/tinyagents/turn_run_finalize.rs b/crates/openhuman-core/src/agent/tinyagents/turn_run_finalize.rsindex a180025948..611cf6beab 100644--- a/crates/openhuman-core/src/agent/tinyagents/turn_run_finalize.rs+++ b/crates/openhuman-core/src/agent/tinyagents/turn_run_finalize.rs@@ -16,9 +16,8 @@ use crate::agent::progress::AgentProgress;use crate::agent::tinyagents::journal::TurnJournal;use crate::agent::tinyagents::observability::{self, OpenhumanEventBridge, SubagentScope};use crate::agent::tinyagents::tools::EarlyExitHook;-use crate::agent::tinyagents::turn_outcome::{- HaltSummarySlot, TinyagentsTurnOutcome, ToolOutcomeSink,-};+use crate::agent::tinyagents::turn_outcome::TinyagentsTurnOutcome;+use tinyagents_harness::turn_outcome::{HaltSummarySlot, ToolOutcomeSink};/// Assemble the [`TinyagentsTurnOutcome`] for a run that returned/// successfully: stamp the durable journal's completed status, surface