Skip to content

OSSS.ai.events.sinks

OSSS.ai.events.sinks

Event Sinks for OSSS Event System.

This module provides various event sinks for handling workflow events, including console output, file storage, and in-memory collection for testing and development.

EventSink

Bases: ABC

Abstract base class for event sinks.

emit(event) abstractmethod async

Emit an event to this sink.

close() abstractmethod async

Close the event sink and cleanup resources.

ConsoleEventSink

Bases: EventSink

Event sink that outputs events to console with formatting.

emit(event) async

Output the event to console.

close() async

No cleanup needed for console sink.

FileEventSink

Bases: EventSink

Event sink that writes events to a file in JSON Lines format.

emit(event) async

Write the event to file.

get_statistics()

Get event statistics for this sink.

close() async

Close the file sink.

InMemoryEventSink

Bases: EventSink

Event sink that stores events in memory for testing and development.

emit(event) async

Store the event in memory.

get_events(event_type=None, workflow_id=None, agent_name=None)

Get stored events with optional filtering.

get_recent_events(count=10)

Get the most recent events.

get_statistics()

Get event statistics for this sink.

clear_events()

Clear all stored events and return count of cleared events.

close() async

Clear stored events.

create_file_sink(file_path, max_file_size_mb=100, rotate_files=True, event_types=None, agent_names=None)

Create a file event sink with optional filtering.