Skip to main content

createJsonEventWriter()

createJsonEventWriter(config): EventWriter

Defined in: json-event-writer.ts:43

Create a JSON event writer that persists events as individual files.

Each event is written to {eventType}-{agentId}-{timestamp}.json where dots in the eventType are replaced with dashes. Files are formatted with 2-space indentation for human readability.

The write(graph) method is a no-op — this writer only handles structured events.

Parameters

ParameterTypeDescription
configJsonEventWriterConfigWriter configuration with output directory.

Returns

EventWriter

An EventWriter that writes JSON files.

Example

const writer = createJsonEventWriter({ outputDir: './events' });
await writer.writeEvent(executionEvent);
// Creates: events/execution-completed-my-agent-1710800000000.json