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
feat(agent): add graph dispatch for subagent host ops
Steven Enamakel58965b139619
diff --git a/crates/openhuman-core/src/agent/harness/graph.rs b/crates/openhuman-core/src/agent/harness/graph.rsindex f2c045431b..62a021686c 100644--- a/crates/openhuman-core/src/agent/harness/graph.rs+++ b/crates/openhuman-core/src/agent/harness/graph.rs@@ -146,44 +146,44 @@ pub(crate) async fn run_channel_turn_via_graph(// The channel dispatcher owns this explicit sink. It wins over an embedder// scope exactly as it did before this carrier was introduced.run_context.progress = on_progress.clone().or(run_context.progress);- let outcome = run_turn_via_tinyagents_shared(+ let outcome = TurnSpec {run_context,turn_models,provider_id,model,- prepared,- vec![extra_arc, tools_registry],+ history: prepared,+ tool_sets: vec![extra_arc, tools_registry],allowed,max_iterations,// Top-level (parent) turn — no child-progress attribution.- None,+ subagent_scope: None,// Resolved above — drives the context-window summarization step.context_window,// No mid-flight steering on the channel path.- None,+ run_queue: None,// Same pause as the chat path: a channel turn's continuation is the// user's next message, so ending the turn on the question is the whole// mechanism. Without this the model answers its own question (see// `session/turn/graph.rs`).- &["ask_user_clarification"],+ early_exit_tools: &["ask_user_clarification"],// Channels surface the cap as an error (legacy `ErrorCheckpoint`), so no// graceful cap pause/summary here.- false,+ pause_at_cap: false,// Bound the model's per-call output (legacy parity — channel turns ran at// the standard per-turn budget).- Some(crate::inference::provider::AGENT_TURN_MAX_OUTPUT_TOKENS),+ max_output_tokens: Some(crate::inference::provider::AGENT_TURN_MAX_OUTPUT_TOKENS),// Context middlewares: cache-align + default tool-result byte cap (the// channel path has no session `ContextManager` to source config from).- crate::agent::tinyagents::TurnContextMiddleware::defaults(),+ context_mw: crate::agent::tinyagents::TurnContextMiddleware::defaults(),// Channel/CLI path carries its own gating; no session `.tool_policy()`.- None,+ tool_policy: None,// Interactive channel/CLI turn — never serve a cached model response.- false,+ deterministic_cacheable: false,// #4457 (defect C): the channel/CLI path has no post-run wrap-up and does// NOT emit `TurnCompleted` itself, so let the seam emit the single// terminal event (legacy-engine parity).- false,- );+ defer_turn_completed_to_caller: false,+ }.run();let outcome = match (turn_origin, crate::core::runtime::CoreContext::current()) {(Some(origin), Some(context)) => {crate::core::runtime::CoreContext::scope_with_turn_origin(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.rsindex 044705a629..6c263355f0 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@@ -196,26 +196,26 @@ pub(in super::super) async fn run_subagent_via_graph(child_context.thread_id = thread_id.clone();child_context.progress = on_progress.clone().or(child_context.progress);child_context.workspace = workspace_descriptor.clone().or(child_context.workspace);- let run_result = Box::pin(run_turn_via_tinyagents_shared(- child_context,+ let run_result = TurnSpec {+ run_context: child_context,turn_models,provider_id,model,- dispatch_history,+ history: dispatch_history,// Dynamic (per-spawn) tools first so a dynamic tool that intentionally// shadows a parent-registry tool of the same name is the one that// *executes* — matching the advertisement order (`dedup_tool_specs_by_name`// lists dynamic specs before parent specs in `runner.rs`). The shared// adapter resolves a name by scanning the sets in order, so a// parent-first order would run the parent impl for a shadowed name.- vec![Arc::new(dynamic_tools), parent_tools],+ tool_sets: vec![Arc::new(dynamic_tools), parent_tools],// Fail-closed (issue #4452): a sub-agent ALWAYS carries a concrete,// resolved allowlist (`allowed_names`), so pass it as `Some(..)`. An empty// set is therefore a genuine deny-all — a tool-less agent// (`ToolScope::Named([])`), a zero-match `skill_filter`, or a `named` list// that resolved to nothing registers ZERO tools instead of implicitly// inheriting the parent's full surface (shell/file-write/spawn).- Some(allowed_names),+ allowed: Some(allowed_names),max_iterations,subagent_scope,// Resolved above — drives the sub-agent context-window summarization step.@@ -223,31 +223,31 @@ pub(in super::super) async fn run_subagent_via_graph(// Mid-flight steering: forward queued steer messages into the run.run_queue,// Pause + checkpoint when the child asks the user a clarifying question.- &["ask_user_clarification"],+ early_exit_tools: &["ask_user_clarification"],// Pause gracefully at the model-call cap so we can summarize a resumable// checkpoint (below) instead of erroring — legacy cap-summary parity.- true,+ pause_at_cap: true,// Bound the sub-agent's per-call output at its configured budget.- Some(max_output_tokens),+ max_output_tokens: Some(max_output_tokens),// Context middlewares (#4466): config-sourced TokenJuice compaction +// tool-result byte cap + microcompact + summarization opt-outs (built// above), plus the live transcript-snapshot sink for error recovery.- {+ context_mw: {let mut mw = context_mw;mw.transcript_snapshot = Some(transcript_snapshot.clone());mw},// Sub-agents gate via their own SubagentToolSource policy path, not the// session `.tool_policy()`; no enforcement threaded here.- None,+ tool_policy: None,// Sub-agent turns run tools with external effects; not a deterministic// internal run, so response caching stays off (safe default).- false,+ deterministic_cacheable: false,// #4457 (defect C): irrelevant for sub-agents — they carry a// `subagent_scope`, so the seam never emits a top-level `TurnCompleted`// (they report via `Subagent*` events). Pass `false` for clarity.- false,- ))+ defer_turn_completed_to_caller: false,+ }.run()).await;if let Some(config) = config.filter(|config| config.observability.share_usage_data) {