Skip to content

Resolve

When an agent output is escalated, a human reviewer assesses it and submits a decision: approve, reject, or correct.


Decision Types

Approved

The output is correct as-is. No corrections needed.

coalex.resolve(
    escalation_id="esc-001",
    decision="approved",
    reviewer={"name": "Dr. Smith", "email": "dr.smith@hospital.org"},
    reason="Output is clinically accurate and complete.",
)

Rejected

The output is incorrect and should not be served. No corrected version provided.

coalex.resolve(
    escalation_id="esc-002",
    decision="rejected",
    reviewer={"name": "Dr. Jones", "email": "dr.jones@hospital.org"},
    reason="Diagnosis is incorrect. Patient symptoms indicate pneumonia, not bronchitis.",
)

Corrected

The reviewer provides a corrected version of the output. Coalex computes quality metrics by comparing the original output against the corrections.

coalex.resolve(
    escalation_id="esc-003",
    decision="corrected",
    corrections={
        "diagnosis": "Community-acquired pneumonia",
        "icd_code": "J18.9",
        "recommendation": "Chest X-ray and empiric antibiotics",
    },
    reviewer={"name": "Dr. Jones", "email": "dr.jones@hospital.org"},
    reason="Changed diagnosis from bronchitis to pneumonia based on imaging.",
)

Quality Metrics

When decision="corrected", Coalex computes the metrics declared in evaluate() by comparing the original output against the corrections. For example:

diagnosis: {"semantic_similarity": 0.45, "f1": 0.32}
icd_code: {"exact_match": 0.0}
recommendation: {"semantic_similarity": 0.71, "contains": 0.0}

These metrics feed back into the agent's health score, improving future risk assessments.


Reviewer Identity

Pass reviewer information for audit trail visibility:

# Recommended: dict with name and email
reviewer={"name": "Dr. Smith", "email": "dr.smith@hospital.org"}

# Backward compatible: string
reviewer="dr.smith@hospital.org"

The dict form is recommended — the dashboard displays the reviewer's name alongside their email in the escalation audit trail.


SDK Reference

  • resolve() — Full API reference with all parameters and return types
  • evaluate() — How evaluations trigger escalations