Skip to content

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

refactor(agent): apply budget wrapping to native model set

Steven Enamakel9875dea2f699
diff --git a/crates/openhuman-core/src/agent/tinyagents/budget.rs b/crates/openhuman-core/src/agent/tinyagents/budget.rs
index 7e29c8362e..663a5e8ac4 100644
--- a/crates/openhuman-core/src/agent/tinyagents/budget.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/budget.rs
@@ -59,6 +59,19 @@ impl crate::inference::turn_models::TurnModels {
let Some(budget) = budget else {
return self;
};
+ if let Some(models) = self.native_model_set.take() {
+ let models = models.map_models(|_, model| budget.wrap(model));
+ let mut registrations = models.registrations("primary").into_iter();
+ self.primary = registrations
+ .next()
+ .expect("native turn set contains its primary")
+ .1;
+ self.routes = registrations.collect();
+ self.summarizer = models.summarizer();
+ self.error_slot = models.primary_error_slot();
+ self.native_model_set = Some(models);
+ return self;
+ }
self.primary = budget.wrap(self.primary);
self.summarizer = budget.wrap(self.summarizer);
for (_, route) in &mut self.routes {
diff --git a/crates/openhuman-core/src/inference/turn_models.rs b/crates/openhuman-core/src/inference/turn_models.rs
index 8c70300f07..8030100d68 100644
--- a/crates/openhuman-core/src/inference/turn_models.rs
+++ b/crates/openhuman-core/src/inference/turn_models.rs
@@ -25,7 +25,7 @@ pub(crate) struct TurnModels {
pub(crate) error_slot: tinyinference_llm::model::ModelErrorSlot,
/// Native owner set retained so its route and primary error slots are
/// applied after host decorators such as the turn budget.
- native_model_set: Option<tinyagents_harness::host::TurnModelSet<()>>,
+ pub(crate) native_model_set: Option<tinyagents_harness::host::TurnModelSet<()>>,
/// Provider telemetry id (`{provider_id}.{model}` in Langfuse), captured from
/// the source `Provider` at build time. Carried here (issue #4249, Phase 3 /
/// Motion A) so the harness turn path no longer reads it off a raw