Skip to content

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

feat(agent): add run context and turn finalization for tinyagents

Steven Enamakel3e590e3ff91a
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 18c2ff4a8e..d48cfa1dd0 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs
@@ -125,6 +125,13 @@ pub(crate) struct SessionTurnSidecar {
/// subtracts it from its own start to log how long the durable commit
/// took (`[session-runtime] post-commit`).
pub driver_finished_at: Option<std::time::Instant>,
+ /// Set by the deadline wind-down middleware when it paused this turn
+ /// (`tinyagents::deadline_wind_down`).
+ pub wind_down: bool,
+ /// How the turn was stopped early, if it was (breaker, wind-down,
+ /// iteration cap). The driver classifies it; `after_commit` carries it on
+ /// `TurnCompleted` so the trace shows a stopped turn at `WARNING`.
+ pub stop: Option<crate::agent::turn_stop::TurnStop>,
}
/// Immutable inputs to the host's pre-dispatch policy.
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_run_finalize.rs b/crates/openhuman-core/src/agent/tinyagents/turn_run_finalize.rs
index 2ea07936cb..a2aebdc72b 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_run_finalize.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_run_finalize.rs
@@ -133,6 +133,7 @@ pub(super) async fn finalize_turn_outcome(
if let Err(err) = sink
.send(AgentProgress::TurnCompleted {
iterations: run.model_calls as u32,
+ stop: None,
})
.await
{