Skip to content

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

docs(triage): update parser docs to reflect TinyAgents delegation

Steven Enamakel0f8c8bb9023d
diff --git a/crates/openhuman-core/src/triage/decision.rs b/crates/openhuman-core/src/triage/decision.rs
index 6c63dc844b..0434842eb4 100644
--- a/crates/openhuman-core/src/triage/decision.rs
+++ b/crates/openhuman-core/src/triage/decision.rs
@@ -1,6 +1,5 @@
-//! Structured decision emitted by the `trigger_triage` agent, plus a
-//! deliberately-tolerant parser that accepts whatever shape a small
-//! local model is likely to produce.
+//! Structured decision emitted by the `trigger_triage` agent, plus host
+//! action normalization and validation around TinyAgents' lenient parser.
//!
//! The contract is described in
//! `crates/openhuman-core/src/agent_registry/agents/trigger_triage/prompt.md` — the triage
@@ -103,16 +102,9 @@ pub enum ParseError {
/// Parse the triage agent's raw reply text into a [`TriageDecision`].
///
-/// Algorithm (keep in sync with the prompt's output contract):
-///
-/// 1. Try to extract the **last** fenced ```json block — small models
-/// often add commentary *after* the JSON and we want the JSON.
-/// 2. If no fence, brace-match the **last** balanced `{ … }` object in
-/// the text. This handles "Here's my decision: { … }" and
-/// "{ … } (hope that helps)".
-/// 3. Strip trailing commas before the parse (`,}` → `}`, `,]` → `]`).
-/// 4. Parse as JSON, lowercasing the `action` string in flight.
-/// 5. Reject if React / Escalate but `target_agent`/`prompt` missing.
+/// TinyAgents selects and repairs the last complete JSON object. OpenHuman
+/// keeps the triage-specific casing normalization and action-field validation:
+/// React / Escalate must include a non-empty target and prompt.
pub fn parse_triage_decision(llm_text: &str) -> Result<TriageDecision, ParseError> {
let (value, _) = parse_lenient_last_object(llm_text).ok_or(ParseError::NoJsonObject)?;
let normalized = lowercase_action_value(&value.to_string());
diff --git a/crates/openhuman-core/src/triage/evaluator/arm.rs b/crates/openhuman-core/src/triage/evaluator/arm.rs
index 19c8491768..2bed0c7531 100644
--- a/crates/openhuman-core/src/triage/evaluator/arm.rs
+++ b/crates/openhuman-core/src/triage/evaluator/arm.rs
@@ -230,7 +230,7 @@ pub(super) async fn try_arm(
pub(crate) fn classify_error(message: String) -> ArmError {
let err = anyhow!("{message}");
// Budget-exceeded is technically a 400 (not 5xx/429), so the
- // generic transient checks above won't catch it — but it is a
+ // generic owner classifier below won't catch it — but it is a
// user-actionable upstream blocker, not a code bug, so we route
// it through `BudgetExhausted` to avoid Sentry pages.
if is_inference_budget_exceeded(&message) {