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): support provider options and reasoning effort on routes
Steven Enamakel6c7276db6cab
diff --git a/EMBED.md b/EMBED.mdindex d777a19a44..76d37ccdbc 100644--- a/EMBED.md+++ b/EMBED.md@@ -38,7 +38,7 @@- [Composio](docs/gitbooks/en/developing/embed/integrations/composio.md): Composio calls use the host backend transport. Install that transport before booting a managed runtime; see TinyHumans managed inference. An explicit inference provider route supplies model inference, not the connector transport.- [Local and custom models](docs/gitbooks/en/developing/embed/integrations/local-models.md): For a local server that implements chat completions, use `Provider::openai_compatible` with its API root and model id. The constructor requires a bearer string even when a particular local server ignores it. Set the endpoint explicitly rather than relying on another user's installed configuration. The OpenAI-compatible example controls can point a live example at that local server.- [MCP servers](docs/gitbooks/en/developing/embed/integrations/mcp.md): Enable the `mcp` Cargo feature and declare a server with `AgentSpec::mcp`. `McpServer::http` takes a registered name and endpoint; `allow_tools` narrows the remote tool list. Server configuration and its connections belong to the agent that declared them.-- [OpenAI-compatible providers and BYOK](docs/gitbooks/en/developing/embed/integrations/openai-compatible.md): Construct a route with `Provider::openai_compatible(base_url, api_key).model(model_id)`, then set it on the runtime or an individual agent. Pass the API root, such as a provider's `/v1` URL; the adapter appends `/chat/completions`. Supply an explicit model id so the route can register that model for its workload roles.+- [OpenAI-compatible providers and BYOK](docs/gitbooks/en/developing/embed/integrations/openai-compatible.md): Construct a route with `Provider::openai_compatible(base_url, api_key).model(model_id)`, then set it on the runtime or an individual agent. Pass the API root, such as a provider's `/v1` URL; the adapter appends `/chat/completions`. Supply an explicit model id so the route can register that model for its workload roles. Set `.provider_options(json!({...}))` for route-wide gateway defaults and `.reasoning_effort(ReasoningEffort::High)` for the model's reasoning level. Provider options are recursively merged with request options, with request values taking precedence. Both settings apply to agent turns and runtime-owned work such as cron runs and subagents.- [Storage drivers](docs/gitbooks/en/developing/embed/integrations/storage-drivers.md): Enable `storage-sqlite` for SQLite or `storage-mongodb` for MongoDB on your Embed dependency. These Cargo gates make the driver available; choosing a URL selects the runtime backend. Set `RuntimeConfig.storage.url`, pass a URL through `RuntimeBuilder::storage`, or set the `url` field in the `[storage]` section of the host's configuration. `OPENHUMAN_STORAGE_URL` is the environment override used by host configuration resolution.- [TinyHumans managed inference](docs/gitbooks/en/developing/embed/integrations/tinyhumans-managed.md): Embed wraps the core; neither contains a TinyHumans backend client. A managed host boots through the builder in `openhuman-tinyhumans` (`openhuman_tinyhumans::RuntimeBuilder`), or calls `openhuman_tinyhumans::install`. That layer owns the transport, the authenticated client, the hosted routes and the hosted providers, and it plugs them into the core through the core's generic registries (chat models, voice, tool sources, the channel callback and memory engines). A host can register its own provider in the same registries. The connected host layer also owns session login. `RuntimeBuilder::backend_url` selects a URL; it does not connect anything.- [Web search](docs/gitbooks/en/developing/embed/integrations/web-search.md): An agent's web-search tools (`web_search_tool`, `web_answer_tool`, `web_contents_tool`) run through the process-wide TinySearch module. Several agents in one runtime can each search with their own provider key: pin it on that agent's config, and it is never written to `config.toml`, the environment, or a log.diff --git a/crates/openhuman-core/src/config/schema/ephemeral_route_tests.rs b/crates/openhuman-core/src/config/schema/ephemeral_route_tests.rsindex 4f6fb0ed44..9866693bb3 100644--- a/crates/openhuman-core/src/config/schema/ephemeral_route_tests.rs+++ b/crates/openhuman-core/src/config/schema/ephemeral_route_tests.rs@@ -138,11 +138,17 @@ fn apply_carries_provider_options_and_model_reasoning_effort() {apply(&mut config, route);assert_eq!(- config.ephemeral_route.as_ref().and_then(|route| route.provider_options.clone()),+ config+ .ephemeral_route+ .as_ref()+ .and_then(|route| route.provider_options.clone()),Some(serde_json::json!({"provider": {"sort": "latency"}})));assert_eq!(- config.runtime.reasoning_effort_by_model.get("provider/model"),+ config+ .runtime+ .reasoning_effort_by_model+ .get("provider/model"),Some(&"high".to_string()));}@@ -152,7 +158,10 @@ fn an_ephemeral_route_without_options_keeps_the_provider_default() {let mut config = config_with_model("provider/model");apply(&mut config, route());- assert_eq!(config.ephemeral_route.as_ref().unwrap().provider_options, None);+ assert_eq!(+ config.ephemeral_route.as_ref().unwrap().provider_options,+ None+ );}#[test]diff --git a/crates/openhuman-core/src/inference/host_runtime/schemas.rs b/crates/openhuman-core/src/inference/host_runtime/schemas.rsindex 5911caceaf..9421e23496 100644--- a/crates/openhuman-core/src/inference/host_runtime/schemas.rs+++ b/crates/openhuman-core/src/inference/host_runtime/schemas.rs@@ -256,13 +256,14 @@ fn handle_agent_chat(ctx: DispatchCtx, params: Map<String, Value>) -> Controllerp.temperature,p.thread_id,p.cwd,- crate::config::schema::EphemeralRoute::from_params(p.inference_url, p.api_key)- .map(|route| {+ crate::config::schema::EphemeralRoute::from_params(p.inference_url, p.api_key).map(+ |route| {route.with_headers(p.inference_headers).with_provider_options(p.inference_provider_options).with_reasoning_effort(p.inference_reasoning_effort)- }),+ },+ ),crate::inference::host_runtime::ops::AgentChatEnv::default(),).await?diff --git a/crates/openhuman-embed/src/agent/build.rs b/crates/openhuman-embed/src/agent/build.rsindex 5f73a02ad7..14a2d00502 100644--- a/crates/openhuman-embed/src/agent/build.rs+++ b/crates/openhuman-embed/src/agent/build.rs@@ -285,7 +285,11 @@ pub(crate) fn instantiate(runtime: &Runtime, spec: AgentSpec) -> Result<AgentInnscoped.with_headers(route.headers.clone()).with_provider_options(route.provider_options.clone())- .with_reasoning_effort(route.reasoning_effort.map(|effort| effort.as_str().to_string()))+ .with_reasoning_effort(+ route+ .reasoning_effort+ .map(|effort| effort.as_str().to_string()),+ )})});let mut overrides = openhuman_core::agent::host_overrides::HostOverrides::default();diff --git a/crates/openhuman-embed/src/turn.rs b/crates/openhuman-embed/src/turn.rsindex a315dba0ca..6df5fa2484 100644--- a/crates/openhuman-embed/src/turn.rs+++ b/crates/openhuman-embed/src/turn.rs@@ -462,7 +462,9 @@ impl Turn {self.request.api_key = Some(route.api_key);self.request.inference_headers = route.headers;self.request.inference_provider_options = route.provider_options;- self.request.inference_reasoning_effort = route.reasoning_effort.map(|effort| effort.as_str().to_string());+ self.request.inference_reasoning_effort = route+ .reasoning_effort+ .map(|effort| effort.as_str().to_string());self}@@ -635,8 +637,12 @@ async fn dispatch().map(|route| route.with_headers(request.inference_headers.clone()));let route = route- .map(|route| route.with_provider_options(request.inference_provider_options.clone()))- .map(|route| route.with_reasoning_effort(request.inference_reasoning_effort.clone()));+ .map(|route| {+ route.with_provider_options(request.inference_provider_options.clone())+ })+ .map(|route| {+ route.with_reasoning_effort(request.inference_reasoning_effort.clone())+ });agent_chat_reply_for_controlled(&mut config,target,@@ -677,8 +683,12 @@ async fn dispatch().map(|route| route.with_headers(request.inference_headers));let route = route- .map(|route| route.with_provider_options(request.inference_provider_options))- .map(|route| route.with_reasoning_effort(request.inference_reasoning_effort));+ .map(|route| {+ route.with_provider_options(request.inference_provider_options)+ })+ .map(|route| {+ route.with_reasoning_effort(request.inference_reasoning_effort)+ });let host = options.tools.or_else(|| inner.composed_host_tools());let target = AgentChatTarget::Definition {definition: &inner.definition,diff --git a/crates/openhuman-embed/src/turn_types.rs b/crates/openhuman-embed/src/turn_types.rsindex f1fafb9285..478ae8bfc6 100644--- a/crates/openhuman-embed/src/turn_types.rs+++ b/crates/openhuman-embed/src/turn_types.rs@@ -60,7 +60,8 @@ pub(super) fn overlay_response_usage(/// keeps this facade's dispatch string in lockstep with the registered/// controller rather than duplicating the wire name.///-/// Where one turn's inference should go.+/// Where one turn's inference should go, including provider defaults and+/// reasoning effort for the selected model.////// Both halves are required together: an endpoint with no credential and a/// credential with no endpoint are each half a statement, and the core ignoresdiff --git a/crates/openhuman-embed/tests/cron_agents.rs b/crates/openhuman-embed/tests/cron_agents.rsindex 1ae279b64d..fe6e096790 100644--- a/crates/openhuman-embed/tests/cron_agents.rs+++ b/crates/openhuman-embed/tests/cron_agents.rs@@ -14,8 +14,8 @@ use std::time::Duration;use common::{chat_completion, chat_requests, offline_config, runtime, stub_backend};use openhuman_embed::{AgentDefinitionSpec, AgentSpec, AgentTurnOrigin, CronError, HostTurnTools, JobSchedule,- JobSpec, JobTarget, Provider, Runtime, RuntimeError, RuntimeEventKind, RuntimeEvents,- ReasoningEffort, ServiceSet, Tool, ToolScopeSpec, TrustedAutomationSource, Workspace,+ JobSpec, JobTarget, Provider, ReasoningEffort, Runtime, RuntimeError, RuntimeEventKind,+ RuntimeEvents, ServiceSet, Tool, ToolScopeSpec, TrustedAutomationSource, Workspace,};use wiremock::matchers::{method, path};use wiremock::{Mock, MockServer, ResponseTemplate};@@ -185,7 +185,10 @@ fn a_scheduled_job_runs_a_runtime_agent_with_its_host_tool_as_cron() {let first_request = String::from_utf8_lossy(&requests[0].body).to_string();assert!(first_request.contains("TEENY_CRON_PROMPT"));let first_body: serde_json::Value = serde_json::from_slice(&requests[0].body).unwrap();- assert_eq!(first_body["provider"], serde_json::json!({"sort": "latency"}));+ assert_eq!(+ first_body["provider"],+ serde_json::json!({"sort": "latency"})+ );assert_eq!(first_body["reasoning_effort"], "high");assert!(common::tool_names(&requests[0]).contains(&"teeny_ping".to_string()));assert_eq!(cron.runs("teeny-hourly", 10).unwrap()[0].status, "ok");