Skip to content

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

feat(agent): add deferred_tools field to AgentDefinition and AgentTurnRequest

Steven Enamakelcc01c7eb8f52
diff --git a/crates/openhuman-core/src/agent/bus_tests.rs b/crates/openhuman-core/src/agent/bus_tests.rs
index 1cca38295a..a4d556e4b8 100644
--- a/crates/openhuman-core/src/agent/bus_tests.rs
+++ b/crates/openhuman-core/src/agent/bus_tests.rs
@@ -26,6 +26,7 @@ fn test_request() -> AgentTurnRequest {
target_agent_id: None,
visible_tool_names: None,
extra_tools: Vec::new(),
+ deferred_tools: Vec::new(),
on_progress: None,
origin: AgentTurnOrigin::Cli,
}
diff --git a/crates/openhuman-core/src/agent/harness/builtin_definitions.rs b/crates/openhuman-core/src/agent/harness/builtin_definitions.rs
index 2abf50f77a..2cc79381f2 100644
--- a/crates/openhuman-core/src/agent/harness/builtin_definitions.rs
+++ b/crates/openhuman-core/src/agent/harness/builtin_definitions.rs
@@ -66,6 +66,7 @@ pub(crate) fn test_main_def() -> AgentDefinition {
disallowed_tools: vec![],
skill_filter: None,
extra_tools: vec![],
+ deferred_tools: Vec::new(),
max_iterations: 8,
iteration_policy: Default::default(),
max_result_chars: None,
@@ -112,6 +113,7 @@ pub(crate) fn test_inherit_echo_def() -> AgentDefinition {
disallowed_tools: vec![],
skill_filter: None,
extra_tools: vec![],
+ deferred_tools: Vec::new(),
max_iterations: 3,
iteration_policy: Default::default(),
max_result_chars: None,
@@ -151,6 +153,7 @@ pub(crate) fn test_inherit_parallel_worker_def() -> AgentDefinition {
disallowed_tools: vec![],
skill_filter: None,
extra_tools: vec![],
+ deferred_tools: Vec::new(),
max_iterations: 6,
iteration_policy: Default::default(),
max_result_chars: None,
diff --git a/crates/openhuman-core/src/agent/harness/definition_tests.rs b/crates/openhuman-core/src/agent/harness/definition_tests.rs
index 0bb3d8aaaf..026adc7eb5 100644
--- a/crates/openhuman-core/src/agent/harness/definition_tests.rs
+++ b/crates/openhuman-core/src/agent/harness/definition_tests.rs
@@ -17,6 +17,7 @@ fn make_def(id: &str) -> AgentDefinition {
disallowed_tools: vec![],
skill_filter: None,
extra_tools: vec![],
+ deferred_tools: Vec::new(),
max_iterations: 8,
iteration_policy: Default::default(),
max_result_chars: None,
diff --git a/crates/openhuman-core/src/agent/harness/graph.rs b/crates/openhuman-core/src/agent/harness/graph.rs
index cb3eb3fe2c..339b1d9796 100644
--- a/crates/openhuman-core/src/agent/harness/graph.rs
+++ b/crates/openhuman-core/src/agent/harness/graph.rs
@@ -49,6 +49,7 @@ pub(crate) async fn run_channel_turn_via_graph(
history: &mut Vec<ChatMessage>,
tools_registry: Arc<Vec<Box<dyn Tool>>>,
extra_tools: Vec<Box<dyn Tool>>,
+ deferred_tools: Vec::new(),
visible_tool_names: Option<&HashSet<String>>,
model: &str,
temperature: f64,
diff --git a/crates/openhuman-core/src/agent/library/ops_tests.rs b/crates/openhuman-core/src/agent/library/ops_tests.rs
index 1410a5ffbe..c419498c83 100644
--- a/crates/openhuman-core/src/agent/library/ops_tests.rs
+++ b/crates/openhuman-core/src/agent/library/ops_tests.rs
@@ -18,6 +18,7 @@ fn definition() -> AgentDefinition {
disallowed_tools: vec!["file_read".to_string()],
skill_filter: None,
extra_tools: vec!["memory_search".to_string(), "web_search".to_string()],
+ deferred_tools: Vec::new(),
max_iterations: 8,
iteration_policy: Default::default(),
max_result_chars: None,
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents_tests.rs
index 41ae3c42fc..7f217e76ce 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents_tests.rs
@@ -219,6 +219,7 @@ fn definition_with_tool_scope(
disallowed_tools: Vec::new(),
skill_filter: None,
extra_tools: Vec::new(),
+ deferred_tools: Vec::new(),
max_iterations: 3,
iteration_policy: Default::default(),
max_result_chars: None,
diff --git a/crates/openhuman-core/src/agent/prompts/render_helpers/subagent.rs b/crates/openhuman-core/src/agent/prompts/render_helpers/subagent.rs
index 0391928a3d..89590a8d79 100644
--- a/crates/openhuman-core/src/agent/prompts/render_helpers/subagent.rs
+++ b/crates/openhuman-core/src/agent/prompts/render_helpers/subagent.rs
@@ -60,6 +60,7 @@ pub fn render_subagent_system_prompt(
allowed_indices: &[usize],
parent_tools: &[Box<dyn tinytools::Tool>],
extra_tools: &[Box<dyn tinytools::Tool>],
+ deferred_tools: Vec::new(),
archetype_body: &str,
options: SubagentRenderOptions,
tool_call_format: ToolCallFormat,
@@ -98,6 +99,7 @@ pub fn render_subagent_system_prompt_with_format(
allowed_indices: &[usize],
parent_tools: &[Box<dyn tinytools::Tool>],
extra_tools: &[Box<dyn tinytools::Tool>],
+ deferred_tools: Vec::new(),
archetype_body: &str,
options: SubagentRenderOptions,
tool_call_format: ToolCallFormat,
diff --git a/crates/openhuman-core/src/agent/registry/defaults.rs b/crates/openhuman-core/src/agent/registry/defaults.rs
index 5ee1226694..b95149a717 100644
--- a/crates/openhuman-core/src/agent/registry/defaults.rs
+++ b/crates/openhuman-core/src/agent/registry/defaults.rs
@@ -95,6 +95,7 @@ pub fn definition_from_registry_entry(entry: &AgentRegistryEntry) -> AgentDefini
disallowed_tools: entry.tool_denylist.clone(),
skill_filter: None,
extra_tools: Vec::new(),
+ deferred_tools: Vec::new(),
max_iterations: 8,
iteration_policy: IterationPolicy::Strict,
max_result_chars: None,
diff --git a/crates/openhuman-core/src/agent/subagent_host/ops_tests.rs b/crates/openhuman-core/src/agent/subagent_host/ops_tests.rs
index 106200182b..e061790ca1 100644
--- a/crates/openhuman-core/src/agent/subagent_host/ops_tests.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/ops_tests.rs
@@ -19,6 +19,7 @@ fn make_def_named_tools(names: &[&str]) -> AgentDefinition {
disallowed_tools: vec![],
skill_filter: None,
extra_tools: vec![],
+ deferred_tools: Vec::new(),
max_iterations: 5,
iteration_policy: Default::default(),
max_result_chars: None,
diff --git a/crates/openhuman-core/src/agent/tinyagents/payload_summarizer_tests.rs b/crates/openhuman-core/src/agent/tinyagents/payload_summarizer_tests.rs
index 20c69bf386..d3915a4229 100644
--- a/crates/openhuman-core/src/agent/tinyagents/payload_summarizer_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/payload_summarizer_tests.rs
@@ -23,6 +23,7 @@ fn dummy_definition() -> AgentDefinition {
disallowed_tools: vec![],
skill_filter: None,
extra_tools: vec![],
+ deferred_tools: Vec::new(),
max_iterations: 1,
iteration_policy: Default::default(),
max_result_chars: None,
diff --git a/crates/openhuman-core/src/agent/triage/evaluator/arm.rs b/crates/openhuman-core/src/agent/triage/evaluator/arm.rs
index e230c090ac..25b93d45ee 100644
--- a/crates/openhuman-core/src/agent/triage/evaluator/arm.rs
+++ b/crates/openhuman-core/src/agent/triage/evaluator/arm.rs
@@ -127,6 +127,7 @@ pub(super) async fn try_arm(
target_agent_id: Some("trigger_triage".to_string()),
visible_tool_names: None,
extra_tools: Vec::new(),
+ deferred_tools: Vec::new(),
on_progress: None,
// Triage processes untrusted inbound channel text. Label it as
// ExternalChannel so the approval gate treats any external_effect
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/mod_scoping_tests_tests.rs b/crates/openhuman-core/src/channels/runtime/dispatch/mod_scoping_tests_tests.rs
index e0f46e5ea1..23174f0dc6 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/mod_scoping_tests_tests.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/mod_scoping_tests_tests.rs
@@ -62,6 +62,7 @@ fn def_with_scope(scope: ToolScope) -> AgentDefinition {
disallowed_tools: vec![],
skill_filter: None,
extra_tools: vec![],
+ deferred_tools: Vec::new(),
max_iterations: 8,
iteration_policy: Default::default(),
max_result_chars: None,
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs b/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs
index 5f55f05fe5..85a8932bd4 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs
@@ -405,6 +405,7 @@ pub(crate) async fn process_channel_runtime_message(
target_agent_id: scoping.target_agent_id,
visible_tool_names,
extra_tools: scoping.extra_tools,
+ deferred_tools: Vec::new(),
on_progress: progress_tx,
origin: turn_origin,
};
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/routing.rs b/crates/openhuman-core/src/channels/runtime/dispatch/routing.rs
index d2f7f5afd0..22fb7a1612 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/routing.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/routing.rs
@@ -42,6 +42,7 @@ impl AgentScoping {
target_agent_id: None,
visible_tool_names: None,
extra_tools: Vec::new(),
+ deferred_tools: Vec::new(),
}
}
}
@@ -224,6 +225,7 @@ pub(super) fn connected_with_fallback(
pub(super) fn build_visible_tool_set(
definition: &AgentDefinition,
extra_tools: &[Box<dyn Tool>],
+ deferred_tools: Vec::new(),
) -> Option<HashSet<String>> {
match &definition.tools {
ToolScope::Wildcard => None,
diff --git a/crates/openhuman-core/src/tools/orchestrator_tools_tests.rs b/crates/openhuman-core/src/tools/orchestrator_tools_tests.rs
index 0a797dc579..9cef23d271 100644
--- a/crates/openhuman-core/src/tools/orchestrator_tools_tests.rs
+++ b/crates/openhuman-core/src/tools/orchestrator_tools_tests.rs
@@ -20,6 +20,7 @@ fn def(id: &str, when_to_use: &str, delegate_name: Option<&str>) -> AgentDefinit
disallowed_tools: vec![],
skill_filter: None,
extra_tools: vec![],
+ deferred_tools: Vec::new(),
max_iterations: 8,
iteration_policy: Default::default(),
max_result_chars: None,
diff --git a/tests/raw_coverage/agent_archivist_debug_round21_raw_coverage_e2e.rs b/tests/raw_coverage/agent_archivist_debug_round21_raw_coverage_e2e.rs
index feb38a78cc..fc8953361e 100644
--- a/tests/raw_coverage/agent_archivist_debug_round21_raw_coverage_e2e.rs
+++ b/tests/raw_coverage/agent_archivist_debug_round21_raw_coverage_e2e.rs
@@ -230,6 +230,7 @@ fn definition(max_iterations: usize) -> AgentDefinition {
disallowed_tools: Vec::new(),
skill_filter: None,
extra_tools: Vec::new(),
+ deferred_tools: Vec::new(),
max_iterations,
iteration_policy: Default::default(),
max_result_chars: None,
diff --git a/tests/raw_coverage/agent_harness_leftovers_raw_coverage_e2e.rs b/tests/raw_coverage/agent_harness_leftovers_raw_coverage_e2e.rs
index 9f84623fec..9da81d1dff 100644
--- a/tests/raw_coverage/agent_harness_leftovers_raw_coverage_e2e.rs
+++ b/tests/raw_coverage/agent_harness_leftovers_raw_coverage_e2e.rs
@@ -334,6 +334,7 @@ fn definition(max_result_chars: Option<usize>) -> AgentDefinition {
disallowed_tools: Vec::new(),
skill_filter: None,
extra_tools: Vec::new(),
+ deferred_tools: Vec::new(),
max_iterations: 2,
iteration_policy: Default::default(),
max_result_chars,
diff --git a/tests/raw_coverage/agent_harness_raw_coverage_e2e.rs b/tests/raw_coverage/agent_harness_raw_coverage_e2e.rs
index aa6b672e42..0787d6a028 100644
--- a/tests/raw_coverage/agent_harness_raw_coverage_e2e.rs
+++ b/tests/raw_coverage/agent_harness_raw_coverage_e2e.rs
@@ -322,6 +322,7 @@ fn coverage_definition() -> AgentDefinition {
disallowed_tools: Vec::new(),
skill_filter: None,
extra_tools: Vec::new(),
+ deferred_tools: Vec::new(),
max_iterations: 3,
iteration_policy: Default::default(),
max_result_chars: Some(18),
diff --git a/tests/raw_coverage/agent_prompts_subagent_raw_coverage_e2e.rs b/tests/raw_coverage/agent_prompts_subagent_raw_coverage_e2e.rs
index 5b5218c0ff..d250a51898 100644
--- a/tests/raw_coverage/agent_prompts_subagent_raw_coverage_e2e.rs
+++ b/tests/raw_coverage/agent_prompts_subagent_raw_coverage_e2e.rs
@@ -257,6 +257,7 @@ fn definition(prompt: PromptSource) -> AgentDefinition {
disallowed_tools: Vec::new(),
skill_filter: None,
extra_tools: Vec::new(),
+ deferred_tools: Vec::new(),
max_iterations: 3,
iteration_policy: Default::default(),
max_result_chars: None,
diff --git a/tests/raw_coverage/agent_session_turn_raw_coverage_e2e.rs b/tests/raw_coverage/agent_session_turn_raw_coverage_e2e.rs
index 35e157c10b..4ae866b437 100644
--- a/tests/raw_coverage/agent_session_turn_raw_coverage_e2e.rs
+++ b/tests/raw_coverage/agent_session_turn_raw_coverage_e2e.rs
@@ -1248,6 +1248,7 @@ fn definition(
disallowed_tools: vec!["round17_hidden".to_string()],
skill_filter: None,
extra_tools: Vec::new(),
+ deferred_tools: Vec::new(),
max_iterations,
iteration_policy: Default::default(),
max_result_chars,
diff --git a/tests/raw_coverage/agent_tool_loop_raw_coverage_e2e.rs b/tests/raw_coverage/agent_tool_loop_raw_coverage_e2e.rs
index 4448e1609e..67898d167b 100644
--- a/tests/raw_coverage/agent_tool_loop_raw_coverage_e2e.rs
+++ b/tests/raw_coverage/agent_tool_loop_raw_coverage_e2e.rs
@@ -378,6 +378,7 @@ async fn run_bus_turn(
target_agent_id: Some("orchestrator".to_string()),
visible_tool_names,
extra_tools: Vec::new(),
+ deferred_tools: Vec::new(),
on_progress: None,
origin: openhuman_core::agent::turn_origin::AgentTurnOrigin::Cli,
},
diff --git a/tests/raw_coverage/agent_turn_toolloop_round22_raw_coverage_e2e.rs b/tests/raw_coverage/agent_turn_toolloop_round22_raw_coverage_e2e.rs
index 1738856968..4ceb4aa87f 100644
--- a/tests/raw_coverage/agent_turn_toolloop_round22_raw_coverage_e2e.rs
+++ b/tests/raw_coverage/agent_turn_toolloop_round22_raw_coverage_e2e.rs
@@ -228,6 +228,7 @@ async fn run_turn(
target_agent_id: Some("orchestrator".to_string()),
visible_tool_names: None,
extra_tools: Vec::new(),
+ deferred_tools: Vec::new(),
on_progress,
origin: openhuman_core::agent::turn_origin::AgentTurnOrigin::Cli,
},
diff --git a/tests/raw_coverage/inference_agent_raw_coverage_e2e.rs b/tests/raw_coverage/inference_agent_raw_coverage_e2e.rs
index 98a53a2805..b26e6b4e77 100644
--- a/tests/raw_coverage/inference_agent_raw_coverage_e2e.rs
+++ b/tests/raw_coverage/inference_agent_raw_coverage_e2e.rs
@@ -1227,6 +1227,7 @@ named = ["todo", "plan_exit"]
disallowed_tools: Vec::new(),
skill_filter: None,
extra_tools: Vec::new(),
+ deferred_tools: Vec::new(),
max_iterations: 8,
iteration_policy: Default::default(),
max_result_chars: None,
@@ -1987,6 +1988,7 @@ async fn agent_triage_evaluator_covers_native_dispatch_decision_and_deferred_pat
target_agent_id: Some("orchestrator".into()),
visible_tool_names: Some(HashSet::new()),
extra_tools: Vec::new(),
+ deferred_tools: Vec::new(),
on_progress: None,
origin: openhuman_core::agent::turn_origin::AgentTurnOrigin::Cli,
},
diff --git a/tests/raw_coverage/tools_agent_credentials_state_raw_coverage_e2e.rs b/tests/raw_coverage/tools_agent_credentials_state_raw_coverage_e2e.rs
index 2e4ca71f28..4cf73512b8 100644
--- a/tests/raw_coverage/tools_agent_credentials_state_raw_coverage_e2e.rs
+++ b/tests/raw_coverage/tools_agent_credentials_state_raw_coverage_e2e.rs
@@ -408,6 +408,7 @@ fn agent_definition(id: &str, max_result_chars: Option<usize>) -> AgentDefinitio
disallowed_tools: Vec::new(),
skill_filter: None,
extra_tools: Vec::new(),
+ deferred_tools: Vec::new(),
max_iterations: 2,
iteration_policy: Default::default(),
max_result_chars,
diff --git a/tests/raw_coverage/tools_approval_channels_raw_coverage_e2e.rs b/tests/raw_coverage/tools_approval_channels_raw_coverage_e2e.rs
index 9a42da0bdd..35035bfea6 100644
--- a/tests/raw_coverage/tools_approval_channels_raw_coverage_e2e.rs
+++ b/tests/raw_coverage/tools_approval_channels_raw_coverage_e2e.rs
@@ -290,6 +290,7 @@ fn coverage_agent_definition(
disallowed_tools: vec![],
skill_filter: None,
extra_tools: vec![],
+ deferred_tools: Vec::new(),
max_iterations: 8,
iteration_policy: Default::default(),
max_result_chars: None,