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
Merge remote-tracking branch 'upstream/main' into jev-tool-search
Steven Enamakel61572b4f9a94
diff --cc crates/openhuman-cli/Cargo.tomlindex f69bb60c41,dd24ca43ae..1fcc77a042--- a/crates/openhuman-cli/Cargo.toml+++ b/crates/openhuman-cli/Cargo.toml@@@ -56,14 -56,13 +56,21 @@@ required-features = ["http-server", "bi# backend. What the feature used to name the engine crates for was two# `library-profile` *scenarios* — see that target's comment below; the binary# itself is still here.+# `tool-search-bench` — the `tool_search` ranker comparison (bm25 / overlap /+# jev) over the real orchestrator registry plus the recorded Composio+# catalogues. Always builds; the `jev` ranker is compiled in with the `jev`+# feature and runs only when a key is in the environment.+[[bin]]+name = "tool-search-bench"+path = "src/bin/tool_search_bench.rs"++ # Manual, network-touching A/B of the text tool-call dialects against a local+ # Ollama model: prompt tokens and call accuracy per `agent.tool_dispatcher`+ # value. Never run by CI; see the file's docs for the invocation.+ [[bin]]+ name = "tool-dialect-bench"+ path = "src/bin/tool_dialect_bench.rs"+[[bin]]name = "rss-bench"path = "src/bin/rss_bench.rs"diff --cc crates/openhuman-core/src/agent/tinyagents/harness_assembly.rsindex 5a9ac6797e,2718088f54..d919dac1f0--- a/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs+++ b/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs@@@ -144,10 -147,12 +147,17 @@@ pub(super) fn assemble_turn_harnesslet mut policy = run_policy_for(max_iterations, deterministic_cacheable);let route_fallback = routes::route_fallback_policy(model);policy.fallback = route_fallback.clone();+ // Tool discovery: the harness advertises its `tool_search` bridge over the+ // `Deferred` registrations the allowlist admits, ranked by whatever the+ // process installed (`agent::tinyagents::discovery`).+ policy.discovery = super::discovery::discovery_policy();+++ policy.tool_dialect = tool_dialect;+ tracing::debug!(+ model,+ ?tool_dialect,+ "[models] turn harness tool dialect pinned from the session"+ );tracing::debug!(model,fallback_chain = ?route_fallback.as_ref().map(|f| &f.models),diff --cc crates/openhuman-core/src/inference/provider/factory/cloud_slug.rsindex dd6ade80fd,f92094290c..306325867e--- a/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs+++ b/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs@@@ -425,3 -425,29 +425,28 @@@ pub(super) fn try_create_cloud_slug_cha});Some(Ok((chat, effective_model)))}++ /// The `provider.sort` OpenRouter routing preference sent on every request to+ /// a direct (BYOK) OpenRouter endpoint.+ pub(crate) const OPENROUTER_PROVIDER_SORT: &str = "price";++ /// Baked request options for a direct OpenRouter endpoint, `None` for every+ /// other OpenAI-compatible host.+ ///+ /// OpenRouter's default routing is a health-aware load balance weighted toward+ /// the cheaper endpoints of a model's pool, which spreads consecutive turns+ /// across endpoints. DeepSeek- and Z.AI-family prefix caches live per endpoint,+ /// so every hop re-pays the whole prefill. `provider.sort` orders the pool and+ /// disables the balancing (not the fallback: `allow_fallbacks` stays on and+ /// `order` is never set, so a request still moves down the sorted list when an+ /// endpoint errors), and `price` is the stable choice — cheapest first, dearer+ /// only on failure. Stickiness itself comes from the harness's derived+ /// `prompt_cache_key` (`tap-<prefix fingerprint>`), which OpenRouter honours as+ /// its sticky-routing key; measured on `z-ai/glm-5.3-flash` the same endpoint+ /// served 5/5 calls with it. The hosted backend applies the same sort+ /// server-side (tinyhumansai/backend#1370), so managed and direct routing agree.+ /// https://openrouter.ai/docs/features/provider-routing+ pub(crate) fn openrouter_default_provider_options(endpoint: &str) -> Option<serde_json::Value> {+ endpoint_is_openrouter(endpoint)+ .then(|| serde_json::json!({ "provider": { "sort": OPENROUTER_PROVIDER_SORT } }))+ }-diff --cc crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rsindex 8b7ddc4b83,8b298c6f5b..01585d3f00--- a/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rs+++ b/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rs@@@ -714,7 -717,7 +717,6 @@@ async fn caller_owned_models_build_with);}}--#[tokio::test]async fn local_aliases_build_without_a_session_and_preserve_model_ids() {let _guard = crate::inference::inference_test_guard();@@@ -748,3 -751,48 +750,47 @@@assert!(error.to_string().contains("empty model"), "{error}");assert!(!error.to_string().contains("SESSION_EXPIRED"), "{error}");}++ #[test]+ fn direct_openrouter_endpoints_get_price_sorted_routing_and_nothing_else() {+ // Direct BYOK OpenRouter: cheapest-first sort so consecutive turns stay on+ // one endpoint and its prefix cache hits. Only the sort — never `order` or+ // `allow_fallbacks: false`, which would strand a request on an outage, and+ // never a `max_price` (the hosted backend dropped its own for the same+ // reason in tinyhumansai/backend#1370).+ let options = openrouter_default_provider_options("https://openrouter.ai/api/v1")+ .expect("openrouter endpoint carries routing options");+ assert_eq!(OPENROUTER_PROVIDER_SORT, "price");+ assert_eq!(+ options,+ serde_json::json!({ "provider": { "sort": "price" } }),+ "exactly the sort and nothing else: {options}"+ );+ let provider = &options["provider"];+ for forbidden in ["order", "allow_fallbacks", "max_price", "only", "ignore"] {+ assert!(provider.get(forbidden).is_none(), "must not set provider.{forbidden}");+ }+ // Host matching is what keys it, with or without a path or trailing slash.+ assert!(openrouter_default_provider_options("https://openrouter.ai/api/v1/").is_some());+ assert!(openrouter_default_provider_options("https://OpenRouter.ai/api/v1").is_some());+ }++ #[test]+ fn non_openrouter_openai_compatible_endpoints_get_no_baked_provider_options() {+ // `provider` is an OpenRouter-only body field; hosted OpenAI rejects+ // unknown top-level fields and local runners ignore them, so no other+ // OpenAI-compatible host may receive it.+ for endpoint in [+ "https://api.openai.com/v1",+ "https://api.deepseek.com/v1",+ "https://api.groq.com/openai/v1",+ "http://localhost:11434/v1",+ "https://openrouter.example.com/v1",+ "not a url",+ ] {+ assert!(+ openrouter_default_provider_options(endpoint).is_none(),+ "{endpoint} must not get OpenRouter routing options"+ );+ }+ }-diff --cc vendor/tinyagentsindex ae48b2c34f,68b0eb0abc..eefef72b30--- a/vendor/tinyagents+++ b/vendor/tinyagents@@@ -1,1 -1,1 +1,1 @@@- Subproject commit ae48b2c34f7e5e7b84f78ef2693e37ed1ac8c5c8-Subproject commit 68b0eb0abc490541979d9fa2d869f7b4ee0b2189++Subproject commit eefef72b30c4d63cba4442db01c99c2940682302