The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
test(agent): pin multi-call turn cost totals
Steven Enamakele7f2930b1517
diff --git a/crates/openhuman-core/src/agent/cost_tests.rs b/crates/openhuman-core/src/agent/cost_tests.rsindex 2cd6f281b7..7d9f36ad4e 100644--- a/crates/openhuman-core/src/agent/cost_tests.rs+++ b/crates/openhuman-core/src/agent/cost_tests.rs@@ -109,3 +109,37 @@ fn unknown_model_has_no_known_price() {None);}++/// Regression pin for the move of the cost vocabulary into the harness: a+/// scripted four-call turn (two charged, one catalogue-estimated, one free+/// route) totals exactly what it did before the cutover.+#[test]+fn a_scripted_multi_call_turn_totals_are_unchanged() {+ let calls = [+ (+ UNCATALOGUED,+ counts(4_000, 200, 3_000).with_charged_usd(0.0125),+ ),+ (+ UNCATALOGUED,+ counts(4_500, 150, 4_000).with_charged_usd(0.0075),+ ),+ // 1M uncached input at $3 + 1M cached at $0.30 + 1M output at $15.+ (CATALOGUED, counts(2_000_000, 1_000_000, 1_000_000)),+ ("vendor/model:free", counts(900, 50, 0)),+ ];+ let mut turn = TurnCost::new();+ for (model, usage) in &calls {+ turn.add_call(model, usage);+ }+ assert_eq!(turn.call_count, 4);+ assert_eq!(turn.input_tokens, 2_009_400);+ assert_eq!(turn.output_tokens, 1_000_400);+ assert_eq!(turn.cached_input_tokens, 1_007_000);+ assert_eq!(turn.cost.source, CostSource::Estimated);+ let total = turn.total_usd().expect("every call is priced");+ assert!(+ (total - (0.0125 + 0.0075 + 18.30)).abs() < 1e-9,+ "total {total}"+ );+}