Skip to content

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

docs(agent_registry): update loader docs for prompt_builder extension

Steven Enamakel2538dbf3a706
diff --git a/crates/openhuman-core/src/agent_registry/README.md b/crates/openhuman-core/src/agent_registry/README.md
index c382f897cb..b4bc599860 100644
--- a/crates/openhuman-core/src/agent_registry/README.md
+++ b/crates/openhuman-core/src/agent_registry/README.md
@@ -68,13 +68,13 @@ runtime-dependent sections (rendered tool list, workspace) to it.
Every archetype uses the shared sub-agent turn graph.
[`agents/loader.rs`](agents/loader.rs) owns the `BUILTINS` slice and
-`load_builtins`, which parses each `agent.toml`, installs
-`PromptSource::Dynamic(prompt_fn)`, stamps
-`DefinitionSource::Builtin`, checks that the folder id matches the TOML id,
-and then runs `DefinitionSet::validate_tier_hierarchy`: a `worker` may not list any agent-id
-subagent, and `chat -> chat` / `reasoning -> reasoning` delegation is
-rejected (the pair rule is `validate_tier_transition` in the harness; unknown
-subagent ids are tolerated here as a separate integrity concern).
+`load_builtins`, which parses each `agent.toml`, sets the dynamic-prompt marker
+and stores its prompt callback in `AgentDefinition.extensions.prompt_builder`,
+stamps `DefinitionSource::Builtin`, and checks that the folder id matches the
+TOML id. It then calls `DefinitionSet::validate_tier_hierarchy`: a `worker`
+may not list any agent-id subagent, and `chat -> chat` / `reasoning -> reasoning`
+delegation is rejected (the pair rule is `validate_tier_transition` in the
+owner definition crate; unknown subagent ids are tolerated here).
`BUILTINS` is also the registration point for archetypes that live with
other domains: `skill_setup`
([`skills/catalog/agent/`](../../skills/catalog/agent/), feature `skills`), and
diff --git a/crates/openhuman-core/src/agent_registry/agents/loader.rs b/crates/openhuman-core/src/agent_registry/agents/loader.rs
index 72b2f8f3a1..b083a95c6a 100644
--- a/crates/openhuman-core/src/agent_registry/agents/loader.rs
+++ b/crates/openhuman-core/src/agent_registry/agents/loader.rs
@@ -19,19 +19,20 @@
//!
//! 1. [`load_builtins`] walks [`BUILTINS`].
//! 2. For each entry, parses `agent.toml` into an [`AgentDefinition`].
-//! 3. Replaces the (unset) `system_prompt` with `PromptSource::Dynamic(prompt_fn)`
+//! 3. Sets the `PromptSource::Dynamic(())` marker and stores the callback in
+//! the host-only `extensions.prompt_builder` field.
//! 4. Stamps `source = DefinitionSource::Builtin` and checks the folder id
//! matches the TOML `id`.
//! 5. Returns the full `Vec<AgentDefinition>`, in the order listed in [`BUILTINS`].
//!
//! Workspace-level overrides (`$OPENHUMAN_WORKSPACE/agents/*.toml`) are
-//! handled separately by [`crate::agent::harness::definition_loader`] and merged
-//! into the global registry, where they replace built-ins on `id`
+//! handled separately by [`crate::agent_registry::host_definition::AgentDefinitionRegistry`]
+//! and merged into the global registry, where they replace built-ins on id
//! collision.
use crate::agent_registry::host_definition::{AgentDefinition, PromptBuilder};
use anyhow::{Context, Result};
-use tinyagents_definition::{DefinitionSet, DefinitionSource, PromptSource, parse_str};
+use tinyagents_definition::{parse_str, DefinitionSet, DefinitionSource, PromptSource};
/// A single built-in agent: its id plus the metadata TOML and a
/// function-driven prompt builder.
diff --git a/crates/openhuman-core/src/agent_registry/agents/mod.rs b/crates/openhuman-core/src/agent_registry/agents/mod.rs
index c5e9d0e851..bb0c6f1dd1 100644
--- a/crates/openhuman-core/src/agent_registry/agents/mod.rs
+++ b/crates/openhuman-core/src/agent_registry/agents/mod.rs
@@ -17,8 +17,8 @@
//! definition. Most archetypes keep a `prompt_tests.rs` beside it.
//!
//! `loader.rs` holds [`BUILTINS`] and [`load_builtins`]. It delegates tier
-//! validation to `tinyagents_definition::DefinitionSet`. The slice also registers archetypes that
-//! live with other domains (`skills/*/agent/`,
+//! validation to `tinyagents_definition::DefinitionSet`. The slice also
+//! registers archetypes that live with other domains (`skills/*/agent/`,
//! `flows/agents/`), so this directory is not the full built-in set. The
//! package `README.md` one level up describes what each archetype does.
@@ -51,4 +51,4 @@ pub mod video_agent;
#[path = "vision_agent/prompt.rs"]
pub mod vision_agent;
-pub use loader::{BUILTINS, BuiltinAgent, load_builtins};
+pub use loader::{load_builtins, BuiltinAgent, BUILTINS};