Skip to main content

Prime Traces SDK

Upload and query training, evaluation and inference traces through the Prime Traces service.

⚠️ Prime Traces is in closed beta. Access is granted per account, and the service is not yet on a public URL.

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
    ...

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
members = client.list_episode_traces(episode_id, has_error=True)

Async

AsyncTracesClient mirrors TracesClient method for method.

import asyncio
from prime_traces import AsyncTracesClient

async def main():
    async with AsyncTracesClient() as client:
        await client.upload_records(traces, context={"source": "prime-rl"})

        page, episodes = await asyncio.gather(   # reads overlap
            client.list(run_id="run_9f3k2m"),
            client.list_episodes(run_id="run_9f3k2m"),
        )

        async for summary in client.iter(task_id="tb2-0187"):
            ...

asyncio.run(main())

Configuration

Source Meaning
PRIME_API_KEY Platform API token, needs traces:read / traces:write scopes
PRIME_TRACES_URL Base URL of the Prime Traces service; defaults to https://prime-traces.pintel.dev
PRIME_TEAM_ID Optional team context, sent as X-Prime-Team-ID
~/.prime/config.json Shared prime CLI config (api_key, team_id, traces_url)

Precedence is constructor argument → environment variable → config file.

Not yet available

  • Exports — the service route exists but is unimplemented, so wrapping it would ship a method that cannot succeed.
  • Search and free-text queries.

Examples

The runnable basic_usage.py example covers upload, query, downloads and error handling.

Related packages

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

prime_traces-0.0.4.tar.gz (50.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

prime_traces-0.0.4-py3-none-any.whl (38.4 kB view details)

Uploaded Python 3

File details

Details for the file prime_traces-0.0.4.tar.gz.

File metadata

  • Download URL: prime_traces-0.0.4.tar.gz
  • Upload date:
  • Size: 50.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for prime_traces-0.0.4.tar.gz
Algorithm Hash digest
SHA256 713b59984292304bd4e99a55998b7d69373f22b5205a7e097ef0d0d8e531561c
MD5 81fce3c7837578ec6c05107c18f73590
BLAKE2b-256 5f5dd3646fb34d4f3cf4caf2064eb3830c4da5c18a3ecd3292ce9e85eb04398f

See more details on using hashes here.

Provenance

The following attestation bundles were made for prime_traces-0.0.4.tar.gz:

Publisher: release-traces.yml on PrimeIntellect-ai/prime

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file prime_traces-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: prime_traces-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 38.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for prime_traces-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 68f2b527d266f9c3d02f6c86a1713309a58a61b81e1be6be43948e1dd2456d8f
MD5 24f489ad745da018ccef775e8655aae6
BLAKE2b-256 b655de30cc732631522f5f12cb590b63b80cb1c6ca004ad81762d94ee7dda256

See more details on using hashes here.

Provenance

The following attestation bundles were made for prime_traces-0.0.4-py3-none-any.whl:

Publisher: release-traces.yml on PrimeIntellect-ai/prime

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page