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(workload-router): replace model-version constants with role-alias constants
Steven Enamakel34be714aef1a
diff --git a/crates/openhuman-core/src/agent/tinyagents/routes.rs b/crates/openhuman-core/src/agent/tinyagents/routes.rsindex 53baec74d4..83dab20a35 100644--- a/crates/openhuman-core/src/agent/tinyagents/routes.rs+++ b/crates/openhuman-core/src/agent/tinyagents/routes.rs@@ -10,27 +10,33 @@ use tinyagents_harness::retry::FallbackPolicy;use tinyagents_registry::{WorkloadRoute, WorkloadRouter};use tinyinference_llm::model::{CapabilitySet, ModelRequest};-use crate::config::{- MODEL_AGENTIC_V1, MODEL_BURST_V1, MODEL_CHAT_V1, MODEL_CODING_V1, MODEL_REASONING_V1,- MODEL_SUMMARIZATION_V1, MODEL_VISION_V1,-};+/// Role aliases the workload router is keyed by: the `hint:<role>` string a+/// caller pins (an agent manifest's `hint = "coding"`, a flow node's+/// `config.model`). The inference provider factory resolves each alias to the+/// role's configured route — the managed default model, or the BYOK/local+/// model routed to that workload.+pub(super) const ROUTE_CHAT: &str = "hint:chat";+pub(super) const ROUTE_REASONING: &str = "hint:reasoning";+pub(super) const ROUTE_AGENTIC: &str = "hint:agentic";+pub(super) const ROUTE_CODING: &str = "hint:coding";+pub(super) const ROUTE_BURST: &str = "hint:burst";+pub(super) const ROUTE_SUMMARIZATION: &str = "hint:summarization";+pub(super) const ROUTE_VISION: &str = "hint:vision";-/// The workload routes projected into the registry, keyed by their OpenHuman-/// tier alias (the string the wrapped provider resolves at dispatch).+/// The workload routes projected into the registry, keyed by role alias.///-/// This is the canonical tier inventory (`reasoning`, `chat`, `agentic`,-/// `burst`, `coding`, `summarization`, `vision`). The inference provider factory-/// resolves the selected tier to its configured model. `subconscious`/`memory`-/// are intentionally absent — they are role aliases that ride the `chat-v1`-/// model rather than distinct router tiers.+/// This is the canonical workload inventory (`chat`, `reasoning`, `agentic`,+/// `coding`, `burst`, `summarization`, `vision`). `subconscious`/`memory` are+/// intentionally absent — they are role aliases that ride the chat route rather+/// than distinct router entries.pub(super) const WORKLOAD_ROUTE_TIERS: &[&str] = &[- MODEL_CHAT_V1,- MODEL_REASONING_V1,- MODEL_AGENTIC_V1,- MODEL_CODING_V1,- MODEL_BURST_V1,- MODEL_SUMMARIZATION_V1,- MODEL_VISION_V1,+ ROUTE_CHAT,+ ROUTE_REASONING,+ ROUTE_AGENTIC,+ ROUTE_CODING,+ ROUTE_BURST,+ ROUTE_SUMMARIZATION,+ ROUTE_VISION,];/// The OpenHuman workload-tier routing table as a crate@@ -43,46 +49,38 @@ pub(super) const WORKLOAD_ROUTE_TIERS: &[&str] = &[/// `turn_required_capabilities`: it answers [`route_fallback_policy`] and/// [`turn_required_capabilities`] from one declarative table.///-/// Built once — the tier set + fallback ordering + vision gate are static:-/// - light/fast conversational siblings `chat-v1 ⇄ burst-v1`;-/// - heavy reasoning/agentic siblings `reasoning-v1 ⇄ agentic-v1`;-/// - `coding-v1 → agentic-v1` (coding is tool-heavy, agentic-adjacent);-/// - `summarization-v1 → chat-v1` (summarization rides a general chat model);-/// - `vision-v1` is `image_in`-gated and primary-only — a text fallback cannot-/// satisfy the gate — and its `hint:vision` form carries the same gate.+/// Built once — the route set + fallback ordering + vision gate are static:+/// - light/fast conversational siblings `chat ⇄ burst`;+/// - heavy reasoning/agentic siblings `reasoning ⇄ agentic`;+/// - `coding → agentic` (coding is tool-heavy, agentic-adjacent);+/// - `summarization → chat` (summarization rides a general chat model);+/// - `vision` is `image_in`-gated and primary-only — a text fallback cannot+/// satisfy the gate.+///+/// On the managed backend every role resolves to the same default model, so a+/// sibling fallback there re-dispatches the same model; the chain earns its+/// keep when a role is routed to a BYOK/local provider that fails.static OH_WORKLOAD_ROUTER: LazyLock<WorkloadRouter> = LazyLock::new(|| {let vision_gate = CapabilitySet {image_in: true,..CapabilitySet::default()};WorkloadRouter::new()+ .with_route(WorkloadRoute::new(ROUTE_CHAT, ROUTE_CHAT).with_fallbacks([ROUTE_BURST]))+ .with_route(WorkloadRoute::new(ROUTE_BURST, ROUTE_BURST).with_fallbacks([ROUTE_CHAT])).with_route(- WorkloadRoute::new(MODEL_CHAT_V1, MODEL_CHAT_V1).with_fallbacks([MODEL_BURST_V1]),- )- .with_route(- WorkloadRoute::new(MODEL_BURST_V1, MODEL_BURST_V1).with_fallbacks([MODEL_CHAT_V1]),- )- .with_route(- WorkloadRoute::new(MODEL_REASONING_V1, MODEL_REASONING_V1)- .with_fallbacks([MODEL_AGENTIC_V1]),- )- .with_route(- WorkloadRoute::new(MODEL_AGENTIC_V1, MODEL_AGENTIC_V1)- .with_fallbacks([MODEL_REASONING_V1]),- )- .with_route(- WorkloadRoute::new(MODEL_CODING_V1, MODEL_CODING_V1).with_fallbacks([MODEL_AGENTIC_V1]),+ WorkloadRoute::new(ROUTE_REASONING, ROUTE_REASONING).with_fallbacks([ROUTE_AGENTIC]),).with_route(- WorkloadRoute::new(MODEL_SUMMARIZATION_V1, MODEL_SUMMARIZATION_V1)- .with_fallbacks([MODEL_CHAT_V1]),+ WorkloadRoute::new(ROUTE_AGENTIC, ROUTE_AGENTIC).with_fallbacks([ROUTE_REASONING]),)+ .with_route(WorkloadRoute::new(ROUTE_CODING, ROUTE_CODING).with_fallbacks([ROUTE_AGENTIC])).with_route(- WorkloadRoute::new(MODEL_VISION_V1, MODEL_VISION_V1).requiring(vision_gate.clone()),+ WorkloadRoute::new(ROUTE_SUMMARIZATION, ROUTE_SUMMARIZATION)+ .with_fallbacks([ROUTE_CHAT]),)- // The hint form resolves to the same vision tier and carries the same gate,- // with no fallback (primary-only), matching the legacy static gate.- .with_route(WorkloadRoute::new("hint:vision", MODEL_VISION_V1).requiring(vision_gate))+ // Vision is image_in-gated with no fallback (primary-only).+ .with_route(WorkloadRoute::new(ROUTE_VISION, ROUTE_VISION).requiring(vision_gate))});/// The capability needs a turn imposes on every model call, derived from what isdiff --git a/crates/openhuman-core/src/inference/provider/factory/managed_backend.rs b/crates/openhuman-core/src/inference/provider/factory/managed_backend.rsindex abba7deb9d..7cf69fa832 100644--- a/crates/openhuman-core/src/inference/provider/factory/managed_backend.rs+++ b/crates/openhuman-core/src/inference/provider/factory/managed_backend.rs@@ -35,11 +35,13 @@ pub(crate) fn make_openhuman_backend_model_for_thread(std::sync::Arc<dyn tinyinference_llm::model::ChatModel<()>>,String,)> {- let (backend, resolved_model) = resolve_managed_backend(role, config)?;+ // `model` may be a role alias (`hint:reasoning`) the registry keys the+ // route by; the backend only ever sees the concrete id it resolves to.+ let (backend, resolved_model) =+ resolve_managed_backend_with_model_override(role, config, Some(model))?;Ok((std::sync::Arc::new(backend- .with_default_model(model).with_native_tool_calling(native_tool_calling).with_thread_id(thread_id),),diff --git a/crates/openhuman-core/src/inference/provider/openhuman_backend_model.rs b/crates/openhuman-core/src/inference/provider/openhuman_backend_model.rsindex 2e80d7c9c7..8af2195a4f 100644--- a/crates/openhuman-core/src/inference/provider/openhuman_backend_model.rs+++ b/crates/openhuman-core/src/inference/provider/openhuman_backend_model.rs@@ -378,9 +378,9 @@ fn resolve_model(model: &str) -> String {log::debug!("[providers][openhuman-backend] empty model passed to OpenHuman backend; \substituting default `{}` (TAURI-RUST-RS)",- crate::config::MODEL_REASONING_V1+ crate::config::MODEL_MANAGED_DEFAULT);- crate::config::MODEL_REASONING_V1.to_string()+ crate::config::MODEL_MANAGED_DEFAULT.to_string()} else {trimmed.to_string()}