"""Create recovery_planner
Generated by Phi-Octopus Eden
2025-11-07 13:08:29.576377
"""

```python
def create_recovery_planner(logs: list[str], max_errors: int) -> dict:
    """
    Creates a recovery planner for limited error handling.

    :param logs: A list of log messages from a system.
    :param max_errors: The maximum number of errors to handle before stopping recovery attempts.
    :return: A dictionary containing the count of errors handled and the last error message encountered.

    Example usage:
    >>> create_recovery_planner(["Error 1", "Error 2", "Info 3", "Error 4"], 3)
    {'errors_handled': 3, 'last_error': 'Error 4'}
    """
    error_count = 0
    last_error = None

    for log in logs:
        if 'Error' in log:  # Simplistic check to distinguish errors from other messages
            error_count += 1
            if error_count <= max_errors:
                last_error = log
            else:
                break

    return {'errors_handled': error_count, 'last_error': last_error}
```

# Example usage of the function
```python
result = create_recovery_planner(["Error 1", "Warning 2", "Info 3", "Error 4", "Error 5"], 3)
print(result)  # Output: {'errors_handled': 3, 'last_error': 'Error 5'}
```

# Additional lines of code to demonstrate integration in a class
```python
class SystemMonitor:
    def __init__(self):
        self.recovery_planner = None

    def update_recovery_plan(self, logs: list[str], max_errors: int) -> dict:
        """
        Updates the recovery plan based on system logs.
        """
        self.recovery_planner = create_recovery_planner(logs, max_errors)
        return self.recovery_planner

# Usage of the class
monitor = SystemMonitor()
result = monitor.update_recovery_plan(["Error 1", "Warning 2", "Info 3", "Error 4"], 3)
print(result)  # Output: {'errors_handled': 3, 'last_error': 'Error 4'}
```