Skip to content

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

refactor(tinyagents): extract turn context middleware

Steven Enamakel3d4f81d9f807
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware/turn_context.rs b/crates/openhuman-core/src/agent/tinyagents/middleware/turn_context.rs
index 04257a8e8b..bfb21516b8 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware/turn_context.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/turn_context.rs
@@ -325,8 +325,13 @@ impl Middleware<(), crate::agent::tinyagents::host::OpenHumanRunContext>
})
.or(guard.pricing_model.as_deref())
.unwrap_or_default();
- guard.charged_amount_usd +=
- crate::agent::cost::call_cost_usd(cost_model, &host_usage);
+ let call_cost = crate::agent::cost::call_cost(cost_model, &host_usage);
+ tracing::debug!(
+ model = cost_model,
+ ?call_cost,
+ "[cost] per-call cost (charged, catalog estimate, or unknown)"
+ );
+ guard.cost.add(call_cost);
}
if route.is_some() {
guard.resolved_route = route;