Prime Intellect Traces SDK - Upload, query and export traces
Actively maintained. Last release 9 days ago, commits in 26 of the last 26 weeks. A safe choice.
pip install prime-tracesPrime Traces SDK
Upload and query training, evaluation and inference traces through the Prime Traces service.
Install
uv add prime-traces # or: pip install prime-traces
Upload
upload_records takes JSON-compatible mappings or any object exposing
to_record() — which verifiers Trace / Episode and prime-rl Rollout
already do, so producers can hand over their own objects. Records are
serialized lazily into bounded batches, so nothing buffers the whole run or
round-trips through disk.
from prime_traces import LineFormat, TracesClient
client = TracesClient() # PRIME_API_KEY / PRIME_TRACES_URL / ~/.prime/config.json
receipts = client.upload_records(traces, context={"source": "prime-rl"})
# One complete episode per record, for multi-agent runs
receipts = client.upload_records(episodes, line_format=LineFormat.EPISODE)
# Already have a completed JSONL file, or encoded bytes?
receipts = client.upload_file("traces.jsonl", context={"source": "hosted_eval"})
receipts = client.upload_lines(encoded_lines)
Query
page = client.list(run_id="run_9f3k2m", reward_min=0.9, has_error=False)
for summary in page.items:
print(summary.trace_id, summary.score.reward)
for summary in client.iter(task_id="tb2-0187"): # paginates for you
...
# Everything one upload stored (works for list_episodes too); a large upload
# returns one receipt per batch, so pass them all
page = client.list(upload_id=[receipt.upload_id for receipt in receipts])
# Or label uploads yourself and filter on the label, across batches and files
client.upload_file("episodes.jsonl", line_format=LineFormat.EPISODE, context={"bundle": "v4"})
page = client.list_episodes(context={"bundle": "v4"})
summary = client.get(trace_id)
raw = client.get_raw(trace_id) # exact stored document
client.download_raw(trace_id, "trace.json") # streamed, for large traces
client.delete(trace_id)
client.delete_run("run_9f3k2m")
Summaries are projections of the stored document, which is kept verbatim —
fields the producer never recorded come back as None. Deleting something that
is already gone raises NotFoundError rather than passing silently.
Episodes are read-only:
page = client.list_episodes(run_id="run_9f3k2m")
detail = client.get_episode(episode_id) # + member aggregate under .traces
raw = client.get_episode_raw(episode_id) # stored envelope; traces = member IDs
members = client.list_episode_traces(episode_id, has_error=True)
get_episode_raw returns the envelope the producer uploaded (, ,
, , , every entry of ) with narrowed to member
trace IDs; read each member with .