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 triage escalation and evaluator chain
Steven Enamakel645a00cb4a7d
diff --git a/crates/openhuman-core/src/agent/schemas.rs b/crates/openhuman-core/src/agent/schemas.rsindex 8f37e028d3..9ec66822eb 100644--- a/crates/openhuman-core/src/agent/schemas.rs+++ b/crates/openhuman-core/src/agent/schemas.rs@@ -356,7 +356,7 @@ struct TriageEvaluateParams {dry_run: Option<bool>,}-fn handle_triage_evaluate(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {+fn handle_triage_evaluate(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {Box::pin(async move {let p = deserialize_params::<TriageEvaluateParams>(params)?;@@ -421,7 +421,7 @@ fn handle_triage_evaluate(_ctx: DispatchCtx, params: Map<String, Value>) -> Cont"[rpc][agent] running triage pipeline");- let outcome = crate::agent::triage::run_triage(&envelope)+ let outcome = crate::agent::triage::run_triage(&ctx, &envelope).await.map_err(|e| format!("triage evaluation failed: {e}"))?;@@ -436,7 +436,7 @@ fn handle_triage_evaluate(_ctx: DispatchCtx, params: Map<String, Value>) -> Contlet origin = crate::agent::triage::local_trigger_origin();crate::agent::turn_origin::with_origin(origin,- crate::agent::triage::apply_decision(run.clone(), &envelope),+ crate::agent::triage::apply_decision(&ctx, run.clone(), &envelope),).await.map_err(|e| format!("apply_decision failed: {e}"))?;diff --git a/crates/openhuman-core/src/agent/triage/escalation.rs b/crates/openhuman-core/src/agent/triage/escalation.rsindex fea71562fe..218226e70c 100644--- a/crates/openhuman-core/src/agent/triage/escalation.rs+++ b/crates/openhuman-core/src/agent/triage/escalation.rs@@ -38,7 +38,11 @@ use super::events;/// 3. If the action is `React` or `Escalate`, dispatching the appropriate/// sub-agent (`trigger_reactor` or `orchestrator`)./// 4. Publishing `TriggerEscalated` or `TriggerEscalationFailed` events.-pub async fn apply_decision(run: TriageRun, envelope: &TriggerEnvelope) -> anyhow::Result<()> {+pub async fn apply_decision(+ ctx: &DispatchCtx,+ run: TriageRun,+ envelope: &TriggerEnvelope,+) -> anyhow::Result<()> {// Always publish `TriggerEvaluated` — it's the single source of// truth for dashboards, counts every trigger regardless of action.events::publish_evaluated(@@ -161,7 +165,7 @@ pub async fn apply_decision(run: TriageRun, envelope: &TriggerEnvelope) -> anyho}}- let dispatch_result = dispatch_target_agent(target, prompt).await;+ let dispatch_result = dispatch_target_agent(ctx, target, prompt).await;// Record terminal status on the approval audit row// (#2135). Best-effort: write errors are logged inside// record_execution and never propagate to the caller.@@ -236,7 +240,11 @@ async fn build_triage_parent(Ok(parent_ctx)}-async fn dispatch_target_agent(agent_id: &str, prompt: &str) -> anyhow::Result<String> {+async fn dispatch_target_agent(+ ctx: &DispatchCtx,+ agent_id: &str,+ prompt: &str,+) -> anyhow::Result<String> {#[cfg(test)]if agent_id.starts_with("missing-agent-") {return Err(anyhow!(@@ -244,7 +252,7 @@ async fn dispatch_target_agent(agent_id: &str, prompt: &str) -> anyhow::Result<S));}- let config = crate::config::ops::load_current_or_init(&DispatchCtx::ambient())+ let config = crate::config::ops::load_current_or_init(ctx).await.context("loading config for sub-agent dispatch")?;@@ -270,6 +278,7 @@ async fn dispatch_target_agent(agent_id: &str, prompt: &str) -> anyhow::Result<Sprompt,SubagentRunOptions {run_context: crate::agent::tinyagents::host::OpenHumanRunContext::new()+ .with_core(ctx.core().cloned()).with_host_env(&parent_ctx.host_env).with_parent(parent_ctx),..Default::default()diff --git a/crates/openhuman-core/src/agent/triage/evaluator/chain.rs b/crates/openhuman-core/src/agent/triage/evaluator/chain.rsindex 0520594e22..e30ab2bf69 100644--- a/crates/openhuman-core/src/agent/triage/evaluator/chain.rs+++ b/crates/openhuman-core/src/agent/triage/evaluator/chain.rs@@ -76,8 +76,11 @@ fn retry_state() -> &'static RetryState {/// caller does not create another fixed-interval cloud invocation./// 5. On local failure, return `TriageOutcome::Deferred` so the/// caller can retry when a local arm is available.-pub async fn run_triage(envelope: &TriggerEnvelope) -> anyhow::Result<TriageOutcome> {- let config = crate::config::ops::load_current_or_init(&DispatchCtx::ambient())+pub async fn run_triage(+ ctx: &DispatchCtx,+ envelope: &TriggerEnvelope,+) -> anyhow::Result<TriageOutcome> {+ let config = crate::config::ops::load_current_or_init(ctx).await.context("loading config for triage turn")?;let cloud = resolve_provider_with_config(&config)