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(tools): move ProviderRuntimeOptions into delegate module
Steven Enamakel2022966bd88f
diff --git a/crates/openhuman-core/src/channels/context.rs b/crates/openhuman-core/src/channels/context.rsindex acf84c9397..d87c0ba46f 100644--- a/crates/openhuman-core/src/channels/context.rs+++ b/crates/openhuman-core/src/channels/context.rs@@ -53,7 +53,7 @@ pub(crate) struct ChannelRuntimeContext {pub(crate) api_url: Option<String>,pub(crate) inference_url: Option<String>,pub(crate) reliability: Arc<crate::config::ReliabilityConfig>,- pub(crate) provider_runtime_options: crate::inference::provider::ProviderRuntimeOptions,+ pub(crate) provider_runtime_options: crate::tools::delegate::ProviderRuntimeOptions,pub(crate) workspace_dir: Arc<PathBuf>,pub(crate) message_timeout_secs: u64,pub(crate) multimodal: crate::config::MultimodalConfig,diff --git a/crates/openhuman-core/src/channels/context_tests.rs b/crates/openhuman-core/src/channels/context_tests.rsindex acb0e96443..1dd9cda80b 100644--- a/crates/openhuman-core/src/channels/context_tests.rs+++ b/crates/openhuman-core/src/channels/context_tests.rs@@ -45,7 +45,7 @@ fn runtime_context() -> ChannelRuntimeContext {api_url: None,inference_url: None,reliability: Arc::new(crate::config::ReliabilityConfig::default()),- provider_runtime_options: crate::inference::provider::ProviderRuntimeOptions::default(),+ provider_runtime_options: crate::tools::delegate::ProviderRuntimeOptions::default(),workspace_dir: Arc::new(PathBuf::from("/tmp")),message_timeout_secs: CHANNEL_MESSAGE_TIMEOUT_SECS,multimodal: crate::config::MultimodalConfig::default(),diff --git a/crates/openhuman-core/src/channels/routes_tests.rs b/crates/openhuman-core/src/channels/routes_tests.rsindex 3d65831593..623f9e7b03 100644--- a/crates/openhuman-core/src/channels/routes_tests.rs+++ b/crates/openhuman-core/src/channels/routes_tests.rs@@ -79,7 +79,7 @@ fn runtime_context(workspace_dir: PathBuf) -> ChannelRuntimeContext {api_url: None,inference_url: None,reliability: Arc::new(crate::config::ReliabilityConfig::default()),- provider_runtime_options: crate::inference::provider::ProviderRuntimeOptions::default(),+ provider_runtime_options: crate::tools::delegate::ProviderRuntimeOptions::default(),workspace_dir: Arc::new(workspace_dir),message_timeout_secs: 60,multimodal: crate::config::MultimodalConfig::default(),diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/dispatch_tests.rs b/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/dispatch_tests.rsindex 471645f715..3b1d366bdc 100644--- a/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/dispatch_tests.rs+++ b/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/dispatch_tests.rs@@ -58,7 +58,7 @@ fn context(channel: Arc<Telegram>, config: Config) -> Arc<ChannelRuntimeContext>api_url: None,inference_url: None,reliability: Arc::new(crate::config::ReliabilityConfig::default()),- provider_runtime_options: crate::inference::provider::ProviderRuntimeOptions::default(),+ provider_runtime_options: crate::tools::delegate::ProviderRuntimeOptions::default(),workspace_dir: Arc::new(config.workspace_dir.clone()),message_timeout_secs: CHANNEL_MESSAGE_TIMEOUT_SECS,multimodal: crate::config::MultimodalConfig::default(),diff --git a/crates/openhuman-core/src/channels/runtime/startup/turn_parts.rs b/crates/openhuman-core/src/channels/runtime/startup/turn_parts.rsindex 0266f0d716..0c07dd58ab 100644--- a/crates/openhuman-core/src/channels/runtime/startup/turn_parts.rs+++ b/crates/openhuman-core/src/channels/runtime/startup/turn_parts.rs@@ -26,7 +26,7 @@ use tinytools::Tool;pub(crate) struct ChannelTurnParts {pub(crate) model: String,pub(crate) provider_name: String,- pub(crate) provider_runtime_options: provider::ProviderRuntimeOptions,+ pub(crate) provider_runtime_options: crate::tools::delegate::ProviderRuntimeOptions,pub(crate) tools_registry: Arc<Vec<Box<dyn Tool>>>,pub(crate) system_prompt: ChannelSystemPrompt,pub(crate) skills: Vec<Workflow>,@@ -98,7 +98,7 @@ pub(crate) fn build_channel_turn_parts(security: &Arc<SecurityPolicy>,descs: PromptToolDescs,) -> Result<ChannelTurnParts> {- let provider_runtime_options = provider::ProviderRuntimeOptions {+ let provider_runtime_options = crate::tools::delegate::ProviderRuntimeOptions {auth_profile_override: None,openhuman_dir: config.config_path.parent().map(std::path::PathBuf::from),secrets_encrypt: config.secrets.encrypt,diff --git a/crates/openhuman-core/src/channels/runtime/test_support.rs b/crates/openhuman-core/src/channels/runtime/test_support.rsindex 536d906ef8..ef31dfd6b8 100644--- a/crates/openhuman-core/src/channels/runtime/test_support.rs+++ b/crates/openhuman-core/src/channels/runtime/test_support.rs@@ -12,7 +12,7 @@ use crate::channels::ChannelSystemPrompt;use crate::config::{MultimodalConfig, MultimodalFileConfig, ReliabilityConfig};use crate::core::bus::BUS;use crate::core::events::DomainEvent;-use crate::inference::provider::ProviderRuntimeOptions;+use crate::tools::delegate::ProviderRuntimeOptions;use crate::progress::AgentProgress;use anyhow::Result;use async_trait::async_trait;diff --git a/crates/openhuman-core/src/channels/tests/discord_integration.rs b/crates/openhuman-core/src/channels/tests/discord_integration.rsindex ce700773c3..3d880e6fa5 100644--- a/crates/openhuman-core/src/channels/tests/discord_integration.rs+++ b/crates/openhuman-core/src/channels/tests/discord_integration.rs@@ -120,7 +120,7 @@ fn make_discord_ctx(api_url: None,inference_url: None,reliability: Arc::new(crate::config::ReliabilityConfig::default()),- provider_runtime_options: crate::inference::provider::ProviderRuntimeOptions::default(),+ provider_runtime_options: crate::tools::delegate::ProviderRuntimeOptions::default(),workspace_dir: Arc::new(std::env::temp_dir()),message_timeout_secs: CHANNEL_MESSAGE_TIMEOUT_SECS,multimodal: crate::config::MultimodalConfig::default(),diff --git a/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs b/crates/openhuman-core/src/channels/tests/runtime_dispatch.rsindex 260427a951..c72e46610d 100644--- a/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs+++ b/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs@@ -136,7 +136,7 @@ async fn message_dispatch_processes_messages_in_parallel() {api_url: None,inference_url: None,reliability: Arc::new(crate::config::ReliabilityConfig::default()),- provider_runtime_options: provider::ProviderRuntimeOptions::default(),+ provider_runtime_options: crate::tools::delegate::ProviderRuntimeOptions::default(),workspace_dir: Arc::new(std::env::temp_dir()),message_timeout_secs: CHANNEL_MESSAGE_TIMEOUT_SECS,multimodal: crate::config::MultimodalConfig::default(),@@ -212,7 +212,7 @@ async fn process_channel_message_cancels_scoped_typing_task() {api_url: None,inference_url: None,reliability: Arc::new(crate::config::ReliabilityConfig::default()),- provider_runtime_options: provider::ProviderRuntimeOptions::default(),+ provider_runtime_options: crate::tools::delegate::ProviderRuntimeOptions::default(),workspace_dir: Arc::new(std::env::temp_dir()),message_timeout_secs: CHANNEL_MESSAGE_TIMEOUT_SECS,multimodal: crate::config::MultimodalConfig::default(),@@ -302,7 +302,7 @@ async fn dispatch_routes_through_agent_run_turn_bus_handler() {api_url: None,inference_url: None,reliability: Arc::new(crate::config::ReliabilityConfig::default()),- provider_runtime_options: provider::ProviderRuntimeOptions::default(),+ provider_runtime_options: crate::tools::delegate::ProviderRuntimeOptions::default(),workspace_dir: Arc::new(std::env::temp_dir()),message_timeout_secs: CHANNEL_MESSAGE_TIMEOUT_SECS,multimodal: crate::config::MultimodalConfig::default(),@@ -423,7 +423,7 @@ async fn resolved_route_ctx() -> Arc<ChannelRuntimeContext> {api_url: None,inference_url: None,reliability: Arc::new(crate::config::ReliabilityConfig::default()),- provider_runtime_options: provider::ProviderRuntimeOptions::default(),+ provider_runtime_options: crate::tools::delegate::ProviderRuntimeOptions::default(),workspace_dir: Arc::new(std::env::temp_dir()),message_timeout_secs: CHANNEL_MESSAGE_TIMEOUT_SECS,multimodal: crate::config::MultimodalConfig::default(),@@ -557,7 +557,7 @@ async fn process_channel_message_hardens_multimodal_files_against_smuggled_markeapi_url: None,inference_url: None,reliability: Arc::new(crate::config::ReliabilityConfig::default()),- provider_runtime_options: provider::ProviderRuntimeOptions::default(),+ provider_runtime_options: crate::tools::delegate::ProviderRuntimeOptions::default(),workspace_dir: Arc::new(std::env::temp_dir()),message_timeout_secs: CHANNEL_MESSAGE_TIMEOUT_SECS,multimodal: crate::config::MultimodalConfig::default(),@@ -642,7 +642,7 @@ async fn process_channel_message_hardens_against_relative_path_markers() {api_url: None,inference_url: None,reliability: Arc::new(crate::config::ReliabilityConfig::default()),- provider_runtime_options: provider::ProviderRuntimeOptions::default(),+ provider_runtime_options: crate::tools::delegate::ProviderRuntimeOptions::default(),workspace_dir: Arc::new(std::env::temp_dir()),message_timeout_secs: CHANNEL_MESSAGE_TIMEOUT_SECS,multimodal: crate::config::MultimodalConfig::default(),diff --git a/crates/openhuman-core/src/channels/tests/runtime_tool_calls.rs b/crates/openhuman-core/src/channels/tests/runtime_tool_calls.rsindex 979ee7063f..de30fd662d 100644--- a/crates/openhuman-core/src/channels/tests/runtime_tool_calls.rs+++ b/crates/openhuman-core/src/channels/tests/runtime_tool_calls.rs@@ -42,7 +42,7 @@ async fn process_channel_message_executes_native_tool_calls() {api_url: None,inference_url: None,reliability: Arc::new(crate::config::ReliabilityConfig::default()),- provider_runtime_options: provider::ProviderRuntimeOptions::default(),+ provider_runtime_options: crate::tools::delegate::ProviderRuntimeOptions::default(),workspace_dir: Arc::new(std::env::temp_dir()),message_timeout_secs: CHANNEL_MESSAGE_TIMEOUT_SECS,multimodal: crate::config::MultimodalConfig::default(),@@ -115,7 +115,7 @@ async fn process_channel_message_handles_models_command_without_llm_call() {api_url: None,inference_url: None,reliability: Arc::new(crate::config::ReliabilityConfig::default()),- provider_runtime_options: provider::ProviderRuntimeOptions::default(),+ provider_runtime_options: crate::tools::delegate::ProviderRuntimeOptions::default(),workspace_dir: Arc::new(std::env::temp_dir()),message_timeout_secs: CHANNEL_MESSAGE_TIMEOUT_SECS,multimodal: crate::config::MultimodalConfig::default(),@@ -217,7 +217,7 @@ async fn process_channel_message_uses_route_override_provider_and_model() {api_url: None,inference_url: None,reliability: Arc::new(crate::config::ReliabilityConfig::default()),- provider_runtime_options: provider::ProviderRuntimeOptions::default(),+ provider_runtime_options: crate::tools::delegate::ProviderRuntimeOptions::default(),workspace_dir: Arc::new(std::env::temp_dir()),message_timeout_secs: CHANNEL_MESSAGE_TIMEOUT_SECS,multimodal: crate::config::MultimodalConfig::default(),@@ -269,7 +269,7 @@ async fn process_channel_message_respects_configured_max_tool_iterations_above_dapi_url: None,inference_url: None,reliability: Arc::new(crate::config::ReliabilityConfig::default()),- provider_runtime_options: provider::ProviderRuntimeOptions::default(),+ provider_runtime_options: crate::tools::delegate::ProviderRuntimeOptions::default(),workspace_dir: Arc::new(std::env::temp_dir()),message_timeout_secs: CHANNEL_MESSAGE_TIMEOUT_SECS,multimodal: crate::config::MultimodalConfig::default(),@@ -329,7 +329,7 @@ async fn process_channel_message_reports_configured_max_tool_iterations_limit()api_url: None,inference_url: None,reliability: Arc::new(crate::config::ReliabilityConfig::default()),- provider_runtime_options: provider::ProviderRuntimeOptions::default(),+ provider_runtime_options: crate::tools::delegate::ProviderRuntimeOptions::default(),workspace_dir: Arc::new(std::env::temp_dir()),message_timeout_secs: CHANNEL_MESSAGE_TIMEOUT_SECS,multimodal: crate::config::MultimodalConfig::default(),diff --git a/crates/openhuman-core/src/channels/tests/telegram_integration.rs b/crates/openhuman-core/src/channels/tests/telegram_integration.rsindex 684dd48639..f2825436cd 100644--- a/crates/openhuman-core/src/channels/tests/telegram_integration.rs+++ b/crates/openhuman-core/src/channels/tests/telegram_integration.rs@@ -96,7 +96,7 @@ fn make_test_context(api_url: None,inference_url: None,reliability: Arc::new(crate::config::ReliabilityConfig::default()),- provider_runtime_options: crate::inference::provider::ProviderRuntimeOptions::default(),+ provider_runtime_options: crate::tools::delegate::ProviderRuntimeOptions::default(),workspace_dir: Arc::new(std::env::temp_dir()),message_timeout_secs: CHANNEL_MESSAGE_TIMEOUT_SECS,multimodal: crate::config::MultimodalConfig::default(),diff --git a/crates/openhuman-core/src/inference/provider/factory/managed_backend.rs b/crates/openhuman-core/src/inference/provider/factory/managed_backend.rsindex 707a13fedb..268b1ebb28 100644--- a/crates/openhuman-core/src/inference/provider/factory/managed_backend.rs+++ b/crates/openhuman-core/src/inference/provider/factory/managed_backend.rs@@ -137,7 +137,7 @@ pub(crate) fn make_openhuman_backend_model(/// [`Config`] (the configured `delegate` tool): `model` is used verbatim, with/// no tier translation and no egress emission, exactly as that tool always did.pub(crate) fn make_openhuman_backend_model_for_options(- options: &crate::inference::provider::ProviderRuntimeOptions,+ options: &crate::tools::delegate::ProviderRuntimeOptions,model: &str,thread_id: Option<&str>,) -> anyhow::Result<ManagedChatModel> {diff --git a/crates/openhuman-core/src/tools/delegate.rs b/crates/openhuman-core/src/tools/delegate.rsindex 1336278433..b18e0234a9 100644--- a/crates/openhuman-core/src/tools/delegate.rs+++ b/crates/openhuman-core/src/tools/delegate.rs@@ -1,12 +1,13 @@use crate::config::DelegateAgentConfig;use crate::inference::provider::factory::make_openhuman_backend_model_for_options;-use crate::inference::provider::{ProviderRuntimeOptions, INFERENCE_BACKEND_ID};+use crate::inference::provider::factory::INFERENCE_BACKEND_ID;use crate::security::policy::ToolOperation;use crate::security::SecurityPolicy;use crate::tools::timeout::tool_execution_timeout_secs;use async_trait::async_trait;use serde_json::json;use std::collections::HashMap;+use std::path::PathBuf;use std::sync::Arc;use std::time::Duration;use tinyagents_harness::context::RunContext;@@ -15,6 +16,26 @@ use tinyinference_llm::message::Message;use tinyinference_llm::model::ModelRequest;use tinytools::{Tool, ToolCallOptions, ToolResult, ToolRunContext};+/// Runtime overrides applied when the delegate tool builds a provider.+#[derive(Debug, Clone)]+pub(crate) struct ProviderRuntimeOptions {+ pub(crate) auth_profile_override: Option<String>,+ pub(crate) openhuman_dir: Option<PathBuf>,+ pub(crate) secrets_encrypt: bool,+ pub(crate) reasoning_enabled: Option<bool>,+}++impl Default for ProviderRuntimeOptions {+ fn default() -> Self {+ Self {+ auth_profile_override: None,+ openhuman_dir: None,+ secrets_encrypt: true,+ reasoning_enabled: None,+ }+ }+}+/// Tool that delegates a subtask to a named agent with a different/// provider/model configuration. Enables multi-agent workflows where/// a primary agent can hand off specialized work (research, coding,diff --git a/crates/openhuman-core/src/tools/ops.rs b/crates/openhuman-core/src/tools/ops.rsindex d217f6f98d..b78a35a4ce 100644--- a/crates/openhuman-core/src/tools/ops.rs+++ b/crates/openhuman-core/src/tools/ops.rs@@ -480,7 +480,7 @@ pub fn all_tools_with_runtime(tools.push(Box::new(DelegateTool::new_with_options(delegate_agents,security.clone(),- crate::inference::provider::ProviderRuntimeOptions {+ crate::tools::delegate::ProviderRuntimeOptions {auth_profile_override: None,openhuman_dir: root_config.config_path