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
feat(embed): add provider options and reasoning effort to routes
Steven Enamakeldf3ae7b0183d
diff --git a/crates/openhuman-core/src/config/schema/ephemeral_route.rs b/crates/openhuman-core/src/config/schema/ephemeral_route.rsindex 020e2e6edc..5b379a0830 100644--- a/crates/openhuman-core/src/config/schema/ephemeral_route.rs+++ b/crates/openhuman-core/src/config/schema/ephemeral_route.rs@@ -63,6 +63,13 @@ pub struct EphemeralRoute {/// Custom headers scoped to this endpoint, never copied to unrelated providers.#[serde(default)]pub headers: Vec<(String, String)>,+ /// Provider-specific options used as defaults for this route's requests.+ /// A request's own options are merged over these values.+ #[serde(default)]+ pub provider_options: Option<serde_json::Value>,+ /// Reasoning effort pinned to this route's model, when configured.+ #[serde(default)]+ pub reasoning_effort: Option<String>,}impl std::fmt::Debug for EphemeralRoute {@@ -74,6 +81,8 @@ impl std::fmt::Debug for EphemeralRoute {).field("api_key", &"[redacted]").field("header_count", &self.headers.len())+ .field("provider_options", &self.provider_options.is_some())+ .field("reasoning_effort", &self.reasoning_effort).finish()}}@@ -91,6 +100,8 @@ impl EphemeralRoute {endpoint,api_key,headers: Vec::new(),+ provider_options: None,+ reasoning_effort: None,})}@@ -99,6 +110,18 @@ impl EphemeralRoute {self.headers = headers;self}++ /// Set provider-specific defaults for this route.+ pub fn with_provider_options(mut self, options: Option<serde_json::Value>) -> Self {+ self.provider_options = options;+ self+ }++ /// Set the route model's reasoning effort.+ pub fn with_reasoning_effort(mut self, effort: Option<String>) -> Self {+ self.reasoning_effort = effort;+ self+ }}/// Point `config`'s agent-turn roles at `route`, in memory.@@ -131,6 +154,12 @@ pub fn apply(config: &mut crate::config::Config, route: EphemeralRoute) {};let provider_string = format!("{EPHEMERAL_ROUTE_SLUG}:{model}");+ if let Some(effort) = route.reasoning_effort.as_deref() {+ config+ .runtime+ .reasoning_effort_by_model+ .insert(model.clone(), effort.to_string());+ }let route_is_unchanged = config.ephemeral_route.as_ref() == Some(&route);let roles_match = [config.chat_provider.as_deref(),diff --git a/crates/openhuman-embed/src/harness/provider_tests.rs b/crates/openhuman-embed/src/harness/provider_tests.rsindex 8f9300bd29..601a49abaf 100644--- a/crates/openhuman-embed/src/harness/provider_tests.rs+++ b/crates/openhuman-embed/src/harness/provider_tests.rs@@ -1,4 +1,5 @@use super::*;+use crate::{ReasoningEffort, Route};#[test]fn openai_compatible_carries_both_halves() {diff --git a/crates/openhuman-embed/src/lib.rs b/crates/openhuman-embed/src/lib.rsindex 58597f5684..c8641bb423 100644--- a/crates/openhuman-embed/src/lib.rs+++ b/crates/openhuman-embed/src/lib.rs@@ -83,6 +83,8 @@ pub use openhuman_core::config::{SearchHostCredential, UnknownKeyedSearchProvidepub use openhuman_core::core::runtime::{current_tenant, NoTenant, Tenant};pub use openhuman_core::security::TrustedAccess;pub use openhuman_core::tools::toolpacks::{GroupMode, ToolGroups};+/// Reasoning effort values accepted by routed inference providers.+pub use tinyinference_llm::model::ReasoningEffort;// The seam `AgentSpec::tools` needs: the belt types, and `Tool` itself from the// vendored tinytools. An embedder that took `tinytools` as its own dependency// would build tools of a different, incompatible type.diff --git a/crates/openhuman-embed/src/turn_types.rs b/crates/openhuman-embed/src/turn_types.rsindex f6bc451a15..28f1a22fbd 100644--- a/crates/openhuman-embed/src/turn_types.rs+++ b/crates/openhuman-embed/src/turn_types.rs@@ -1,5 +1,6 @@//! Credential-safe routes, wire turn requests and their typed outcomes.use serde::{Deserialize, Serialize};+use tinyinference_llm::model::ReasoningEffort;#[cfg(test)]#[path = "../tests/unit/turn_usage.rs"]@@ -73,6 +74,11 @@ pub struct Route {pub api_key: String,/// Headers scoped to this route and never persisted or logged as values.pub headers: Vec<(String, String)>,+ /// Provider-specific options sent with every request on this route. A+ /// request's own options override these recursively by key.+ pub provider_options: Option<serde_json::Value>,+ /// Reasoning effort configured for this route's model.+ pub reasoning_effort: Option<ReasoningEffort>,}impl std::fmt::Debug for Route {@@ -85,6 +91,8 @@ impl std::fmt::Debug for Route {.field("base_url", &sanitize_url_for_display(&self.base_url)).field("api_key", &"<redacted>").field("headers", &self.headers.len())+ .field("provider_options", &self.provider_options.is_some())+ .field("reasoning_effort", &self.reasoning_effort).finish()}}@@ -143,6 +151,8 @@ impl Route {base_url: base_url.into(),api_key: api_key.into(),headers: Vec::new(),+ provider_options: None,+ reasoning_effort: None,}}/// Add a header sent only to this route's endpoint.@@ -150,6 +160,20 @@ impl Route {self.headers.push((name.into(), value.into()));self}++ /// Set provider-specific defaults for this route. Per-request options+ /// override these values by key.+ pub fn provider_options(mut self, options: serde_json::Value) -> Self {+ self.provider_options = Some(options);+ self+ }++ /// Set the reasoning effort used for this route's model across agent,+ /// scheduled, and other runtime-owned calls.+ pub fn reasoning_effort(mut self, effort: ReasoningEffort) -> Self {+ self.reasoning_effort = Some(effort);+ self+ }}/// Wire params for [`super::AGENT_CHAT`].