Skip to content

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

feat(agent): add subagent registration and prompt rendering support

Steven Enamakel14958fc28604
diff --git a/crates/openhuman-core/src/agent/prompts/builder.rs b/crates/openhuman-core/src/agent/prompts/builder.rs
index 7bee0b58e9..8c4d3d55b8 100644
--- a/crates/openhuman-core/src/agent/prompts/builder.rs
+++ b/crates/openhuman-core/src/agent/prompts/builder.rs
@@ -195,8 +195,7 @@ impl SystemPromptBuilder {
}
// Skills catalogue and connected integrations are rendered by
// the individual agent's `prompt.rs` when that agent needs
- // them (integrations_agent for the skill-executor voice,
- // orchestrator/welcome for the delegator voice). The shared
+ // them (orchestrator/welcome for the delegator voice). The shared
// builder intentionally does not emit them — keeping
// agent-specific prose scoped to the agent that owns it.
sections.push(Box::new(WorkspaceSection));
@@ -235,7 +234,7 @@ impl SystemPromptBuilder {
Box::new(DynamicPromptSection::new(builder)),
// Project instructions (AGENTS.md). The ~26 dynamic
// `agents/<id>/prompt.rs` builders (orchestrator / main chat,
- // welcome, integrations_agent, …) hand-assemble their own body
+ // welcome, …) hand-assemble their own body
// via the `render_*` helpers and none of them individually call
// `render_agents_md`, so the pre-loaded AGENTS.md layers on
// `PromptContext` would otherwise be silently dropped for the
diff --git a/crates/openhuman-core/src/agent/prompts/mod_tests_agents_md_registration_tests.rs b/crates/openhuman-core/src/agent/prompts/mod_tests_agents_md_registration_tests.rs
index d02832b78d..a7e42495e9 100644
--- a/crates/openhuman-core/src/agent/prompts/mod_tests_agents_md_registration_tests.rs
+++ b/crates/openhuman-core/src/agent/prompts/mod_tests_agents_md_registration_tests.rs
@@ -42,7 +42,7 @@ fn agents_md_section_registered_in_default_builder() {
#[test]
fn agents_md_section_registered_in_dynamic_builder() {
- // The primary/orchestrator + welcome + integrations_agent path:
+ // The primary/orchestrator + welcome path:
// `PromptSource::Dynamic` agents assemble their own body via `render_*`
// helpers and never call `render_agents_md` individually, so the shared
// AGENTS.md section is injected centrally in `from_dynamic`. Without this
diff --git a/crates/openhuman-core/src/agent/prompts/render_helpers/section_renderers.rs b/crates/openhuman-core/src/agent/prompts/render_helpers/section_renderers.rs
index c088f8200d..84ad6e977b 100644
--- a/crates/openhuman-core/src/agent/prompts/render_helpers/section_renderers.rs
+++ b/crates/openhuman-core/src/agent/prompts/render_helpers/section_renderers.rs
@@ -65,8 +65,7 @@ pub fn render_grounding() -> &'static str {
}
// `render_skills` and `render_connected_integrations` helpers are
-// gone — `## Available Skills` lives in `integrations_agent/prompt.rs`, and
-// the connected-integrations / delegation-guide blocks each live in
+// gone — the connected-integrations / delegation-guide blocks each live in
// their owning agent's `prompt.rs` so no branching-on-agent-id logic
// needs to exist here.
diff --git a/crates/openhuman-core/src/agent/prompts/render_helpers/subagent.rs b/crates/openhuman-core/src/agent/prompts/render_helpers/subagent.rs
index c81b1d32ba..39ed2ea9a1 100644
--- a/crates/openhuman-core/src/agent/prompts/render_helpers/subagent.rs
+++ b/crates/openhuman-core/src/agent/prompts/render_helpers/subagent.rs
@@ -198,8 +198,7 @@ pub fn render_subagent_system_prompt_with_format(
out.push_str("\nUse the provided tools to accomplish the task. Reply with a concise, dense final answer when you have one — the parent agent will weave it back into the user-visible response.\n\n");
// 3b. Optional safety preamble. Definitions that do work with real
- // side-effects (code_executor, tool_maker, integrations_agent) set
- // `omit_safety_preamble = false` so the narrow renderer used to
+ // side-effects set `omit_safety_preamble = false` so the narrow renderer used to
// silently drop that instruction — we now honour the flag.
// Byte-identical to `SafetySection::build`.
if options.include_safety_preamble {
@@ -217,9 +216,8 @@ pub fn render_subagent_system_prompt_with_format(
// 3c/3d. `## Available Skills` and `## Connected Integrations`
// are no longer emitted here. Each agent that needs them
- // renders its own block in its `prompt.rs` (integrations_agent
- // owns the executor voice, orchestrator/welcome own the
- // delegator voice). Legacy Inline/File-sourced TOML agents
+ // renders its own block in its `prompt.rs`
+ // (orchestrator/welcome own the delegator voice). Legacy Inline/File-sourced TOML agents
// that still route through this helper simply don't get
// either block — which matches the fact that none of them
// currently opt in.
diff --git a/crates/openhuman-core/src/agent/prompts/sections.rs b/crates/openhuman-core/src/agent/prompts/sections.rs
index 7950051150..9efebf7535 100644
--- a/crates/openhuman-core/src/agent/prompts/sections.rs
+++ b/crates/openhuman-core/src/agent/prompts/sections.rs
@@ -46,8 +46,8 @@ impl PromptSection for ArchetypePromptSection {
}
/// Section that defers to a [`crate::agent::harness::definition::PromptBuilder`]
-/// every time it renders, so dynamic prompts (orchestrator, welcome,
-/// integrations_agent, …) get to see the live runtime
+/// every time it renders, so dynamic prompts (orchestrator, welcome, …)
+/// get to see the live runtime
/// [`PromptContext`] — including `connected_integrations`, which are
/// fetched asynchronously after the builder itself has been
/// constructed.
@@ -117,10 +117,9 @@ pub struct GroundingSection;
// `WorkflowsSection` and `ConnectedIntegrationsSection` previously lived
// here and branched on `ctx.agent_id` to pick between the skill-
// executor and delegator voice. They've been removed — each agent's
-// `prompt.rs` now renders its own block inline (integrations_agent owns the
-// `## Available Skills` + executor-voice `## Connected Integrations`
-// blocks, orchestrator owns `## Delegation Guide — Integrations`,
-// welcome owns its onboarding-flavoured connected list).
+// `prompt.rs` now renders its own block inline (orchestrator owns
+// `## Delegation Guide — Integrations`, welcome owns its
+// onboarding-flavoured connected list).
pub struct WorkspaceSection;
pub struct RuntimeSection;
pub struct DateTimeSection;
diff --git a/crates/openhuman-core/src/agent/prompts/types.rs b/crates/openhuman-core/src/agent/prompts/types.rs
index 3d77285c03..87915e42ca 100644
--- a/crates/openhuman-core/src/agent/prompts/types.rs
+++ b/crates/openhuman-core/src/agent/prompts/types.rs
@@ -168,12 +168,8 @@ pub struct ConnectedIntegration {
/// `ACTIVE` (use `connected = true`) OR there is no connection
/// row at all (truly disconnected).
///
- /// Used by the `integrations_agent` spawn-gate to surface the
- /// real reason a delegation can't proceed — see issue #2365
- /// ("Agent says Gmail is disconnected when sending email"). The
- /// gate previously emitted the same "not authorized yet" message
- /// regardless of whether OAuth was mid-flight, the token had
- /// expired, or the user had simply never started the flow.
+ /// Distinguishes an OAuth flow still in flight, an expired token and
+ /// a connection never started (issue #2365).
pub non_active_status: Option<String>,
}
diff --git a/crates/openhuman-core/src/agent/session_host/builder/setters.rs b/crates/openhuman-core/src/agent/session_host/builder/setters.rs
index 1dbe9d4a12..a4dcb1f21d 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/setters.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/setters.rs
@@ -254,7 +254,7 @@ impl SessionHostBuilder {
}
/// Sets the agent definition id this session is running
- /// (`welcome`, `orchestrator`, `integrations_agent`, …).
+ /// (`welcome`, `orchestrator`, `planner`, …).
///
/// This value is stamped onto the built [`OpenHumanSessionHost`] and surfaces in
/// the following places:
@@ -273,18 +273,12 @@ impl SessionHostBuilder {
/// signal for "which agent definition ran this session" when
/// inspecting transcripts after the fact.
/// * **[`PromptContext::agent_id`]** at prompt-build time (see
- /// `turn.rs`). Today only one prompt section reads this field —
- /// the `Connected Integrations` branch in `agent/prompts`
- /// that special-cases `integrations_agent` vs every other agent — so
- /// the current user-visible impact of a wrong id is limited to
- /// the two bullets above. The stamped `prompt_builder` injected
- /// by [`OpenHumanSessionHost::from_config_for_agent`] is what actually drives
- /// prompt flavour per archetype, independent of this field. That
- /// said, any future prompt section that branches on a
- /// non-`integrations_agent` id (e.g. welcome-specific banner, planner-
- /// specific rubric) would silently never fire if the field were
- /// left at `"main"`, so keeping it correctly stamped closes a
- /// latent foot-gun for code that hasn't been written yet.
+ /// `turn.rs`). The stamped `prompt_builder` injected by
+ /// [`OpenHumanSessionHost::from_config_for_agent`] is what actually
+ /// drives prompt flavour per archetype, independent of this field,
+ /// but any prompt section that branches on the id (e.g. a
+ /// welcome-specific banner) would silently never fire if the field
+ /// were left at `"main"`.
///
/// Callers building via [`OpenHumanSessionHost::from_config_for_agent`] get this
/// wired automatically inside `build_session_agent_inner`; direct
diff --git a/crates/openhuman-core/src/agent/session_host/runtime/accessors.rs b/crates/openhuman-core/src/agent/session_host/runtime/accessors.rs
index 77c2e5d978..8fc072e381 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime/accessors.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime/accessors.rs
@@ -24,7 +24,7 @@ impl OpenHumanSessionHost {
}
/// The agent definition id this session is running
- /// (`"welcome"`, `"orchestrator"`, `"integrations_agent"`, …).
+ /// (`"welcome"`, `"orchestrator"`, `"planner"`, …).
///
/// Exposed so callers that build sessions via
/// [`OpenHumanSessionHost::from_config_for_agent`] can stamp the resolved id onto
diff --git a/crates/openhuman-core/src/agent/session_host/types.rs b/crates/openhuman-core/src/agent/session_host/types.rs
index dae4dd5fb2..510db1219a 100644
--- a/crates/openhuman-core/src/agent/session_host/types.rs
+++ b/crates/openhuman-core/src/agent/session_host/types.rs
@@ -252,7 +252,7 @@ pub struct OpenHumanSessionHost {
pub(super) agent_definition_name: String,
/// Canonical agent id as registered in
/// [`AgentDefinitionRegistry`] (e.g. `"orchestrator"`,
- /// `"integrations_agent"`). Set once at build time and never
+ /// `"planner"`). Set once at build time and never
/// rewritten — `set_agent_definition_name` only touches the
/// transcript-facing `agent_definition_name`, so registry lookups
/// (e.g. `refresh_delegation_tools` re-resolving the agent's
diff --git a/crates/openhuman-core/src/agent/subagent_host/types.rs b/crates/openhuman-core/src/agent/subagent_host/types.rs
index 0e703b4e58..b3a553e38b 100644
--- a/crates/openhuman-core/src/agent/subagent_host/types.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/types.rs
@@ -22,12 +22,8 @@ pub struct SubagentRunOptions {
pub skill_filter_override: Option<String>,
/// Optional Composio toolkit scope (e.g. `"gmail"`, `"notion"`).
- /// When set, skill-category tools are further restricted to those
- /// whose name starts with the uppercased `{toolkit}_` prefix, and
- /// the sub-agent's rendered `Connected Integrations` section is
- /// narrowed to only that toolkit's entry. Used by main/orchestrator
- /// when spawning `integrations_agent` for a specific platform so the
- /// sub-agent only sees one integration's tool catalogue.
+ /// When set, the sub-agent's rendered `Connected Integrations`
+ /// section is narrowed to only that toolkit's entry.
pub toolkit_override: Option<String>,
/// Optional context blob the parent wants to inject before the