Skip to content

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

chore(harness): remove builtin agent definitions module

Steven Enamakeld889e61b44d3
diff --git a/crates/openhuman-core/src/agent/harness/builtin_definitions_tests.rs b/crates/openhuman-core/src/agent/harness/builtin_definitions_tests.rs
deleted file mode 100644
index 50a9345c21..0000000000
--- a/crates/openhuman-core/src/agent/harness/builtin_definitions_tests.rs
+++ /dev/null
@@ -1,119 +0,0 @@
-use super::*;
-
-#[test]
-fn all_definitions_present() {
- let defs = all();
- // Count enabled built-ins, accounting for feature gates (e.g., presentation_agent only when documents is on).
- let enabled_builtins = crate::agent::registry::agents::BUILTINS
- .iter()
- .filter(|_b| {
- #[cfg(not(feature = "documents"))]
- if _b.id == "presentation_agent" {
- return false;
- }
- true
- })
- .count();
- // +3 for the cfg(test) default parent and inherit-based test defs appended by all().
- let expected = enabled_builtins + 3;
- assert_eq!(
- defs.len(),
- expected,
- "Expected {} definitions but got {} (enabled BUILTINS={}, +3 test overrides)",
- expected,
- defs.len(),
- enabled_builtins
- );
-}
-
-#[test]
-fn test_main_allows_test_inherit_workers() {
- use tinyagents_definition::SubagentEntry;
- let def = all()
- .into_iter()
- .find(|d| d.id == "main")
- .expect("test-only main agent must be registered in test builds");
- let allowed = def
- .subagents
- .iter()
- .filter_map(|entry| match entry {
- SubagentEntry::AgentId(id) => Some(id.as_str()),
- SubagentEntry::Skills(_) => None,
- })
- .collect::<std::collections::HashSet<_>>();
- assert!(allowed.contains("__test_inherit_echo"));
- assert!(allowed.contains("__test_inherit_parallel_worker"));
-}
-
-#[test]
-fn test_inherit_echo_is_present_and_inherits() {
- use tinyagents_definition::ModelSpec;
- let def = all()
- .into_iter()
- .find(|d| d.id == "__test_inherit_echo")
- .expect("test-only inherit agent must be registered in test builds");
- assert!(
- matches!(def.model, ModelSpec::Inherit),
- "must be Inherit so the sub-agent uses the parent's (mock) provider"
- );
-}
-
-#[test]
-fn test_inherit_parallel_worker_is_present_and_inherits() {
- use tinyagents_definition::{ModelSpec, ToolScope};
- let def = all()
- .into_iter()
- .find(|d| d.id == "__test_inherit_parallel_worker")
- .expect("test-only parallel worker must be registered in test builds");
- assert!(
- matches!(def.model, ModelSpec::Inherit),
- "must be Inherit so the sub-agent uses the parent's (mock) provider"
- );
- assert!(
- matches!(def.tools, ToolScope::Named(ref names) if names == &vec!["fixture_step".to_string()]),
- "parallel worker must expose only the fixture_step tool"
- );
-}
-
-#[test]
-fn all_builtin_ids_are_stamped_builtin_source() {
- for def in all() {
- assert_eq!(
- def.source,
- DefinitionSource::Builtin,
- "{} should be Builtin",
- def.id
- );
- }
-}
-
-#[test]
-fn expected_builtin_ids_are_present() {
- let ids: Vec<String> = all().into_iter().map(|d| d.id).collect();
- for expected in [
- "orchestrator",
- "planner",
- "task_manager_agent",
- "critic",
- "summarizer",
- // Gated with `flows` (#4797) — absent from a slim build.
- #[cfg(feature = "flows")]
- "workflow_builder",
- #[cfg(feature = "flows")]
- "flow_discovery",
- ] {
- assert!(ids.contains(&expected.to_string()), "missing {expected}");
- }
- for removed in [
- "archivist",
- "profile_memory_agent",
- "flow_memory_agent",
- "goals_agent",
- "agent_memory",
- ] {
- assert!(
- !ids.contains(&removed.to_string()),
- "v1 memory agent {removed} must stay removed"
- );
- }
-}
diff --git a/crates/openhuman-core/src/agent/harness/builtin_definitions.rs b/crates/openhuman-core/src/agent/harness/test_support.rs
similarity index 76%
rename from crates/openhuman-core/src/agent/harness/builtin_definitions.rs
rename to crates/openhuman-core/src/agent/harness/test_support.rs
index c3649b23e3..7eeffc8884 100644
--- a/crates/openhuman-core/src/agent/harness/builtin_definitions.rs
+++ b/crates/openhuman-core/src/agent/harness/test_support.rs
@@ -1,45 +1,8 @@
-//! Built-in [`AgentDefinition`]s.
-//!
-//! The authoritative list of built-in agents lives in
-//! [`crate::agent::registry::agents`] — each agent is a subfolder
-//! containing `agent.toml` + `prompt.md`. This module is a thin
-//! wrapper that loads that set.
-//!
-//! Custom TOML definitions loaded later by
-//! [`super::definition_loader`] override any built-in with the same id.
+//! Test-only agent definitions used by harness and orchestration tests.
use super::host_definition::AgentDefinition;
-#[cfg(test)]
use tinyagents_definition::DefinitionSource;
-/// All built-in definitions, in stable order.
-///
-/// Panics if the baked-in built-in TOML fails to parse. `include_str!`
-/// guarantees at compile time that each file exists, but the actual
-/// TOML parse happens at runtime; the unit tests in
-/// [`crate::agent::registry::agents`] verify in CI that every entry in
-/// [`crate::agent::registry::agents::BUILTINS`] still parses cleanly.
-///
-/// In `#[cfg(test)]` builds the list additionally contains
-/// [`test_inherit_echo_def`] — a sub-agent with `ModelSpec::Inherit`
-/// that exists solely so the spawn-subagent end-to-end test can
-/// exercise the dispatch/threading plumbing with the *parent's*
-/// provider (every shipped builtin uses `Hint(...)`, which after
-/// #1710 builds a fresh factory provider and therefore can't share a
-/// test's `MockProvider`). It is never compiled into release builds.
-pub fn all() -> Vec<AgentDefinition> {
- #[allow(unused_mut)]
- let mut defs = crate::agent::registry::agents::load_builtins()
- .expect("built-in agent TOML must always parse (see agents/*/agent.toml)");
- #[cfg(test)]
- {
- defs.push(test_main_def());
- defs.push(test_inherit_echo_def());
- defs.push(test_inherit_parallel_worker_def());
- }
- defs
-}
-
/// Test-only parent used by `AgentBuilder`'s default `agent_definition_name = "main"`.
///
/// Production builds do not ship a `main` agent definition. In tests, the
@@ -177,6 +140,3 @@ pub(crate) fn test_inherit_parallel_worker_def() -> AgentDefinition {
}
}
-#[cfg(test)]
-#[path = "builtin_definitions_tests.rs"]
-mod tests;