MCPcopy Create free account
hub / github.com/AgentOps-AI/agentops / ErrorEvent

Class ErrorEvent

agentops/legacy/event.py:119–156  ·  view source on GitHub ↗

For recording any errors e.g. ones related to agent execution trigger_event(Event, optional): The event object that triggered the error if applicable. exception(BaseException, optional): The thrown exception. We will automatically parse the error_type and details from this. error_t

Source from the content-addressed store, hash-verified

117
118@dataclass
119class ErrorEvent(Event):
120 """
121 For recording any errors e.g. ones related to agent execution
122
123 trigger_event(Event, optional): The event object that triggered the error if applicable.
124 exception(BaseException, optional): The thrown exception. We will automatically parse the error_type and details from this.
125 error_type(str, optional): The type of error e.g. "ValueError".
126 code(str, optional): A code that can be used to identify the error e.g. 501.
127 details(str, optional): Detailed information about the error.
128 logs(str, optional): For detailed information/logging related to the error.
129 """
130
131 # Inherit common Event fields
132 event_type: str = field(default=EventType.ERROR.value)
133
134 # Error-specific fields
135 trigger_event: Optional[Event] = None
136 exception: Optional[BaseException] = None
137 error_type: Optional[str] = None
138 code: Optional[str] = None
139 details: Optional[Union[str, Dict[str, str]]] = None
140 logs: Optional[str] = field(default_factory=traceback.format_exc)
141
142 def __post_init__(self):
143 """Process exception if provided"""
144 if self.exception:
145 self.error_type = self.error_type or type(self.exception).__name__
146 self.details = self.details or str(self.exception)
147 self.exception = None # removes exception from serialization
148
149 # Ensure end timestamp is set
150 if not self.end_timestamp:
151 self.end_timestamp = get_ISO_time()
152
153 @property
154 def timestamp(self) -> str:
155 """Maintain backward compatibility with old code expecting timestamp"""
156 return self.init_timestamp

Callers 2

record_errorMethod · 0.90

Calls

no outgoing calls

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…