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
test(agent_builder): add model source tests and clean up builder tests
Steven Enamakeldf2bc779d6d7
diff --git a/crates/openhuman-core/src/agent/session_host/builder/builder_tests.rs b/crates/openhuman-core/src/agent/session_host/builder/builder_tests.rsindex 238712fcd6..6b1ac1243d 100644--- a/crates/openhuman-core/src/agent/session_host/builder/builder_tests.rs+++ b/crates/openhuman-core/src/agent/session_host/builder/builder_tests.rs@@ -59,6 +59,8 @@ fn wildcard_probe_def() -> crate::agent_registry::host_definition::AgentDefiniti#[path = "builder_tests_explicit_definition_tests.rs"]mod explicit_definition_tests;+#[path = "builder_tests_model_source_tests.rs"]+mod model_source_tests;#[path = "builder_tests_host_only_tests.rs"]mod host_only_tests;#[path = "builder_tests_host_tools_tests.rs"]diff --git a/crates/openhuman-core/src/agent/session_host/builder/builder_tests_model_source_tests.rs b/crates/openhuman-core/src/agent/session_host/builder/builder_tests_model_source_tests.rsnew file mode 100644index 0000000000..b1529fd1d8--- /dev/null+++ b/crates/openhuman-core/src/agent/session_host/builder/builder_tests_model_source_tests.rs@@ -0,0 +1,19 @@+use super::*;+use std::sync::Arc;++#[test]+fn builder_requires_a_model_when_no_host_policy_is_installed() {+ let model: Arc<dyn tinyinference_llm::model::ChatModel<()>> =+ Arc::new(tinyagents_harness::testkit::ScriptedModel::new(Vec::new()));+ let error = crate::agent::SessionHostBuilder::new()+ .chat_model(model)+ .tools(Vec::new())+ .tool_dispatcher(Box::new(tinytools_agent::dialect::XmlDialect))+ .build()+ .err()+ .expect("a bare core builder needs an explicit model");++ assert!(error+ .to_string()+ .contains("model_name or configured provider default is required"));+}diff --git a/tests/in_process/agent_builder_public.rs b/tests/in_process/agent_builder_public.rsindex 6f3e12fef2..d7ac35ac18 100644--- a/tests/in_process/agent_builder_public.rs+++ b/tests/in_process/agent_builder_public.rs@@ -49,10 +49,6 @@ impl Tool for StubTool {}fn base_builder() -> openhuman_core::agent::SessionHostBuilder {- base_builder_without_model().model_name("stub-model".into())-}--fn base_builder_without_model() -> openhuman_core::agent::SessionHostBuilder {OpenHumanSessionHost::builder().chat_model(Arc::new(StubModel)).tools(vec![@@ -60,6 +56,7 @@ fn base_builder_without_model() -> openhuman_core::agent::SessionHostBuilder {Box::new(StubTool("beta")),]).tool_dispatcher(Box::new(XmlDialect))+ .model_name("stub-model".into())}#[test]@@ -86,15 +83,6 @@ fn builder_validates_required_fields() {assert!(err.to_string().contains("tool_dispatcher is required"));}-#[test]-fn builder_requires_a_model_when_no_host_policy_is_installed() {- let err = base_builder_without_model()- .build()- .err()- .expect("a bare core builder needs an explicit model");- assert!(err.to_string().contains("model_name or configured provider default is required"));-}-#[test]fn builder_applies_defaults_and_exposes_public_accessors() {let agent = base_builder()