"""Create recovery_planner
Generated by Phi-Octopus Eden
2025-11-08 10:21:44.522603
"""

```python
from typing import Dict


class RecoveryPlanner:
    """
    A class for creating a limited error recovery planner that can handle unexpected errors gracefully.
    
    Attributes:
        max_attempts (int): The maximum number of attempts to recover from an error.
        current_attempt (int): The current attempt count during recovery process.
        failure_threshold (float): The threshold at which the system will decide to fail gracefully.
    """
    
    def __init__(self, max_attempts: int = 5, failure_threshold: float = 0.8):
        self.max_attempts = max_attempts
        self.current_attempt = 0
        self.failure_threshold = failure_threshold

    def plan_recovery(self, attempts_left: int) -> bool:
        """
        Plan recovery based on the number of attempts left.
        
        Args:
            attempts_left (int): The number of remaining attempts to recover from an error.
            
        Returns:
            bool: True if the system should continue attempting recovery, False otherwise.
        """
        self.current_attempt += 1
        return attempts_left > 0 and self.current_attempt < self.max_attempts

    def handle_error(self, error_rate: float) -> bool:
        """
        Handle an error based on its rate. If the error rate exceeds the failure threshold,
        gracefully fail instead of attempting recovery.
        
        Args:
            error_rate (float): The current rate at which errors are occurring.
            
        Returns:
            bool: True if the system should continue, False to indicate a graceful failure.
        """
        if error_rate > self.failure_threshold:
            print("Error rate too high. Failing gracefully.")
            return False
        else:
            attempts_left = self.max_attempts - self.current_attempt
            return self.plan_recovery(attempts_left)


def example_usage():
    planner = RecoveryPlanner(max_attempts=3, failure_threshold=0.5)
    
    # Simulate increasing error rate and handle it
    for i in range(1, 7):
        if not planner.handle_error(error_rate=i / 6.0):
            print("System failed gracefully.")
            break

if __name__ == "__main__":
    example_usage()
```

This code defines a `RecoveryPlanner` class that attempts to recover from errors up to a certain maximum number of attempts and a failure threshold for the error rate. The `handle_error` method decides whether to continue recovery or fail gracefully based on these criteria, while the `plan_recovery` method manages the attempt count during the process. An example usage function demonstrates how to use this class with simulated increasing error rates.