Skip to content

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

docs(agent-harness): point tier validation docs at DefinitionSet

Steven Enamakelf5704ab82b04
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/definition_registry.rs b/crates/openhuman-core/src/agent/tinyagents/host/definition_registry.rs
index 41f066efca..1da2298564 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/definition_registry.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/definition_registry.rs
@@ -23,7 +23,7 @@
//! this: an agent may list a subagent id that a feature gate compiled out of
//! the build (`presentation_agent` without `documents`), and both existing resolution sites
//! tolerate it (`collect_orchestrator_tools` warns and skips;
-//! [`validate_tier_hierarchy`](crate::agent_registry::agents::validate_tier_hierarchy) explicitly `continue`s past unknown ids). So
+//! `DefinitionSet::validate_tier_hierarchy` explicitly continues past unknown ids). So
//! `OpenHumanDefinitionRegistry::resolve` returns `Ok(None)` for every miss
//! and this adapter has no error path at all.
//!
@@ -33,9 +33,9 @@
//! the tier hierarchy, so `delegates_for` applies
//! [`validate_tier_transition`](tinyagents_definition::validate_tier_transition)
//! — the same single source of truth
-//! [`validate_tier_hierarchy`](crate::agent_registry::agents::validate_tier_hierarchy) walks at boot — per declared pair. A `Worker`
+//! `DefinitionSet::validate_tier_hierarchy` walks at boot — per declared pair. A `Worker`
//! parent yields an empty list; a tier-illegal child is dropped. Unknown child
-//! ids are **kept**, matching both [`validate_tier_hierarchy`](crate::agent_registry::agents::validate_tier_hierarchy)'s `continue` and
+//! ids are **kept**, matching the owner's validator and
//! the trait's note that an authorized id may still fail to resolve.
//!
//! **3. Tool scopes remain host-materialized.** The portable definition
@@ -402,11 +402,11 @@ impl OpenHumanDefinitionRegistry {
/// Tier-checked delegate ids for `def`.
///
/// Reuses [`tinyagents_definition::validate_tier_transition`]
- /// — the single source of truth [`validate_tier_hierarchy`](crate::agent_registry::agents::validate_tier_hierarchy) walks at boot —
+ /// — the single source of truth `DefinitionSet::validate_tier_hierarchy` walks at boot —
/// so this seam can never disagree with the host's boot-time validation.
fn authorized_delegates(&self, def: &HostAgentDefinition) -> Vec<String> {
if def.agent_tier == AgentTier::Worker {
- // `validate_tier_hierarchy` hard-fails a worker that lists any
+ // the owner validator hard-fails a worker that lists any
// agent id, so a worker's authorized set is empty by construction.
return Vec::new();
}
@@ -414,7 +414,7 @@ impl OpenHumanDefinitionRegistry {
let mut out = Vec::new();
for id in def.allowed_subagent_ids() {
let Some(child) = self.host_definition(&id) else {
- // Unknown child: `validate_tier_hierarchy` `continue`s past it
+ // Unknown child: the owner validator tolerates it
// rather than failing, and the trait explicitly allows an
// authorized id that does not resolve in this build.
out.push(id);
diff --git a/crates/openhuman-core/src/agent_registry/agents/loader.rs b/crates/openhuman-core/src/agent_registry/agents/loader.rs
index eb3966d497..bec5f637f1 100644
--- a/crates/openhuman-core/src/agent_registry/agents/loader.rs
+++ b/crates/openhuman-core/src/agent_registry/agents/loader.rs
@@ -192,8 +192,6 @@ fn builtin_enabled(_b: &BuiltinAgent) -> bool {
/// `load_builtins` parses and validates the bundled archetypes using the
/// owning `tinyagents_definition::DefinitionSet`. Workspace definitions are
/// validated by `AgentDefinitionRegistry::load` after overrides are merged.
-/// agents that violate the contract fail the boot rather than crashing
-/// at spawn time.
/// Parse a single [`BuiltinAgent`] triple into a finished [`AgentDefinition`].
fn parse_builtin(b: &BuiltinAgent) -> Result<AgentDefinition> {
// The TOML ships without `system_prompt` — serde falls back to
diff --git a/docs/gitbooks/en/developing/architecture/agent-harness.md b/docs/gitbooks/en/developing/architecture/agent-harness.md
index 22a2cd454f..6f839bf73b 100644
--- a/docs/gitbooks/en/developing/architecture/agent-harness.md
+++ b/docs/gitbooks/en/developing/architecture/agent-harness.md
@@ -478,7 +478,7 @@ Why the rules.
Enforcement. Two layers:
-1. Loader-time (static). [`agents::loader::validate_tier_hierarchy`](https://github.com/senamakel/openhuman/blob/d1fc357e7bf633fb1f92f7601312ce0286b39427/crates/openhuman-core/src/agent_registry/agents/loader.rs) runs over the merged registry (built-ins + workspace TOMLs) and refuses to boot a registry that lists a same-tier or worker-with-subagents entry. Built-in archetypes are checked at compile-test time; user-shipped TOMLs are checked at workspace load.
+1. Loader-time (static). `tinyagents_definition::DefinitionSet::validate_tier_hierarchy` runs over the merged registry (built-ins + workspace TOMLs) and refuses to boot a registry that lists a same-tier or worker-with-subagents entry. Built-in archetypes are checked during loading; user-shipped TOMLs are checked at workspace load.
2. Runtime depth gate (dynamic). Independent of tier, the sub-agent runner caps total spawn chain depth at `MAX_SPAWN_DEPTH = 3` via a task-local counter incremented across `run_subagent`, surfaced as a `SpawnDepthExceeded` agent error. This makes a user-shipped TOML that drops the tier annotation still unable to recurse past three hops.
> Status: the loader-time tier check, `agent_tier` field, and runtime depth-counter task-local are live. Depth is bounded by both the static loader contract and the runtime `MAX_SPAWN_DEPTH = 3` guard.