Skip to content

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

test(embed): remove agents at the end of embed tests

Steven Enamakel469d5a029bf4
diff --git a/crates/openhuman-embed/tests/attached_tools.rs b/crates/openhuman-embed/tests/attached_tools.rs
index 8cd25d8ad9..8a950b1a6c 100644
--- a/crates/openhuman-embed/tests/attached_tools.rs
+++ b/crates/openhuman-embed/tests/attached_tools.rs
@@ -277,6 +277,8 @@ fn attached_tools_survive_clones_and_session_resume() {
);
}
}
+ runtime.remove_agent("attached").await.unwrap();
+ runtime.remove_agent("peer").await.unwrap();
})
.await
.unwrap();
@@ -342,6 +344,8 @@ fn attaching_before_first_turn_preserves_and_executes_native_tools() {
text.contains("native-wildcard-survived") && !text.contains("unknown tool"))),
"the native executor must actually run: {second}");
assert!(first["messages"].to_string().contains("ORIGINAL_FRESH_HOST_PROMPT"));
+ drop(agent);
+ runtime.remove_agent("fresh-attached").await.unwrap();
}).await.unwrap();
});
}
diff --git a/crates/openhuman-embed/tests/cron_agents.rs b/crates/openhuman-embed/tests/cron_agents.rs
index 75e496025a..498d1517f8 100644
--- a/crates/openhuman-embed/tests/cron_agents.rs
+++ b/crates/openhuman-embed/tests/cron_agents.rs
@@ -216,6 +216,7 @@ fn a_scheduled_job_runs_a_runtime_agent_with_its_host_tool_as_cron() {
));
drop(agent);
+ runtime.remove_agent("teeny").await.unwrap();
drop(runtime);
})
.await
diff --git a/crates/openhuman-embed/tests/host_only_tools.rs b/crates/openhuman-embed/tests/host_only_tools.rs
index 5eecf67080..7579ecd9f3 100644
--- a/crates/openhuman-embed/tests/host_only_tools.rs
+++ b/crates/openhuman-embed/tests/host_only_tools.rs
@@ -248,6 +248,8 @@ fn host_only_refuses_builtin_tools_the_model_names() {
assert!(results.contains("read_file-host-result"), "{results}");
assert!(results.contains("unknown tool `shell`"), "{results}");
assert!(results.contains("unknown tool `write_file`"), "{results}");
+ drop(agent);
+ runtime.remove_agent("refuser").await.unwrap();
})
.await
.expect("test task");
@@ -283,6 +285,8 @@ fn host_only_forces_read_only_access_and_sandbox() {
);
assert!(agent.access().turn_origin().is_none());
assert!(agent.config().autonomy.trusted_roots.is_empty());
+ drop(agent);
+ runtime.remove_agent("readonly").await.unwrap();
})
.await
.expect("test task");
diff --git a/crates/openhuman-embed/tests/structured_turns.rs b/crates/openhuman-embed/tests/structured_turns.rs
index 6e61b91467..1dc95aa091 100644
--- a/crates/openhuman-embed/tests/structured_turns.rs
+++ b/crates/openhuman-embed/tests/structured_turns.rs
@@ -194,6 +194,8 @@ fn a_tool_loop_ends_in_a_structured_answer() {
assert_eq!(body["response_format"]["type"], "json_schema", "{body}");
assert_eq!(body["max_tokens"], 512, "{body}");
}
+ drop(agent);
+ runtime.remove_agent("structured").await.unwrap();
})
.await
.expect("test task");
@@ -248,6 +250,11 @@ fn successful_turn_preserves_reported_charges_and_invalid_buyer_cost_is_unknown(
assert_eq!(usage.cached_input_tokens, 3);
assert_eq!(usage.reasoning_tokens, 2);
assert_eq!(metered.lock().unwrap().as_ref().unwrap().cost_usd, expected);
+ drop(agent);
+ runtime
+ .remove_agent(&format!("reported-cost-{index}"))
+ .await
+ .unwrap();
}
})
.await
@@ -313,6 +320,10 @@ fn untrusted_input_passes_the_prompt_guard_only_on_a_host_only_agent() {
1,
"only the accepted turn reached the provider"
);
+ drop(normal);
+ drop(host_only);
+ runtime.remove_agent("normal").await.unwrap();
+ runtime.remove_agent("untrusted").await.unwrap();
})
.await
.expect("test task");
@@ -359,6 +370,8 @@ fn terminal_schema_validation_retries_without_accepting_a_wrong_type() {
.unwrap();
assert_eq!(outcome.structured, Some(json!({"summary":"incomplete"})));
assert_eq!(chat_requests(&provider).await.len(), 2);
+ drop(agent);
+ runtime.remove_agent("strict-repair").await.unwrap();
})
.await
.unwrap();
@@ -404,6 +417,8 @@ fn a_complete_json_value_with_a_length_finish_is_not_a_valid_answer() {
assert_eq!(failure.attempts, 1);
assert!(failure.usage.is_some());
assert_eq!(chat_requests(&provider).await.len(), 1);
+ drop(agent);
+ runtime.remove_agent("strict-length").await.unwrap();
})
.await
.unwrap();
@@ -435,6 +450,8 @@ fn shared_budget_stops_the_tool_loop_before_its_next_provider_call() {
assert_eq!(reads.load(Ordering::SeqCst),1);
assert_eq!(chat_requests(&provider).await.len(),1);
assert_eq!(ledger.snapshot().spent.cost_micros,100);
+ drop(agent);
+ runtime.remove_agent("budgeted").await.unwrap();
}).await.unwrap();
});
}
@@ -500,6 +517,11 @@ fn empty_truncated_terminal_answers_use_only_the_explicit_repair_allowance() {
chat_requests(&provider).await.len(),
usize::from(retries) + 1
);
+ drop(agent);
+ runtime
+ .remove_agent(&format!("empty-truncated-{retries}"))
+ .await
+ .unwrap();
}
})
.await