Skip to content

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

refactor(core): simplify request validation and test setup

Steven Enamakel23eec8be16a9
diff --git a/crates/openhuman-core/src/inference/host_runtime/ops/complete_once.rs b/crates/openhuman-core/src/inference/host_runtime/ops/complete_once.rs
index 1e586926d7..1da51b7e6b 100644
--- a/crates/openhuman-core/src/inference/host_runtime/ops/complete_once.rs
+++ b/crates/openhuman-core/src/inference/host_runtime/ops/complete_once.rs
@@ -79,9 +79,7 @@ pub async fn complete_once_observed(
std::sync::Arc<dyn tinyagents_harness::observability::PhysicalDispatchObserver>,
>,
) -> Result<ModelResponse, String> {
- if let Err(message) = validate_complete_once_request(&request) {
- return Err(message);
- }
+ validate_complete_once_request(&request)?;
complete_once_controlled(endpoint, request, budget, observer, None)
.await
.map_err(|error| match error {
diff --git a/crates/openhuman-embed/tests/attached_tools.rs b/crates/openhuman-embed/tests/attached_tools.rs
index 376fbd0837..4f7b008216 100644
--- a/crates/openhuman-embed/tests/attached_tools.rs
+++ b/crates/openhuman-embed/tests/attached_tools.rs
@@ -316,24 +316,9 @@ fn attaching_before_first_turn_preserves_and_executes_native_tools() {
.and(path("/v1/chat/completions"))
.respond_with(NativeCall(std::sync::atomic::AtomicUsize::new(0)))
.mount(&provider).await;
- let runtime_result = Runtime::builder()
+ let runtime = Runtime::builder()
.config(offline_config()).workspace(Workspace::Ephemeral)
- .backend_url(backend.uri()).build().await;
- if let Err(error) = &runtime_result {
- let variant = match error {
- openhuman_embed::RuntimeError::Call(_) => "Call",
- openhuman_embed::RuntimeError::Build(_) => "Build",
- openhuman_embed::RuntimeError::Workspace { .. } => "Workspace",
- openhuman_embed::RuntimeError::AlreadyRunning => "AlreadyRunning",
- openhuman_embed::RuntimeError::Invalid(_) => "Invalid",
- openhuman_embed::RuntimeError::BlankApiKey => "BlankApiKey",
- openhuman_embed::RuntimeError::MissingFeature { .. } => "MissingFeature",
- openhuman_embed::RuntimeError::MissingStorageFeature { .. } => "MissingStorageFeature",
- openhuman_embed::RuntimeError::NoSessionStore => "NoSessionStore",
- };
- eprintln!("attached-tools test runtime build failed: {variant}");
- }
- let runtime = runtime_result.unwrap();
+ .backend_url(backend.uri()).build().await.unwrap();
let agent = runtime.agent(AgentSpec::new("fresh-attached")
.provider(Provider::openai_compatible(format!("{}/v1",provider.uri()),"fixture").model("fixture"))
.definition(AgentDefinitionSpec::new().system_prompt("ORIGINAL_FRESH_HOST_PROMPT")