Skip to content

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

feat(agent): add subagent close, steer, and wait tools

Steven Enamakelf5922e30f0bf
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/close_subagent.rs b/crates/openhuman-core/src/agent/orchestration/tools/close_subagent.rs
index 96e1e97a16..9015e42e29 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/close_subagent.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/close_subagent.rs
@@ -153,6 +153,7 @@ impl CloseSubagentTool {
));
}
let cancelled = running_subagents::cancel_by_session_in_workspace(
+ &crate::agent::tinyagents::host::run_context::dispatch_ctx_for_tool(tool_context),
&subagent_session_id,
&parent.session_id,
&parent.workspace_dir,
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/steer_subagent.rs b/crates/openhuman-core/src/agent/orchestration/tools/steer_subagent.rs
index 60a2ebfee4..1a79bbccd0 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/steer_subagent.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/steer_subagent.rs
@@ -89,7 +89,7 @@ impl SteerSubagentTool {
&self,
args: serde_json::Value,
parent: Option<ParentExecutionContext>,
- _tool_context: Option<&dyn tinytools::ToolRunContext>,
+ tool_context: Option<&dyn tinytools::ToolRunContext>,
) -> anyhow::Result<ToolResult> {
let task_id = args
.get("task_id")
@@ -132,9 +132,11 @@ impl SteerSubagentTool {
}
};
let parent_session = parent.session_id;
+ let dispatch = crate::agent::tinyagents::host::run_context::dispatch_ctx_for_tool(tool_context);
let resolved_task_id = if task_id.is_empty() {
match running_subagents::task_id_for_session_in_workspace(
+ &dispatch,
&subagent_session_id,
&parent_session,
&parent.workspace_dir,
@@ -173,7 +175,7 @@ impl SteerSubagentTool {
message.chars().count()
);
- match running_subagents::steer(&resolved_task_id, &parent_session, message, lane).await {
+ match running_subagents::steer(&dispatch, &resolved_task_id, &parent_session, message, lane).await {
Ok(()) => Ok(ToolResult::success(format!(
"Steered sub-agent `{resolved_task_id}` ({mode}). It will pick this up at its next step. \
Use wait_subagent with its subagent_session_id or task_id to collect its result."
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/wait_subagent.rs b/crates/openhuman-core/src/agent/orchestration/tools/wait_subagent.rs
index 61e17bd32f..fd91a81c7d 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/wait_subagent.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/wait_subagent.rs
@@ -150,7 +150,7 @@ impl WaitSubagentTool {
&self,
args: serde_json::Value,
parent: Option<ParentExecutionContext>,
- _tool_context: Option<&dyn tinytools::ToolRunContext>,
+ tool_context: Option<&dyn tinytools::ToolRunContext>,
) -> anyhow::Result<ToolResult> {
let task_id = args
.get("task_id")
@@ -181,9 +181,11 @@ impl WaitSubagentTool {
}
};
let parent_session = parent.session_id;
+ let dispatch = crate::agent::tinyagents::host::run_context::dispatch_ctx_for_tool(tool_context);
let resolved_task_id = if task_id.is_empty() {
match running_subagents::task_id_for_session_in_workspace(
+ &dispatch,
&subagent_session_id,
&parent_session,
&parent.workspace_dir,
@@ -222,6 +224,7 @@ impl WaitSubagentTool {
);
let resume_ref = running_subagents::resume_ref_for_task_in_workspace(
+ &dispatch,
&resolved_task_id,
&parent_session,
&parent.workspace_dir,
@@ -229,6 +232,7 @@ impl WaitSubagentTool {
.ok();
match running_subagents::wait_in_workspace(
+ &dispatch,
&resolved_task_id,
&parent_session,
&parent.workspace_dir,