Skip to content

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

chore: files changed crates/openhuman-core/src/agent/registry/agents/loader.rs,crates/openhuman-core

Steven Enamakel30669000bfe1
diff --git a/crates/openhuman-core/src/agent/registry/agents/loader.rs b/crates/openhuman-core/src/agent/registry/agents/loader.rs
index 0f7620a378..2ba4446079 100644
--- a/crates/openhuman-core/src/agent/registry/agents/loader.rs
+++ b/crates/openhuman-core/src/agent/registry/agents/loader.rs
@@ -267,7 +267,8 @@ fn parse_builtin(b: &BuiltinAgent) -> Result<AgentDefinition> {
.with_context(|| format!("parsing built-in agent `{}` TOML", b.id))?;
// Install the function-driven prompt builder and stamp the source.
- def.system_prompt = PromptSource::Dynamic(b.prompt_fn);
+ def.system_prompt = PromptSource::Dynamic(());
+ def.extensions.prompt_builder = Some(b.prompt_fn);
def.source = DefinitionSource::Builtin;
// Sanity check: file layout id must match declared TOML id. This
diff --git a/crates/openhuman-core/src/agent/registry/defaults.rs b/crates/openhuman-core/src/agent/registry/defaults.rs
index 0a9bdc9005..c66b5fd3f5 100644
--- a/crates/openhuman-core/src/agent/registry/defaults.rs
+++ b/crates/openhuman-core/src/agent/registry/defaults.rs
@@ -83,9 +83,6 @@ pub fn definition_from_registry_entry(entry: &AgentRegistryEntry) -> AgentDefini
when_to_use: entry.description.clone(),
display_name: Some(entry.name.clone()),
system_prompt: PromptSource::Inline(entry.system_prompt.clone().unwrap_or_default()),
- omit_identity: true,
- omit_memory_context: true,
- omit_safety_preamble: true,
model: registry_value_to_model_spec(entry.model.as_deref()),
temperature: 0.4,
tools: allowlist_to_tool_scope(&entry.tool_allowlist),
@@ -101,7 +98,6 @@ pub fn definition_from_registry_entry(entry: &AgentRegistryEntry) -> AgentDefini
timeout_secs: None,
sandbox_mode: SandboxMode::None,
background: false,
- tokenjuice_compression: Default::default(),
subagents: entry
.subagents
.allowlist
@@ -111,8 +107,8 @@ pub fn definition_from_registry_entry(entry: &AgentRegistryEntry) -> AgentDefini
.collect(),
delegate_name: None,
agent_tier: AgentTier::Worker,
- searches_connected_mcp: false,
source: DefinitionSource::CustomRegistry,
+ ..Default::default()
}
}
diff --git a/crates/openhuman-core/src/agent/session_host/builder/factory.rs b/crates/openhuman-core/src/agent/session_host/builder/factory.rs
index a3b4739f90..1a1dccaae9 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/factory.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/factory.rs
@@ -344,7 +344,13 @@ impl OpenHumanSessionHost {
// body and get wrapped by [`SystemPromptBuilder::for_subagent`].
let prompt_builder = match target_def {
Some(def) => match &def.system_prompt {
- PromptSource::Dynamic(build) => SystemPromptBuilder::from_dynamic(*build),
+ PromptSource::Dynamic(()) => match def.extensions.prompt_builder {
+ Some(build) => SystemPromptBuilder::from_dynamic(build),
+ None => anyhow::bail!(
+ "agent `{}` declares a dynamic prompt but has no builder",
+ def.id
+ ),
+ },
PromptSource::Verbatim(text) => SystemPromptBuilder::verbatim(text.clone()),
PromptSource::Inline(text) => SystemPromptBuilder::for_subagent(
text.clone(),
@@ -668,7 +674,7 @@ impl OpenHumanSessionHost {
.map(|def| def.extensions.omit_memory_context)
.unwrap_or(false);
let effective_tokenjuice_compression = target_def
- .map(|def| def.effective_tokenjuice_compression())
+ .map(|def| def.extensions.effective_tokenjuice_compression(&def.model))
.unwrap_or(tinyjuice_bus::types::AgentTokenjuiceCompression::Full);
// Stamp the resolved agent definition id onto the OpenHumanSessionHost via the
diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs
index bb2ef4e760..e9de9230d1 100644
--- a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs
@@ -780,10 +780,10 @@ async fn run_typed_mode(
let system_prompt = match &definition.system_prompt {
// The whole prompt, with no sub-agent sections around it.
PromptSource::Dynamic(_) | PromptSource::Verbatim(_) => {
- load_prompt_source(&definition.system_prompt, &prompt_ctx)?
+ load_prompt_source(definition, &prompt_ctx)?
}
PromptSource::Inline(_) | PromptSource::File { .. } => {
- let archetype_prompt_body = load_prompt_source(&definition.system_prompt, &prompt_ctx)?;
+ let archetype_prompt_body = load_prompt_source(definition, &prompt_ctx)?;
render_subagent_system_prompt_with_format(
&parent.workspace_dir,
&model,
@@ -943,7 +943,9 @@ async fn run_typed_mode(
"subagent",
// Agent-level TokenJuice profile → sub-agent context middleware
// (#4466), so sub-agent tool outputs compact like the chat path.
- definition.effective_tokenjuice_compression(),
+ definition
+ .extensions
+ .effective_tokenjuice_compression(&definition.model),
// The spawn-wide config snapshot supplies the `[context]`
// knobs the graph used to load for itself.
config.as_ref().ok().map(|c| c.as_ref()),
diff --git a/crates/openhuman-core/src/agent/subagent_host/tool_prep.rs b/crates/openhuman-core/src/agent/subagent_host/tool_prep.rs
index a955d300c4..13d8b5c818 100644
--- a/crates/openhuman-core/src/agent/subagent_host/tool_prep.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/tool_prep.rs
@@ -208,16 +208,25 @@ pub(super) fn prompt_tools_for<'a>(
}
pub(super) fn load_prompt_source(
- source: &PromptSource,
+ definition: &AgentDefinition,
ctx: &PromptContext<'_>,
) -> Result<String, SubagentRunError> {
let workspace_dir = ctx.workspace_dir;
- match source {
+ match &definition.system_prompt {
PromptSource::Inline(body) | PromptSource::Verbatim(body) => Ok(body.clone()),
- PromptSource::Dynamic(build) => build(ctx).map_err(|e| SubagentRunError::PromptLoad {
- path: format!("<dynamic:{}>", ctx.agent_id),
- source: std::io::Error::other(e.to_string()),
- }),
+ PromptSource::Dynamic(()) => {
+ let dynamic_path = || format!("<dynamic:{}>", ctx.agent_id);
+ let build = definition.extensions.prompt_builder.ok_or_else(|| {
+ SubagentRunError::PromptLoad {
+ path: dynamic_path(),
+ source: std::io::Error::other("dynamic prompt has no registered builder"),
+ }
+ })?;
+ build(ctx).map_err(|e| SubagentRunError::PromptLoad {
+ path: dynamic_path(),
+ source: std::io::Error::other(e.to_string()),
+ })
+ }
PromptSource::File { path } => {
// Try the workspace's `agent/prompts/` first (so users can
// override built-in prompts), then fall back to the crate's
diff --git a/crates/openhuman-core/src/agent/triage/evaluator/prompt.rs b/crates/openhuman-core/src/agent/triage/evaluator/prompt.rs
index c81586b028..c0525a7b8d 100644
--- a/crates/openhuman-core/src/agent/triage/evaluator/prompt.rs
+++ b/crates/openhuman-core/src/agent/triage/evaluator/prompt.rs
@@ -15,7 +15,8 @@ pub(crate) fn extract_inline_prompt(def: &AgentDefinition) -> Option<String> {
PromptSource::Inline(body) | PromptSource::Verbatim(body) if !body.is_empty() => {
Some(body.clone())
}
- PromptSource::Dynamic(build) => {
+ PromptSource::Dynamic(()) => {
+ let build = def.extensions.prompt_builder?;
use crate::agent::prompts::{
ConnectedIntegration, PromptContext, PromptTool, ToolCallFormat,
};