Skip to content

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

feat(agent): add config path override for prompt dump and fix dispatcher result handling

Steven Enamakel48f4d3eb7168
diff --git a/src/openhuman/agent/debug/mod.rs b/src/openhuman/agent/debug/mod.rs
index 742a70480a..6fc7205ca9 100644
--- a/src/openhuman/agent/debug/mod.rs
+++ b/src/openhuman/agent/debug/mod.rs
@@ -60,6 +60,7 @@ pub struct DumpPromptOptions {
pub toolkit: Option<String>,
/// Optional override for the workspace directory.
pub workspace_dir_override: Option<PathBuf>,
+ pub config_path_override: Option<PathBuf>,
/// Optional override for the resolved model name.
pub model_override: Option<String>,
}
@@ -70,6 +71,7 @@ impl DumpPromptOptions {
agent_id: agent_id.into(),
toolkit: None,
workspace_dir_override: None,
+ config_path_override: None,
model_override: None,
}
}
@@ -130,6 +132,7 @@ fn tool_specs_of<'a, T: std::ops::Deref<Target = dyn crate::openhuman::tools::To
pub async fn dump_agent_prompt(options: DumpPromptOptions) -> Result<DumpedPrompt> {
let config = load_dump_config(
options.workspace_dir_override.clone(),
+ options.config_path_override.clone(),
options.model_override.clone(),
)
.await?;
@@ -168,9 +171,10 @@ pub async fn dump_agent_prompt(options: DumpPromptOptions) -> Result<DumpedPromp
/// `integrations_agent` replaced in place by its per-toolkit expansion.
pub async fn dump_all_agent_prompts(
workspace_dir_override: Option<PathBuf>,
+ config_path_override: Option<PathBuf>,
model_override: Option<String>,
) -> Result<Vec<DumpedPrompt>> {
- let config = load_dump_config(workspace_dir_override, model_override).await?;
+ let config = load_dump_config(workspace_dir_override, config_path_override, model_override).await?;
AgentDefinitionRegistry::init_global(&config.workspace_dir)
.context("initialising AgentDefinitionRegistry for prompt dump")?;
@@ -218,11 +222,15 @@ pub async fn dump_all_agent_prompts(
async fn load_dump_config(
workspace_dir_override: Option<PathBuf>,
+ config_path_override: Option<PathBuf>,
model_override: Option<String>,
) -> Result<Config> {
- let mut config = Config::load_or_init()
- .await
- .context("loading Config for prompt dump")?;
+ let mut config = if let Some(path) = config_path_override {
+ let workspace = workspace_dir_override.as_deref().ok_or_else(|| anyhow!("config path override requires workspace override"))?;
+ Config::load_from_config_path(&path, workspace).await.context("loading hermetic Config for prompt dump")?
+ } else {
+ Config::load_or_init().await.context("loading Config for prompt dump")?
+ };
config.apply_env_overrides();
if let Some(override_dir) = workspace_dir_override {
config.workspace_dir = override_dir;
diff --git a/src/openhuman/agent/dispatcher.rs b/src/openhuman/agent/dispatcher.rs
index 5a7f379130..6d21f5195a 100644
--- a/src/openhuman/agent/dispatcher.rs
+++ b/src/openhuman/agent/dispatcher.rs
@@ -163,6 +163,7 @@ fn to_outcomes(results: &[ToolExecutionResult]) -> Vec<ToolOutcome> {
output: result.output.clone(),
success: result.success,
tool_call_id: result.tool_call_id.clone(),
+ trusted_verbatim: false,
})
.collect()
}
@@ -188,6 +189,7 @@ fn to_transcript_entry(message: &ConversationMessage) -> TranscriptEntry {
.map(|result| ToolResultEntry {
tool_call_id: result.tool_call_id.clone(),
content: result.content.clone(),
+ trusted_verbatim: result.trusted_verbatim,
})
.collect(),
),
@@ -291,7 +293,12 @@ fn dispatch_format_results(
dialect: &dyn ToolDialect,
results: &[ToolExecutionResult],
) -> ConversationMessage {
- from_transcript_entry(dialect.format_results(&to_outcomes(results)))
+ dialect
+ .format_results(&to_outcomes(results))
+ .into_iter()
+ .map(from_transcript_entry)
+ .next()
+ .unwrap_or_else(|| ConversationMessage::ToolResults(Vec::new()))
}
fn dispatch_provider_messages(