Skip to content

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

refactor(tinyagents): thread native context into typed subagent runs

Steven Enamakel90a455bc0bd1
diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs
index c0237ea18d..5757c371a8 100644
--- a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs
@@ -321,6 +321,7 @@ pub(crate) async fn run_subagent_direct_with_native_context(
&parent_for_subagent,
&task_id,
&loaded_config,
+ native,
))
.await
})
@@ -447,6 +448,7 @@ async fn run_typed_mode(
parent: &ParentExecutionContext,
task_id: &str,
config: &LoadedConfig,
+ native: crate::agent::tinyagents::NativeSubagentRunContext,
) -> Result<SubagentRunOutcome, SubagentRunError> {
let started = Instant::now();
@@ -924,5 +926,4 @@ async fn run_typed_mode(
persistence_disposition:
tinyagents_orchestration::subagent::SubagentPersistenceDisposition::TerminalExisting,
})
- .await
}
diff --git a/crates/openhuman-core/src/agent/tinyagents/observability/event_bridge.rs b/crates/openhuman-core/src/agent/tinyagents/observability/event_bridge.rs
index 3ff0df03c9..7f58ad0014 100644
--- a/crates/openhuman-core/src/agent/tinyagents/observability/event_bridge.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/observability/event_bridge.rs
@@ -403,21 +403,22 @@ impl OpenhumanEventBridge {
},
};
let call_cost = cost.usd();
- if let tinyagents_harness::cost::CallCost::Estimated(estimated_cost_usd) = cost
- && let Some(call_id) = self
+ if let tinyagents_harness::cost::CallCost::Estimated(estimated_cost_usd) = cost {
+ if let Some(call_id) = self
.call_ids
.lock()
.unwrap_or_else(std::sync::PoisonError::into_inner)
.get(&iteration)
.cloned()
- {
- self.emit_generation_enrichment(
- call_id,
- tinyagents_harness::events::GenerationEnrichment {
- estimated_cost_usd: Some(estimated_cost_usd),
- ..Default::default()
- },
- );
+ {
+ self.emit_generation_enrichment(
+ call_id,
+ tinyagents_harness::events::GenerationEnrichment {
+ estimated_cost_usd: Some(estimated_cost_usd),
+ ..Default::default()
+ },
+ );
+ }
}
// The context window + cache-creation/reasoning breakdown only exist on
// the carried provider usage (the crate `Usage` mapping drops them); fall
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 add93f5dd1..5233726dda 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_run_finalize.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_run_finalize.rs
@@ -166,13 +166,15 @@ pub(super) async fn finalize_turn_outcome(
false,
hit_cap,
);
- if !defer_terminal_to_caller && let Some(stop_fact) = stop.clone() {
- event_sink.emit(tinyagents_harness::events::AgentEvent::TurnStopped {
- // The event uses a 1-based attempt ordinal, even when the run
- // stopped before the first model request.
- turn: (run.model_calls as u32).max(1),
- stop: stop_fact,
- });
+ if !defer_terminal_to_caller {
+ if let Some(stop_fact) = stop.clone() {
+ event_sink.emit(tinyagents_harness::events::AgentEvent::TurnStopped {
+ // The event uses a 1-based attempt ordinal, even when the run
+ // stopped before the first model request.
+ turn: (run.model_calls as u32).max(1),
+ stop: stop_fact,
+ });
+ }
}
let deferred_terminal = if defer_terminal_to_caller {
Some(crate::agent::tinyagents::turn_outcome::DeferredTurnTerminal {
diff --git a/vendor/tinyagents b/vendor/tinyagents
index ea9bc93407..26048da562 160000
--- a/vendor/tinyagents
+++ b/vendor/tinyagents
@@ -1 +1 @@
-Subproject commit ea9bc934076b34925db904d0f2d7d1b4522d32b8
+Subproject commit 26048da5622a14e365426501aa3d9fda0e8b1de7