Skip to content

Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.

Improve `MethodExecutionFailedEvent.error` typing (#2401)

Vini Brasilfe0813e831bf
diff --git a/src/crewai/utilities/events/flow_events.py b/src/crewai/utilities/events/flow_events.py
index 435d64214..8800b301b 100644
--- a/src/crewai/utilities/events/flow_events.py
+++ b/src/crewai/utilities/events/flow_events.py
@@ -1,6 +1,6 @@
from typing import Any, Dict, Optional, Union
-from pydantic import BaseModel
+from pydantic import BaseModel, ConfigDict
from .base_events import CrewEvent
@@ -52,9 +52,11 @@ class MethodExecutionFailedEvent(FlowEvent):
flow_name: str
method_name: str
- error: Any
+ error: Exception
type: str = "method_execution_failed"
+ model_config = ConfigDict(arbitrary_types_allowed=True)
+
class FlowFinishedEvent(FlowEvent):
"""Event emitted when a flow completes execution"""