Skip to content

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

feat(agent): add verbatim prompt source

Steven Enamakelc9b9b085400e
diff --git a/crates/openhuman-core/src/agent/harness/definition/prompt_source.rs b/crates/openhuman-core/src/agent/harness/definition/prompt_source.rs
index 84591856ca..027da03e36 100644
--- a/crates/openhuman-core/src/agent/harness/definition/prompt_source.rs
+++ b/crates/openhuman-core/src/agent/harness/definition/prompt_source.rs
@@ -30,6 +30,11 @@ pub enum PromptSource {
/// deserializable from TOML — TOML-authored agents must use `inline`
/// or `file`.
Dynamic(PromptBuilder),
+ /// The whole system prompt, verbatim: no identity, safety, tools,
+ /// workspace or memory section is composed around it. For a library host
+ /// that owns its prompt outright (`AgentDefinitionSpec::bare_prompt` in
+ /// `openhuman-embed`).
+ Verbatim(String),
}
impl std::fmt::Debug for PromptSource {
@@ -38,6 +43,7 @@ impl std::fmt::Debug for PromptSource {
PromptSource::Inline(s) => f.debug_tuple("Inline").field(&s).finish(),
PromptSource::File { path } => f.debug_struct("File").field("path", path).finish(),
PromptSource::Dynamic(_) => f.debug_tuple("Dynamic").field(&"<fn>").finish(),
+ PromptSource::Verbatim(s) => f.debug_tuple("Verbatim").field(&s).finish(),
}
}
}
@@ -59,6 +65,7 @@ impl Serialize for PromptSource {
// there) which is intentional: RPC consumers treat Dynamic
// sources as "built-in, runtime-generated".
PromptSource::Dynamic(_) => map.serialize_entry("dynamic", &serde_json::Value::Null)?,
+ PromptSource::Verbatim(s) => map.serialize_entry("verbatim", s)?,
}
map.end()
}
@@ -71,10 +78,12 @@ impl<'de> Deserialize<'de> for PromptSource {
enum Shape {
Inline(String),
File { path: String },
+ Verbatim(String),
}
Shape::deserialize(deserializer).map(|s| match s {
Shape::Inline(body) => PromptSource::Inline(body),
Shape::File { path } => PromptSource::File { path },
+ Shape::Verbatim(body) => PromptSource::Verbatim(body),
})
}
}
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 60702d2c6e..57feac3791 100644
--- a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs
@@ -832,6 +832,7 @@ async fn run_typed_mode(
source: std::io::Error::other(e.to_string()),
})?
}
+ PromptSource::Verbatim(body) => body.clone(),
PromptSource::Inline(_) | PromptSource::File { .. } => {
let archetype_prompt_body = load_prompt_source(&definition.system_prompt, &prompt_ctx)?;
render_subagent_system_prompt_with_format(
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 2a19dc6929..95a00dfda0 100644
--- a/crates/openhuman-core/src/agent/subagent_host/tool_prep.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/tool_prep.rs
@@ -177,7 +177,7 @@ pub(super) fn load_prompt_source(
) -> Result<String, SubagentRunError> {
let workspace_dir = ctx.workspace_dir;
match source {
- PromptSource::Inline(body) => Ok(body.clone()),
+ 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()),
diff --git a/crates/openhuman-core/src/agent/triage/evaluator/prompt.rs b/crates/openhuman-core/src/agent/triage/evaluator/prompt.rs
index 66b0830896..271abdd862 100644
--- a/crates/openhuman-core/src/agent/triage/evaluator/prompt.rs
+++ b/crates/openhuman-core/src/agent/triage/evaluator/prompt.rs
@@ -11,7 +11,7 @@ const PAYLOAD_INLINE_LIMIT_BYTES: usize = 8 * 1024;
pub(crate) fn extract_inline_prompt(def: &AgentDefinition) -> Option<String> {
match &def.system_prompt {
- PromptSource::Inline(body) if !body.is_empty() => Some(body.clone()),
+ PromptSource::Inline(body) | PromptSource::Verbatim(body) if !body.is_empty() => Some(body.clone()),
PromptSource::Dynamic(build) => {
use crate::agent::prompts::{
ConnectedIntegration, PromptContext, PromptTool, ToolCallFormat,