Skip to content

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

feat(agent): thread run queue through host agent turns

Steven Enamakel05645b80cf59
diff --git a/crates/openhuman-core/src/agent/host_agents.rs b/crates/openhuman-core/src/agent/host_agents.rs
index 061ed661f6..ddc5229355 100644
--- a/crates/openhuman-core/src/agent/host_agents.rs
+++ b/crates/openhuman-core/src/agent/host_agents.rs
@@ -94,6 +94,9 @@ impl HostAgent {
origin: crate::agent::turn_origin::AgentTurnOrigin,
approval: crate::security::approval::ApprovalTurnContext,
progress: Option<tokio::sync::mpsc::Sender<tinyagents_harness::progress::AgentProgress>>,
+ run_queue: Option<
+ std::sync::Arc<tinyagents_harness::run_queue::RunQueue<crate::agent::queued_turn::QueuedTurn>>,
+ >,
cancellation: tinyagents_harness::CancellationToken,
turn_deadline: Option<std::time::Duration>,
imported_history: &[tinyagents_session::transcript::TranscriptMessage],
@@ -112,7 +115,7 @@ impl HostAgent {
origin,
approval: approval.clone(),
progress,
- run_queue: None,
+ run_queue,
cancellation,
turn_deadline,
workspace: crate::agent::turn_host::WorkspaceBinding::Preserve,
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/turn.rs b/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/turn.rs
index 0a75f76663..f8042ab4f7 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/turn.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/turn.rs
@@ -1,6 +1,7 @@
//! Running one channel turn as a host agent.
use tokio::sync::mpsc;
+use tinyagents_harness::run_queue::RunQueue;
use super::posture;
use crate::agent::bus::AgentTurnResponse;
@@ -26,6 +27,9 @@ pub(crate) struct HostChannelTurn {
pub(crate) origin: AgentTurnOrigin,
/// Live progress for the channel's draft updates.
pub(crate) progress: Option<mpsc::Sender<AgentProgress>>,
+ pub(crate) run_queue: Option<
+ std::sync::Arc<RunQueue<crate::agent::queued_turn::QueuedTurn>>,
+ >,
/// Where this turn's parked approvals surface; default for a channel
/// without an approval surface.
pub(crate) approval: crate::security::approval::ApprovalTurnContext,
@@ -49,6 +53,7 @@ pub(crate) async fn run_host_agent_turn(
message,
origin,
progress,
+ run_queue,
approval,
cancellation,
turn_deadline,
@@ -91,6 +96,7 @@ pub(crate) async fn run_host_agent_turn(
origin,
approval,
progress,
+ run_queue,
cancellation,
turn_deadline,
&imported_history,