Skip to content

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

chore(agent): register flow prompt and workflow builder modules

Steven Enamakele85d2cd7fa64
diff --git a/crates/openhuman-core/src/agent/prompts/mod.rs b/crates/openhuman-core/src/agent/prompts/mod.rs
index 27e9e9c8d8..dd209ddef6 100644
--- a/crates/openhuman-core/src/agent/prompts/mod.rs
+++ b/crates/openhuman-core/src/agent/prompts/mod.rs
@@ -6,6 +6,8 @@ pub mod types;
pub use types::*;
#[cfg(feature = "flows")]
pub(crate) mod flow_archetype;
+#[cfg(feature = "flows")]
+pub(crate) mod flow_archetype;
mod connected_identities;
pub use connected_identities::render_connected_identities;
diff --git a/crates/openhuman-core/src/agent/registry/agents/flow_prompts.rs b/crates/openhuman-core/src/agent/registry/agents/flow_prompts.rs
new file mode 100644
index 0000000000..49b159195f
--- /dev/null
+++ b/crates/openhuman-core/src/agent/registry/agents/flow_prompts.rs
@@ -0,0 +1,29 @@
+//! Shared composition for the bus-backed TinyFlows builtin archetypes.
+
+use anyhow::Result;
+
+use crate::agent::prompts::{render_tools, render_workspace, PromptContext};
+
+/// Combine module-owned archetype text with OpenHuman's scoped runtime sections.
+pub(super) fn build_with_archetype(
+ ctx: &PromptContext<'_>,
+ archetype_text: &str,
+) -> Result<String> {
+ let mut out = String::with_capacity(archetype_text.len() + 8192);
+ out.push_str(archetype_text.trim_end());
+ out.push_str("\n\n");
+
+ let tools = render_tools(ctx)?;
+ if !tools.trim().is_empty() {
+ out.push_str(tools.trim_end());
+ out.push_str("\n\n");
+ }
+
+ let workspace = render_workspace(ctx)?;
+ if !workspace.trim().is_empty() {
+ out.push_str(workspace.trim_end());
+ out.push('\n');
+ }
+
+ Ok(out)
+}
diff --git a/crates/openhuman-core/src/agent/registry/agents/mod.rs b/crates/openhuman-core/src/agent/registry/agents/mod.rs
index 74d7b1fdf0..054bce0309 100644
--- a/crates/openhuman-core/src/agent/registry/agents/mod.rs
+++ b/crates/openhuman-core/src/agent/registry/agents/mod.rs
@@ -19,11 +19,14 @@
//! `loader.rs` holds [`BUILTINS`], [`load_builtins`] and
//! [`validate_tier_hierarchy`]. 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
+//! `flows/*`), so this directory is not the full built-in set. The
//! package `README.md` one level up describes what each archetype does.
mod loader;
+#[cfg(feature = "flows")]
+mod flow_prompts;
+
#[cfg(test)]
#[path = "fleet_prompt_tests.rs"]
mod fleet_prompt_tests;
@@ -40,5 +43,9 @@ pub mod trigger_reactor;
pub mod trigger_triage;
pub mod video_agent;
pub mod vision_agent;
+#[cfg(feature = "flows")]
+pub mod flow_discovery;
+#[cfg(feature = "flows")]
+pub mod workflow_builder;
pub use loader::{load_builtins, validate_tier_hierarchy, BuiltinAgent, BUILTINS};
diff --git a/crates/openhuman-core/src/agent/registry/agents/workflow_builder/mod.rs b/crates/openhuman-core/src/agent/registry/agents/workflow_builder/mod.rs
new file mode 100644
index 0000000000..7d63a3395e
--- /dev/null
+++ b/crates/openhuman-core/src/agent/registry/agents/workflow_builder/mod.rs
@@ -0,0 +1,7 @@
+//! Builtin agent for authoring TinyFlows workflows.
+
+pub mod prompt;
+
+#[cfg(test)]
+#[path = "prompt_tests.rs"]
+mod tests;
diff --git a/crates/openhuman-core/src/agent/registry/agents/workflow_builder/prompt_tests.rs b/crates/openhuman-core/src/agent/registry/agents/workflow_builder/prompt_tests.rs
new file mode 100644
index 0000000000..7ba4dcac26
--- /dev/null
+++ b/crates/openhuman-core/src/agent/registry/agents/workflow_builder/prompt_tests.rs
@@ -0,0 +1,30 @@
+use crate::agent::prompts::{PromptContext, PromptTool};
+
+#[test]
+fn builder_prompt_composes_supplied_archetype_tools_and_workspace() {
+ let temp = tempfile::tempdir().expect("workspace");
+ let tools = [PromptTool::new("save_workflow", "Save the proposed workflow")];
+ let visible = std::collections::HashSet::from(["save_workflow".to_string()]);
+ let context = PromptContext {
+ workspace_dir: temp.path(),
+ model_name: "test",
+ agent_id: "workflow_builder",
+ flow_archetype_text: Some("module-owned builder archetype"),
+ tools: &tools,
+ workflows: &[],
+ dispatcher_instructions: "",
+ visible_tool_names: &visible,
+ tool_call_format: tinytools_agent::dialect::ToolCallFormat::PFormat,
+ connected_integrations: &[],
+ connected_identities_md: String::new(),
+ user_identity: None,
+ personality_roster: vec![],
+ agents_md_global: None,
+ agents_md_local: None,
+ };
+
+ let prompt = super::prompt::build(&context).expect("render builder prompt");
+ assert!(prompt.starts_with("module-owned builder archetype"));
+ assert!(prompt.contains("save_workflow"));
+ assert!(prompt.contains("## Workspace"));
+}