Skip to content

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

fix(subagent): treat estimated costs as estimates in usage reporting

Steven Enamakelab3b1f4fc7c4
diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/graph/dispatch.rs b/crates/openhuman-core/src/agent/subagent_host/ops/graph/dispatch.rs
index 89a0599fe2..e1dd298528 100644
--- a/crates/openhuman-core/src/agent/subagent_host/ops/graph/dispatch.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/ops/graph/dispatch.rs
@@ -417,7 +417,10 @@ pub(in super::super) async fn run_subagent_via_graph(
.with_cached_input_tokens(u.cached_input_tokens())
.with_cache_creation_tokens(u.cache_creation_tokens)
.with_reasoning_tokens(u.reasoning_tokens);
- let billed = if u.charged_amount_usd.is_finite() && u.charged_amount_usd > 0.0 {
+ let billed = if !u.cost_is_estimate
+ && u.charged_amount_usd.is_finite()
+ && u.charged_amount_usd > 0.0
+ {
billed.with_charged_usd(call_cost)
} else {
billed.with_estimated_usd(call_cost)
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 3f03b3f1a5..cdb1c0ef27 100644
--- a/crates/openhuman-core/src/agent/tinyagents/observability/event_bridge.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/observability/event_bridge.rs
@@ -402,7 +402,7 @@ impl OpenhumanEventBridge {
iteration,
charged_from_provider = carried
.as_ref()
- .map(|u| u.charged_amount_usd > 0.0)
+ .map(|u| !u.cost_is_estimate && u.charged_amount_usd > 0.0)
.unwrap_or(false),
call_cost,
context_window,