Skip to content

MukundaKatta/trace-export-csv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

trace-export-csv

Export JSONL agent traces to CSV for spreadsheet and BI analysis.

Zero dependencies. Python 3.10+. MIT.

Install

pip install trace-export-csv

Usage

from trace_export_csv import export_file

result = export_file("logs/run.jsonl", "analysis/run.csv")
print(f"Exported {result.row_count} rows, columns: {result.columns}")

Open run.csv in Excel, Google Sheets, or any BI tool. Default columns:

timestamp, kind, name, lane, model, tokens_in, tokens_out, cost_usd, duration_ms, error

From a list of dicts

from trace_export_csv import export_csv

result = export_csv(events, "out.csv")

Get CSV as a string (no file)

result = export_csv(events)
print(result.csv_text)

Include all fields

result = export_file("run.jsonl", "out.csv", include_all=True)

Adds every key found across all events (union) as additional columns.

Extra specific fields

result = export_csv(events, "out.csv", extra_fields=["run_id", "sub_task"])

CLI

trace-export-csv run.jsonl out.csv
trace-export-csv run.jsonl out.csv --all

Field mapping

The default mapping recognizes common naming conventions:

CSV column JSONL keys tried
timestamp timestamp, ts, time, created_at, at
kind kind, type, event_type
name name, step, tool, tool_name
tokens_in tokens_in, input_tokens, prompt_tokens
tokens_out tokens_out, output_tokens, completion_tokens
cost_usd cost_usd, cost, price_usd, usd
error error, err, exception

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages