Skip to content

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

feat(subagent-host): support native message queue for delegated runs

Steven Enamakelec91f71eea9c
diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/graph/dispatch.rs b/crates/openhuman-core/src/agent/subagent_host/ops/graph/dispatch.rs
index 6888a5341b..862f6e3763 100644
--- a/crates/openhuman-core/src/agent/subagent_host/ops/graph/dispatch.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/ops/graph/dispatch.rs
@@ -9,7 +9,7 @@ use std::sync::Arc;
use crate::agent::subagent_host::types::SubagentRunError;
use crate::agent::tinyagents::{SubagentScope, TurnSpec};
use crate::progress::AgentProgress;
-use tinyagents_harness::run_queue::RunQueue;
+use tinyagents_harness::run_queue::{RunQueue, RunQueueHandle};
use tinyagents_session::transcript::TranscriptMessage;
use tinyjuice_bus::types::AgentTokenjuiceCompression;
use tinytools::WorkspaceDescriptor;
@@ -45,6 +45,7 @@ pub(in super::super) async fn run_subagent_via_graph(
allowed_names: HashSet<String>,
max_iterations: usize,
run_queue: Option<Arc<RunQueue<crate::agent::queued_turn::QueuedTurn>>>,
+ message_run_queue: Option<RunQueueHandle>,
on_progress: Option<tokio::sync::mpsc::Sender<AgentProgress>>,
agent_id: &str,
task_id: &str,
@@ -226,6 +227,7 @@ pub(in super::super) async fn run_subagent_via_graph(
context_window,
// Mid-flight steering: forward queued steer messages into the run.
run_queue,
+ message_run_queue,
// Pause + checkpoint when the child asks the user a clarifying question.
early_exit_tools: &["ask_user_clarification"],
// Pause gracefully at the model-call cap so we can summarize a resumable
diff --git a/crates/openhuman-core/src/agent/subagent_host/types.rs b/crates/openhuman-core/src/agent/subagent_host/types.rs
index 62bb9d44ff..021cb68c8c 100644
--- a/crates/openhuman-core/src/agent/subagent_host/types.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/types.rs
@@ -87,6 +87,11 @@ pub struct SubagentRunOptions {
tinyagents_harness::run_queue::RunQueue<crate::agent::queued_turn::QueuedTurn>,
>,
>,
+
+ /// Native TinyAgents message queue for a driver-backed delegated run.
+ /// Generic Jobs/Message controls inject full user messages here; this is
+ /// converted to the runtime feed by the host's graph adapter.
+ pub message_run_queue: Option<tinyagents_harness::run_queue::RunQueueHandle>,
}
/// Terminal status of a sub-agent run.
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs b/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs
index a03d2b7054..825e87f057 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs
@@ -100,6 +100,7 @@ pub(crate) struct TurnSpec<'a> {
pub subagent_scope: Option<SubagentScope>,
pub context_window: Option<u64>,
pub run_queue: Option<Arc<RunQueue<crate::agent::queued_turn::QueuedTurn>>>,
+ pub message_run_queue: Option<tinyagents_harness::run_queue::RunQueueHandle>,
pub early_exit_tools: &'a [&'a str],
pub pause_at_cap: bool,
pub max_output_tokens: Option<u32>,
@@ -151,6 +152,7 @@ async fn drive_turn(
subagent_scope,
context_window,
run_queue,
+ message_run_queue,
early_exit_tools,
pause_at_cap,
max_output_tokens,
@@ -453,7 +455,9 @@ async fn drive_turn(
// Forwards mid-flight steers from the session's run queue, drains
// residual (delivered-but-unapplied) steers back into it when the turn
// ends — also on cancellation (issue #4456).
- steering: run_queue.map(steering_forwarder::queue_feed),
+ steering: message_run_queue
+ .map(steering_forwarder::message_queue_feed)
+ .or_else(|| run_queue.map(steering_forwarder::queue_feed)),
registrar: is_subagent
.then(|| Arc::new(steering_forwarder::SharedSteeringRegistrar) as Arc<_>),
thread_label: Some(steer_thread_label),