JsonlTraceExporter class

Writes one JSON object per line to a file. Easy to grep, easy to import into other tools.

Event format (top-level keys):

  • kind: 'trial_start' | 'llm_call' | 'tool_call' | 'trial_end' | 'run_end'
  • at: ISO-8601 timestamp
  • all other keys are kind-specific

The exporter buffers writes; flush is called automatically on dispose but can also be called manually.

Implemented types

Constructors

JsonlTraceExporter(File file, {bool append = true})
factory

Properties

file File
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose() Future<void>
Flush + release resources. Called once at the end of the run.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onLLMCall({required Trial trial, required List<LLMMessage> requestMessages, required ModelConfig modelConfig, required ModelMessage? response, required Duration duration, Object? error}) Future<void>
Called for each LLM call. response is null on errors.
override
onRunEnd({required String runName, required String suiteName, required Map<String, double> aggregateScores}) Future<void>
Called when a dataset run completes. Implementations may use this hook to record run-level aggregate scores (pass@k, F1 …).
override
onToolCall({required Trial trial, required ToolCallRecord record}) Future<void>
Called for each tool call.
override
onTrialEnd({required Trial trial, required Transcript transcript, required Outcome outcome, required List<Score> scores}) Future<void>
Called when trial finishes with the final transcript, outcome, and scores. Implementations should attach all scores here.
override
onTrialStart(Trial trial, EvalTask task) Future<void>
Called when a trial starts.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited