Skip to content

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

feat(session-host): add render_current_turn_prompt

Steven Enamakela48dc05e3796
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session/prompt_surface.rs b/crates/openhuman-core/src/agent/session_host/runtime_session/prompt_surface.rs
index da29985467..601900d218 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session/prompt_surface.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session/prompt_surface.rs
@@ -3,6 +3,14 @@
use super::*;
impl OpenHumanSessionHost {
+ /// Render the prompt from the same current-turn prelude that prepares a
+ /// cold runtime turn. Callers must refresh the prompt surface first when
+ /// they need live integrations or synthesized tools.
+ pub fn render_current_turn_prompt(&self) -> Result<String> {
+ let prelude = self.create_turn_prelude(false);
+ Ok(prelude.build_system_prompt_tiered()?.text)
+ }
+
pub(super) fn create_turn_prelude(
&self,
force_integration_refresh: bool,
diff --git a/crates/openhuman-core/src/core/agent_cli/debug/mod.rs b/crates/openhuman-core/src/core/agent_cli/debug/mod.rs
index a3f8185199..60195c1398 100644
--- a/crates/openhuman-core/src/core/agent_cli/debug/mod.rs
+++ b/crates/openhuman-core/src/core/agent_cli/debug/mod.rs
@@ -5,8 +5,8 @@
//! through [`OpenHumanSessionHost::from_config_for_agent`] — the same entry point the
//! Tauri web channel and CLI use — and then calls
//! [`OpenHumanSessionHost::build_system_prompt`] on the constructed session. The
-//! output is byte-identical to what the LLM would receive on turn 1 of
-//! that agent.
+//! output is assembled through the current-turn prelude used by runtime
+//! sessions, so it matches the system prompt on a cold model request.
//!
//! Entry points:
//! * [`dump_agent_prompt`] — dump a single agent by id.
@@ -187,7 +187,7 @@ async fn render_via_session(config: &Config, agent_id: &str) -> Result<DumpedPro
agent.refresh_prompt_surface().await;
let text = agent
- .build_system_prompt()
+ .render_current_turn_prompt()
.with_context(|| format!("rendering system prompt for `{agent_id}`"))?;
Ok(session_dump(&agent, agent_id, text))
diff --git a/tests/agent_harness_e2e.rs b/tests/agent_harness_e2e.rs
index e936b3a345..69c38ec2dc 100644
--- a/tests/agent_harness_e2e.rs
+++ b/tests/agent_harness_e2e.rs
@@ -4409,7 +4409,9 @@ mod tool_policy_boundary_placement {
.build()
.expect("complete builder should succeed");
- agent.build_system_prompt().expect("system prompt builds")
+ agent
+ .render_current_turn_prompt()
+ .expect("system prompt builds")
}
/// #5821 (closes #5704). Every line of the boundary block is session-scoped