Diagnoses and routes failures by analyzing error patterns, classifying severity, and applying retry logic, suppression budgets, and escalation rules. Use when handling errors, troubleshooting failures, recovering from API errors or timeouts, deciding whether to retry or escalate an issue, or managing service outages and tool dependency failures. Applies to any scenario where a check has failed, evidence of success is missing, or an unresolved error needs a structured response. Includes explicit untrusted-content/prompt-injection guardrails for third-party inputs.
98
Quality
94%
Does it follow best practices?
Impact
100%
1.16xAverage score across 9 eval scenarios
A fintech company runs a ledger service where financial transactions are written to a database. The team has discovered a subtle bug: occasionally, write operations return HTTP 200 (success) but a subsequent read of the same record returns either empty data or a previous stale value. This means the write silently failed. The current system logs a warning and moves on, which has already caused duplicate charges in production.
The engineering team needs a Python module that wraps their database write operations and handles the verification step — checking whether what was written can actually be read back. The module needs to treat this class of failure with the highest severity, ensuring no such failure is ever quietly swallowed by the system. The module should be usable in their async transaction pipeline.
Write a Python module write_guard.py that:
TriageReport dataclass or similar result structureWrite a test_write_guard.py file with at least 2 unit tests (using unittest or pytest style, no external services needed — mock the write/read functions).