Skip to content

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

fix(tinyagents): fall back to configured provider when route is unresolved

Steven Enamakelcc1ba788c545
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs b/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs
index bdde2ce640..c84345223f 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs
@@ -451,7 +451,6 @@ async fn drive_turn(
.as_ref()
.and_then(|identity| identity.agent_id.as_deref()),
);
- bridge.set_native_events(sink.clone());
sink.subscribe(bridge.clone());
bridge
};
@@ -581,6 +580,7 @@ async fn drive_turn(
&mut prepared.harness,
&steering,
TurnMiddlewareInputs {
+ provider_id: provider_id.clone(),
model: model.to_string(),
tool_sets,
allowed,
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs b/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs
index cb1e3e7441..a8d877cb89 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs
@@ -43,6 +43,8 @@ use super::ToolPolicyEnforcement;
/// What the middleware stack needs to know about the turn.
pub(super) struct TurnMiddlewareInputs {
+ /// Configured provider id used only when the response has no resolved route.
+ pub(super) provider_id: String,
/// The turn's primary model name.
pub(super) model: String,
/// The shared tool sets the turn's tools resolve against.
@@ -122,6 +124,7 @@ pub(super) fn install_turn_middleware(
inputs: TurnMiddlewareInputs,
) -> TurnWiring {
let TurnMiddlewareInputs {
+ provider_id,
model,
tool_sets,
allowed,
@@ -182,7 +185,10 @@ pub(super) fn install_turn_middleware(
// TinyInference decorator attached in `turn_models` stamps the successful
// unary response and the streamed terminal response, and this middleware
// moves that metadata into the explicit OpenHuman carrier.
- harness.push_model_middleware(Arc::new(routes::ResolvedRouteMiddleware));
+ harness.push_model_middleware(Arc::new(routes::ResolvedRouteMiddleware::new(
+ provider_id,
+ model,
+ )));
// Per-call capability gate (issue #4249, Workstream 02.1): when the turn has
// derivable capability needs (today: vision for a `hint:vision` turn), stamp