Skip to content

event_recorder

diapason.evals.core.event_recorder

Event recording system for agent execution telemetry.

AgentEvent dataclass

Single event recorded during agent execution.

EventRecorder

Thread-safe recorder for agent execution events.

Records events with timestamps for later correlation with energy telemetry. All operations are thread-safe for use in concurrent agent execution.

Example

recorder = EventRecorder() recorder.record('tool_call_start', tool='calculator') recorder.record('tool_call_end', tool='calculator') events = recorder.get_events() len(events) 2

__init__()

Initialize the event recorder.

__len__()

Return the number of recorded events.

clear()

Clear all recorded events.

get_events()

Return a copy of all recorded events.

Returns:

Type Description
List[AgentEvent]

List of all recorded events in chronological order.

record(event_type, **metadata)

Record an event with current timestamp.

Parameters:

Name Type Description Default
event_type str

Type of event (e.g., 'tool_call_start', 'lm_inference_end')

required
**metadata Any

Additional metadata to attach to the event

{}

EventType

Bases: str, Enum

Supported event types for agent telemetry.