Skip to content

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

feat(agent, flows, tools): expose delegation envelope schema and tool scope helpers

Steven Enamakel5c0d06380a54
diff --git a/src/openhuman/agent/debug/mod.rs b/src/openhuman/agent/debug/mod.rs
index 6f1f5ea499..742a70480a 100644
--- a/src/openhuman/agent/debug/mod.rs
+++ b/src/openhuman/agent/debug/mod.rs
@@ -25,7 +25,10 @@ use std::path::PathBuf;
use anyhow::{anyhow, Context, Result};
pub mod dump_writer;
+pub mod prompt_size;
+pub mod wire;
pub use dump_writer::{write_prompt_dumps, DumpWriteSummary};
+pub use wire::render as render_wire_dump;
use crate::openhuman::agent::context::prompt::{
LearnedContextData, PromptContext, PromptTool, ToolCallFormat,
diff --git a/src/openhuman/agent/harness/definition.rs b/src/openhuman/agent/harness/definition.rs
index 4fcfcc4c57..7557b142a7 100644
--- a/src/openhuman/agent/harness/definition.rs
+++ b/src/openhuman/agent/harness/definition.rs
@@ -26,3 +26,11 @@
mod tests;
include!("definition_part_01.rs");
include!("definition_part_02.rs");
+
+/// Sentinel used to represent an explicit zero-tool scope.
+pub const NO_TOOLS_SENTINEL: &str = "__no_tools__";
+
+/// Returns whether a visible-tool set represents an explicit zero-tool scope.
+pub fn is_empty_tool_scope(visible: &std::collections::HashSet<String>) -> bool {
+ visible.is_empty() || (visible.len() == 1 && visible.contains(NO_TOOLS_SENTINEL))
+}
diff --git a/src/openhuman/agent/orchestration/tools/archetype_delegation.rs b/src/openhuman/agent/orchestration/tools/archetype_delegation.rs
index 63cedeaf1b..450992b28a 100644
--- a/src/openhuman/agent/orchestration/tools/archetype_delegation.rs
+++ b/src/openhuman/agent/orchestration/tools/archetype_delegation.rs
@@ -200,7 +200,7 @@ impl Tool for ArchetypeDelegationTool {
}
}
-fn render_structured_handoff(prompt: &str, args: &Value) -> String {
+pub(super) fn render_structured_handoff(prompt: &str, args: &Value) -> String {
let mut out = String::new();
out.push_str("Task:\n");
out.push_str(prompt.trim());
@@ -219,6 +219,20 @@ fn render_structured_handoff(prompt: &str, args: &Value) -> String {
out
}
+pub(super) fn delegation_envelope_properties() -> Value {
+ serde_json::json!({
+ "prompt": {"type": "string"},
+ "objective": {"type": "string"},
+ "evidence": {"type": "array", "items": {"type": "string"}},
+ "constraints": {"type": "array", "items": {"type": "string"}},
+ "must_not_assume": {"type": "array", "items": {"type": "string"}},
+ "expected_output": {"type": "string"},
+ "citation_requirement": {"type": "string"},
+ "model": {"type": "string"},
+ "blocking": {"type": "boolean"}
+ })
+}
+
fn push_optional_string(out: &mut String, label: &str, value: Option<&Value>) {
let Some(text) = value.and_then(Value::as_str).map(str::trim) else {
return;
diff --git a/src/openhuman/flows/node_contracts.rs b/src/openhuman/flows/node_contracts.rs
index c95df61157..530e3da3ac 100644
--- a/src/openhuman/flows/node_contracts.rs
+++ b/src/openhuman/flows/node_contracts.rs
@@ -208,6 +208,18 @@ pub fn render_node_kinds_line() -> String {
.join(" | ")
}
+/// Renders the node kinds and only their required configuration fields.
+pub fn render_node_kinds_required() -> String {
+ all_node_kind_contracts()
+ .iter()
+ .map(|c| {
+ let required: Vec<&str> = c.config_fields.iter().filter(|f| f.required).map(|f| f.name.as_str()).collect();
+ if required.is_empty() { c.kind.clone() } else { format!("{}(config.{})", c.kind, required.join(", config.")) }
+ })
+ .collect::<Vec<_>>()
+ .join(", ")
+}
+
#[cfg(test)]
#[path = "node_contracts_tests.rs"]
mod tests;
diff --git a/src/openhuman/tools/ops.rs b/src/openhuman/tools/ops.rs
index 9a35a12b21..0f4ef955c7 100644
--- a/src/openhuman/tools/ops.rs
+++ b/src/openhuman/tools/ops.rs
@@ -1437,7 +1437,7 @@ fn tool_group(name: &str) -> crate::core::all::DomainGroup {
/// `goals_*` was the third until #5560 routed it onto the guarded
/// `MemoryGoals` family — the advertised capability did not change when
/// the plumbing caught up: the exact property this clause protects.
-fn tool_capability(name: &str) -> Option<tinymemory_api::capabilities::Capability> {
+pub(crate) fn tool_capability(name: &str) -> Option<tinymemory_api::capabilities::Capability> {
use tinymemory_api::capabilities::Capability;
// Not driver-backed. Each entry is an argued exception, not a fallthrough.