tinyhumansai/openhuman · error · anyhow::Error

integrations_agent must use PromptSource::Dynamic; got {:?}

Error message

integrations_agent must use PromptSource::Dynamic; got {:?}

What it means

The integrations_agent's system prompt must be PromptSource::Dynamic — the whole agent exists as a parameterized per-toolkit prompt factory. At src/openhuman/agent/debug/mod.rs:405 the loaded definition's system_prompt is Inline or File (the match stringifies which), so the renderer cannot obtain a build function and errors. The bundled builtin is always Dynamic (loader injects PromptSource::Dynamic at parse_builtin), so a static prompt means a workspace override rewrote it.

Source

Thrown at src/openhuman/agent/debug/mod.rs:405

            parameters_schema: Some(t.parameters_schema().to_string()),
        })
        .collect();

    // Narrow the connected_integrations slice to just the bound
    // toolkit so the prompt's Connected Integrations / tool catalogue
    // doesn't leak peer toolkits into this sub-agent's context.
    let narrow_integrations = vec![integration.clone()];

    let registry = AgentDefinitionRegistry::global()
        .ok_or_else(|| anyhow!("AgentDefinitionRegistry missing after init"))?;
    let definition: AgentDefinition = registry
        .get(INTEGRATIONS_AGENT_ID)
        .cloned()
        .ok_or_else(|| anyhow!("integrations_agent definition not in registry"))?;
    let build = match &definition.system_prompt {
        PromptSource::Dynamic(f) => *f,
        _ => {
            return Err(anyhow!(
                "integrations_agent must use PromptSource::Dynamic; got {:?}",
                match &definition.system_prompt {
                    PromptSource::Inline(_) => "Inline",
                    PromptSource::File { .. } => "File",
                    PromptSource::Dynamic(_) => "Dynamic",
                }
            ));
        }
    };

    let empty_visible: HashSet<String> = HashSet::new();
    let model_name = definition.model.resolve(agent.model_name()).to_string();
    let ctx = PromptContext {
        workspace_dir: agent.workspace_dir(),
        model_name: &model_name,
        agent_id: INTEGRATIONS_AGENT_ID,
        tools: &prompt_tools,
        workflows: agent.workflows(),

View on GitHub (pinned to a221052e0d)

Solutions

  1. Remove the static system_prompt from the integrations_agent override so the builtin Dynamic source is used.
  2. If you must customize it, keep a dynamic prompt source that closes over the toolkit context instead of static text.
  3. Verify by re-dumping: integrations_agent should expand per connected toolkit.

Example fix

# before: <workspace>/agents/integrations_agent.toml
[definition]
system_prompt = "You handle integrations."   # -> Inline, errors
# after: delete the override (or keep dynamic)
rm <workspace>/agents/integrations_agent.toml
Defensive patterns

Strategy: validation

Validate before calling

use crate::openhuman::agent::harness::definition::PromptSource;

match &definition.system_prompt {
    PromptSource::Dynamic(_) => { /* safe to render */ }
    other => anyhow::bail!("integrations_agent prompt source must stay Dynamic; got {other:?}"),
}

Type guard

fn is_dynamic_prompt(
    def: &crate::openhuman::agent::harness::definition::AgentDefinition,
) -> bool {
    matches!(def.system_prompt, PromptSource::Dynamic(_))
}

Try / catch

match &definition.system_prompt {
    PromptSource::Dynamic(build) => (*build)(ctx).await,
    _ => {
        // A workspace override replaced the dynamic factory with static text.
        // Refuse (this error) rather than rendering a toolkit-blind prompt.
    }
}

Prevention

When it happens

Trigger: A workspace agents TOML override for integrations_agent sets `system_prompt = "..."` (Inline) or `system_prompt = { file = "..." }` (File); hand-crafted override files copied from another agent's shape.

Common situations: Users customizing the integrations_agent prompt statically, not realizing its per-toolkit expansion requires the dynamic builder; downgrading/upgrade migration writing static prompts; copy-paste of an agent TOML template with an inline prompt.

Related errors


AI-assisted analysis of tinyhumansai/openhuman@a221052e0d (2026-08-16). Data as JSON: /api/errors/a6afb63ebe057b14. Report an issue: GitHub.