Skip to content

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

feat(orchestration): pass fleet context into subagent envelope

Steven Enamakel49828889a862
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_execute.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_execute.rs
index 2ad65dbae3..f5d30fd011 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_execute.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_execute.rs
@@ -818,6 +818,7 @@ impl SpawnAsyncSubagentTool {
Ok(ToolResult::success(format_async_subagent_accepted(
payload["agent_id"].as_str().unwrap_or("subagent"),
&payload_json,
+ &fleet,
)))
}
}
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_tests.rs
index 3a0728e42d..b039718036 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_tests.rs
@@ -48,7 +48,7 @@ fn background_contract_forbids_user_attention() {
#[test]
fn accepted_message_hides_task_id_from_prose() {
let payload = r#"{"task_id":"sub-internal-123","agent_id":"archivist","mode":"async"}"#;
- let message = format_async_subagent_accepted("archivist", payload);
+ let message = format_async_subagent_accepted("archivist", payload, &FleetToolSet::all());
let prose = message
.split("[async_subagent_ref]")
.next()
@@ -70,6 +70,7 @@ fn async_reference_payload_includes_agent_id_and_control_instructions() {
false,
"created",
"running",
+ &FleetToolSet::all(),
);
assert_eq!(payload["agent_id"], "researcher");
@@ -87,6 +88,51 @@ fn async_reference_payload_includes_agent_id_and_control_instructions() {
);
}
+/// The shipped orchestrator (#5701) has no wait/steer/close tools; the envelope
+/// must not name them, and must say the result arrives on its own.
+#[test]
+fn async_reference_matches_the_orchestrator_fleet_vocabulary() {
+ let registry = AgentDefinitionRegistry::builtins_only();
+ let def = registry.get("orchestrator").expect("built-in orchestrator");
+ let fleet = FleetToolSet::from_scope(&def.tools, &def.disallowed_tools);
+
+ let payload = async_subagent_ref_payload(
+ "sub-123",
+ "subsess-456",
+ "integrations_agent",
+ None,
+ false,
+ "created",
+ "running",
+ &fleet,
+ );
+ let instructions = payload["instructions"].as_object().expect("instructions map");
+ for absent in ["wait", "timeout_tick", "delayed_tick", "delayed_loop", "send_message"] {
+ assert!(!instructions.contains_key(absent), "{absent} offered to a parent without it");
+ }
+ assert_eq!(
+ payload["instructions"]["answer_or_resume"]["tool"],
+ "continue_subagent"
+ );
+ assert_eq!(payload["result_delivery"], "automatic");
+ let serialized = serde_json::to_string(&payload).unwrap();
+ for name in ["wait_subagent", "steer_subagent", "wait_loop", "close_subagent"] {
+ assert!(!serialized.contains(name), "{name} leaked into the envelope");
+ }
+ let next: Vec<&str> = payload["next_actions"]
+ .as_array()
+ .unwrap()
+ .iter()
+ .filter_map(|v| v.as_str())
+ .collect();
+ assert!(next.iter().any(|a| a.contains("delivered to you automatically")));
+
+ let message = format_async_subagent_accepted("integrations_agent", &serialized, &fleet);
+ let prose = message.split("[async_subagent_ref]").next().unwrap();
+ assert!(prose.contains("delivered to you automatically"));
+ assert!(!prose.contains("wait for completion"));
+}
+
#[test]
fn durable_task_key_defaults_to_prompt_not_display_title() {
let args = json!({