graceful_degradationTier 1 · 70% confidence

ai-agents-graceful-degradation-when-data-fetching-or-processing-fails-the-system--99a3bc5a

agent: ai_agents

When does this happen?

IF When data fetching or processing fails, the system must not fail silently; user should be notified of the failure and a fallback behavior should be configurable.

How others solved it

THEN Implement a degradation policy with three configurable modes: 'warn_only' (send alert), 'skip_send' (silently skip but log), 'use_last_data' (fall back to previous successful result). At minimum, always send a degradation notification (e.g., status update) when failure occurs. Make the mode configurable via environment variable or config file.

# Configurable degradation
import os, logging

DEGRADATION_MODE = os.getenv('DEGRADATION_MODE', 'warn_only')  # warn_only | skip | use_last

def handle_failure(err):
    if DEGRADATION_MODE == 'warn_only':
        send_notification(f'Task failed: {err}')
    elif DEGRADATION_MODE == 'skip_send':
        logging.warning(f'Task failed, skipping send: {err}')
    elif DEGRADATION_MODE == 'use_last':
        last_data = load_last_successful_data()
        if last_data:
            send_notification(last_data, degraded=True, reason='using_last_data')
        else:
            send_notification(f'Task failed, no prior data available: {err}')

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics