The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(runtime): box the turn future to avoid deep async state machine
Steven Enamakel7e7737a9c38c
diff --git a/crates/openhuman-embed/src/runtime/mod.rs b/crates/openhuman-embed/src/runtime/mod.rsindex 3b5908bdf0..b454e799a1 100644--- a/crates/openhuman-embed/src/runtime/mod.rs+++ b/crates/openhuman-embed/src/runtime/mod.rs@@ -84,7 +84,7 @@ use openhuman_core::tools::toolpacks::ToolGroups;use crate::agent::{Agent, AgentError, AgentInner, AgentSpec};use crate::harness::workspace::ResolvedWorkspace;-use crate::harness::{Access, HarnessCore, Provider, Workspace};+use crate::harness::{Access, HarnessCore, Provider};use crate::{Core, CoreError};/// Guards the process-scoped core state described in the module docs.diff --git a/crates/openhuman-embed/src/turn.rs b/crates/openhuman-embed/src/turn.rsindex 176e92423d..a0146e91a4 100644--- a/crates/openhuman-embed/src/turn.rs+++ b/crates/openhuman-embed/src/turn.rs@@ -422,8 +422,13 @@ async fn dispatch(target: TurnTarget, request: TurnRequest) -> Result<String, Colet ctx = agent.ctx.clone();let inner = agent.clone();let runtime = agent.runtime.clone();- runtime- .run_in(ctx, async move {+ // Boxed: the native turn future is the entire tinyagents harness+ // inlined, and nesting it inside `Turn::send`'s own state machine+ // pushes rustc's layout query past its depth limit. One heap+ // allocation per turn is nothing next to the turn itself.+ let turn: std::pin::Pin<+ Box<dyn std::future::Future<Output = Result<String, CoreError>> + Send>,+ > = Box::pin(async move {use openhuman_core::inference::local::ops::{agent_chat_for, AgentChatTarget};let mut config = inner.config.clone();let route = openhuman_core::config::schema::EphemeralRoute::from_params(@@ -448,8 +453,8 @@ async fn dispatch(target: TurnTarget, request: TurnRequest) -> Result<String, Co.await.map(|outcome| outcome.value).map_err(|raw| CoreError::from_rpc_string(AGENT_CHAT, raw))- })- .await+ });+ runtime.run_in(ctx, turn).await}}}