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
refactor(inference): remove agent chat schemas from host runtime
Steven Enamakel1e59ed2c527d
diff --git a/crates/openhuman-core/src/inference/host_runtime/schemas.rs b/crates/openhuman-core/src/inference/host_runtime/schemas.rsindex e52cba87c9..490d394259 100644--- a/crates/openhuman-core/src/inference/host_runtime/schemas.rs+++ b/crates/openhuman-core/src/inference/host_runtime/schemas.rs@@ -12,47 +12,6 @@ use crate::core::all::{ControllerFuture, RegisteredController};use crate::core::Outcome;use crate::core::{ControllerSchema, FieldSchema, TypeSchema};-/// Params for `inference.agent_chat` and `inference.agent_chat_simple`.-///-/// A near-copy of the params in [`crate::agent_runs::schemas`], which-/// backs the `agent.chat` / `agent.chat_simple` namespace over the same ops.-/// The two diverge in one field: only this surface accepts a per-call-/// `inference_url` + `api_key`, because `agent.chat` describes a turn on the-/// account's own configured inference.-#[derive(Debug, Deserialize)]-struct AgentChatParams {- message: String,- model_override: Option<String>,- temperature: Option<f64>,- thread_id: Option<String>,- /// Which agent definition to run the turn as. Absent runs the- /// orchestrator, as before. Resolved through the definition registry and- /// then `config.agent_registry.entries`; an unknown id is an error.- #[serde(default)]- agent_id: Option<String>,- /// Optional per-turn working directory for the agent's filesystem / shell- /// tools. Absent or empty keeps the configured `action_dir`. Ignored by the- /// `*_simple` variant, which runs a bare provider call with no tools.- cwd: Option<String>,- /// OpenAI-compatible endpoint this one call should run against. Paired with- /// `api_key`; either alone is ignored. See- /// [`ephemeral_route`](crate::config::schema::ephemeral_route).- #[serde(default)]- inference_url: Option<String>,- /// Bearer for `inference_url`. Never persisted and never handed to any- /// other provider.- #[serde(default)]- 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)]struct LocalAiTranscribeParams {audio_path: String,@@ -102,78 +61,6 @@ pub fn all_registered_controllers() -> Vec<RegisteredController> {pub fn schemas(function: &str) -> ControllerSchema {match function {- "agent_chat" => ControllerSchema {- namespace: "inference",- function: "agent_chat",- description: "Run one-shot agent chat with optional model overrides.",- inputs: vec![- required_string("message", "User message."),- optional_string("model_override", "Optional model override."),- optional_f64("temperature", "Optional temperature override."),- optional_string(- "thread_id",- "Optional backend thread id for cache grouping and inference logs.",- ),- optional_string(- "agent_id",- "Optional agent definition id to run the turn as. Omit for the \- orchestrator.",- ),- optional_string(- "cwd",- "Optional working directory for this turn: the agent's file and shell \- tools are rooted here, so relative paths resolve inside it. Must be an \- existing directory. Omit (or pass empty) to use the configured action_dir.",- ),- optional_string(- "inference_url",- "Optional OpenAI-compatible endpoint for this call only. \- Requires api_key; never persisted.",- ),- optional_string(- "api_key",- "Bearer for inference_url. Scoped to this call and to that \- endpoint alone.",- ),- FieldSchema {- name: "inference_headers",- ty: TypeSchema::Option(Box::new(TypeSchema::Array(Box::new(TypeSchema::Json)))),- 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",- "Agent response payload: `result` (the reply text), `logs`, `hit_cap` (true when \- the turn stopped at its tool-iteration cap instead of finishing) and, only when \- hit_cap is true, `checkpoint` (the resumable checkpoint text, equal to `result`).",- )],- },- "agent_chat_simple" => ControllerSchema {- namespace: "inference",- function: "agent_chat_simple",- description: "Run one-shot lightweight provider chat.",- inputs: vec![- required_string("message", "User message."),- optional_string("model_override", "Optional model override."),- optional_f64("temperature", "Optional temperature override."),- optional_string(- "thread_id",- "Optional backend thread id for cache grouping and inference logs.",- ),- ],- outputs: vec![json_output("response", "Agent response payload.")],- },"transcribe" => ControllerSchema {namespace: "inference",function: "transcribe",@@ -228,57 +115,6 @@ pub fn schemas(function: &str) -> ControllerSchema {}}-fn handle_agent_chat(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {- Box::pin(async move {- let p = deserialize_params::<AgentChatParams>(params)?;- let mut config = ctx.load_config().await?;- let target = match p.agent_id.as_deref().map(str::trim) {- Some(id) if !id.is_empty() => {- crate::inference::host_runtime::ops::AgentChatTarget::AgentId(id)- }- _ => crate::inference::host_runtime::ops::AgentChatTarget::Orchestrator,- };- crate::inference::host_runtime::ops::agent_chat_reply_for(- &mut config,- target,- &p.message,- p.model_override,- p.temperature,- 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)- .with_provider_options(p.inference_provider_options)- .with_reasoning_effort(p.inference_reasoning_effort)- },- ),- crate::inference::host_runtime::ops::AgentChatEnv::default(),- )- .await?- .into_rpc_json()- })-}--fn handle_agent_chat_simple(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {- Box::pin(async move {- let p = deserialize_params::<AgentChatParams>(params)?;- let config = ctx.load_config().await?;- to_json(- crate::inference::host_runtime::ops::agent_chat_simple(- &ctx,- &config,- &p.message,- p.model_override,- p.temperature,- p.thread_id,- )- .await?,- )- })-}-fn handle_local_ai_transcribe(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {Box::pin(async move {let p = deserialize_params::<LocalAiTranscribeParams>(params)?;