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
refactor(delegation): call graph delegation directly and attach tracing sink at call site
Steven Enamakeld39503ff5e9b
diff --git a/crates/openhuman-core/src/agent/orchestration/delegation.rs b/crates/openhuman-core/src/agent/orchestration/delegation.rsindex e463323e16..f4614afcb4 100644--- a/crates/openhuman-core/src/agent/orchestration/delegation.rs+++ b/crates/openhuman-core/src/agent/orchestration/delegation.rs@@ -22,7 +22,6 @@ use crate::agent::progress::AgentProgress;use crate::agent::subagent_host::{run_subagent_with_parent, SubagentRunOptions, SubagentRunStatus,};-use crate::agent::tinyagents::host::delegation::run_or_resume_with_tracing;use crate::agent::tinyagents::host::OpenHumanRunContext;use crate::config::Config;use tinyagents_graph::checkpoint::Checkpointer;@@ -194,7 +193,7 @@ pub(crate) async fn run_subagent_delegation_with_parent_context(}};- let delegation_config = DelegationConfig {+ let mut delegation_config = DelegationConfig {max_revisions,checkpointer: Some(checkpointer),thread_id: Some(thread_id),@@ -205,10 +204,13 @@ pub(crate) async fn run_subagent_delegation_with_parent_context(// stays off here until a human-review delegation surface wires it...DelegationConfig::default()};+ delegation_config.event_sink = Some(Arc::new(tinyagents_graph::GraphTracingSink::new(+ "delegation:graph",+ )));// Resume-aware entry (#3884): with today's fresh-per-run `thread_id` this// is always a fresh run; reusing a stable `thread_id` resumes from the// last checkpoint boundary instead of restarting.- run_or_resume_with_tracing(delegation_config, run_stage)+ tinyagents_graph::delegation::run_or_resume_delegation(delegation_config, run_stage).await.map(|outcome| outcome.state)};diff --git a/crates/openhuman-core/src/agent/tinyagents/host/delegation.rs b/crates/openhuman-core/src/agent/tinyagents/host/delegation.rsdeleted file mode 100644index 049e8383fa..0000000000--- a/crates/openhuman-core/src/agent/tinyagents/host/delegation.rs+++ /dev/null@@ -1,88 +0,0 @@-//! Multi-stage sub-agent delegation — the OpenHuman-facing seam onto-//! [`tinyagents_graph::delegation`] (issue #4249, #27/#28).-//!-//! The graph itself — the plan→execute⇄review→finalize state machine, its-//! revision budget, checkpoint/resume classification, durable human-approval-//! interrupt and cancellation handling — now lives upstream in the crate, where-//! it is reusable by any host and where its on-disk state shape is pinned by-//! tests. Nothing about it was OpenHuman-specific: the per-stage worker was-//! already injected, so the module named no host config, RPC, event bus or-//! security policy.-//!-//! ```text-//! plan ─▶ execute ─▶ review ──approved/maxed──▶ finalize ─▶ END-//! ▲ │-//! └─────revise────────┘-//! ```-//!-//! What stays here is this file: the historical spellings the rest of the core-//! imports, plus the one thing that genuinely is ours — the observability sink.-//!-//! # The sink is the reason these are wrappers, not plain re-exports-//!-//! Every delegation run is journalled onto OpenHuman's `tracing` diagnostics-//! through [`GraphTracingSink`](tinyagents_graph::GraphTracingSink), which-//! lives in [`super::observability`] alongside the cost catalog, the tool-status-//! classifier and the provider usage tables — host surface that must not follow-//! the graph upstream. The crate instead takes an optional-//! [`DelegationConfig::event_sink`], and the wrappers below attach ours when a-//! caller has not supplied one. Behaviour is unchanged from when the sink was-//! hard-wired into the graph builder: every run through this module is still-//! journalled under the `delegation:graph` label.-//!-//! A caller that sets `event_sink` explicitly keeps its own sink — the wrappers-//! fill a gap, they never override.-//!-//! # Layering-//!-//! Production wiring of the injected stage worker (dispatching each stage-//! through `run_subagent`, and the `SqliteCheckpointer` under the workspace) is-//! a separate concern and lives in-//! [`agent_orchestration::delegation`](crate::agent::orchestration::delegation),-//! which depends on both this seam and `subagent_host` — so this seam stays-//! free of orchestration dependencies.--use std::future::Future;-use std::sync::Arc;--use tinyagents_graph::GraphTracingSink;--use tinyagents_graph::delegation::{- DelegationConfig, DelegationOutcome, DelegationStage, DelegationStageOutput, DelegationState,-};--/// The `tracing` label every delegation graph run is journalled under. Stable —-/// log queries and dashboards match on it.-const GRAPH_SINK_LABEL: &str = "delegation:graph";--/// Attach OpenHuman's graph tracing sink unless the caller supplied one.-///-/// This is the single place the host's observability is bound to a delegation-/// run, so a new entry point cannot silently lose the journal.-fn with_tracing_sink(mut config: DelegationConfig) -> DelegationConfig {- if config.event_sink.is_none() {- config.event_sink = Some(Arc::new(GraphTracingSink::new(GRAPH_SINK_LABEL)));- }- config-}--/// Run the delegation graph, resuming from the last checkpoint boundary when the-/// configured thread has a live, compatible, non-terminal checkpoint, else-/// starting fresh.-///-/// See [`tinyagents_graph::delegation::run_or_resume_delegation`].-pub(crate) async fn run_or_resume_with_tracing<F, Fut>(- config: DelegationConfig,- run_stage: F,-) -> Result<DelegationOutcome, String>-where- F: Fn(DelegationStage, DelegationState) -> Fut + Clone + Send + Sync + 'static,- Fut: Future<Output = Result<DelegationStageOutput, String>> + Send + 'static,-{- tinyagents_graph::delegation::run_or_resume_delegation(with_tracing_sink(config), run_stage)- .await-}--#[cfg(test)]-#[path = "../delegation_tests.rs"]-mod tests;diff --git a/crates/openhuman-core/src/agent/tinyagents/host/mod.rs b/crates/openhuman-core/src/agent/tinyagents/host/mod.rsindex f46cd1dd4e..8b85865150 100644--- a/crates/openhuman-core/src/agent/tinyagents/host/mod.rs+++ b/crates/openhuman-core/src/agent/tinyagents/host/mod.rs@@ -30,7 +30,6 @@pub mod budget_gate;mod bundle;pub mod definition_registry;-pub mod delegation;mod operation_context;pub mod run_context;pub mod security_gate;