Skip to content

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

feat(inference): bypass controlled dispatch when admission is absent

Steven Enamakel53233f137073
diff --git a/crates/openhuman-core/src/inference/host_runtime/ops/complete_once.rs b/crates/openhuman-core/src/inference/host_runtime/ops/complete_once.rs
index 8a67f6be20..13c3d00538 100644
--- a/crates/openhuman-core/src/inference/host_runtime/ops/complete_once.rs
+++ b/crates/openhuman-core/src/inference/host_runtime/ops/complete_once.rs
@@ -133,6 +133,26 @@ pub async fn complete_once_controlled(
budget.ledger.clone(),
budget.call,
));
+ if admission.is_none() {
+ let model: std::sync::Arc<dyn ChatModel<()>> = match (budget, observer) {
+ (Some(budget), observer) => budget.wrap_with_observer(model, observer),
+ (None, Some(observer)) => {
+ let normalized = std::sync::Arc::new(
+ tinyagents_harness::cost::GatewayChargeModel::new(model),
+ );
+ std::sync::Arc::new(
+ tinyagents_harness::observability::physical_dispatch::ObservedChatModel::new(
+ normalized, observer,
+ ),
+ )
+ }
+ (None, None) => model,
+ };
+ return model
+ .invoke(&(), request)
+ .await
+ .map_err(tinyagents_harness::cost::ControlledDispatchError::Model);
+ }
let controlled = tinyagents_harness::cost::ControlledChatModel::new(
model,
tinyagents_harness::cost::DispatchModelOptions::new()