Skip to content

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

feat(inference): accept provider options and reasoning effort on agent chat

Steven Enamakel98aba50d22f6
diff --git a/crates/openhuman-core/src/inference/host_runtime/schemas.rs b/crates/openhuman-core/src/inference/host_runtime/schemas.rs
index 8c91880ca9..5911caceaf 100644
--- a/crates/openhuman-core/src/inference/host_runtime/schemas.rs
+++ b/crates/openhuman-core/src/inference/host_runtime/schemas.rs
@@ -45,6 +45,12 @@ struct AgentChatParams {
api_key: Option<String>,
#[serde(default)]
inference_headers: Vec<(String, String)>,
+ /// Provider-specific defaults for the per-call route.
+ #[serde(default)]
+ inference_provider_options: Option<Value>,
+ /// Reasoning effort for the model selected by the per-call route.
+ #[serde(default)]
+ inference_reasoning_effort: Option<String>,
}
#[derive(Debug, Deserialize)]
@@ -145,6 +151,16 @@ pub fn schemas(function: &str) -> ControllerSchema {
comment: "Custom header name/value pairs for inference_url only; never persisted.",
required: false,
},
+ FieldSchema {
+ name: "inference_provider_options",
+ ty: TypeSchema::Option(Box::new(TypeSchema::Json)),
+ comment: "Provider-specific defaults for inference_url; request options override them by key.",
+ required: false,
+ },
+ optional_string(
+ "inference_reasoning_effort",
+ "Reasoning effort for the model selected by inference_url.",
+ ),
],
outputs: vec![json_output(
"response",
@@ -241,7 +257,12 @@ fn handle_agent_chat(ctx: DispatchCtx, params: Map<String, Value>) -> Controller
p.thread_id,
p.cwd,
crate::config::schema::EphemeralRoute::from_params(p.inference_url, p.api_key)
- .map(|route| route.with_headers(p.inference_headers)),
+ .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/turn_tests.rs b/crates/openhuman-embed/src/turn_tests.rs
index 243e07e0c7..35c19ab9e9 100644
--- a/crates/openhuman-embed/src/turn_tests.rs
+++ b/crates/openhuman-embed/src/turn_tests.rs
@@ -32,6 +32,8 @@ fn turn_request_field_names_match_the_controller() {
inference_url: Some("https://example.invalid/v1".into()),
api_key: Some("k".into()),
inference_headers: vec![("x-worker".into(), "a".into())],
+ inference_provider_options: Some(serde_json::json!({"provider": {"sort": "latency"}})),
+ inference_reasoning_effort: Some("high".into()),
agent_id: Some("a".into()),
};