Skip to main content

driftseer

Pre-launch release. This early version is published ahead of the full launch. See https://driftseer.dev for status.

Capture the shape and economics of an agent run (tokens, latency, status, structure), write it to a local file, and optionally upload it to the DriftSeer cloud. Zero runtime dependencies.

Your content never leaves the machine. Each finished run is one JSON packet:

  • ~/.driftseer/runs.jsonl holds exactly what the cloud receives. Never content.
  • ~/.driftseer/content.jsonl holds the same packet, plus content when you turn capture_content on. Build your own dashboard from it if you like.

Cloud upload is off until you turn it on. The line in the runs file, without its newline, is byte for byte the body that is uploaded, so you can see what is sent.

Install

pip install driftseer

Use

import driftseer

lens = driftseer.init(project="rag-agent")        # capture_content=False by default

@lens.track(model="text-embedding-3-small")
def embed(query):
    resp = client.embeddings.create(model="text-embedding-3-small", input=query)
    driftseer.record(input_tokens=resp.usage.prompt_tokens)
    return resp.data[0].embedding

@lens.track(model="gpt-4o-mini")
def answer(query, context):
    resp = client.chat.completions.create(model="gpt-4o-mini", messages=[...])
    driftseer.record(resp.usage.prompt_tokens, resp.usage.completion_tokens,
                     content={"answer": resp.choices[0].message.content})
    return resp.choices[0].message.content

@lens.track
def ask(query):                    # the outermost tracked call is the run
    driftseer.annotate(route="rag")
    result = answer(query, embed(query))
    driftseer.outcome(accepted=True)
    return result
  • @lens.track(name=None, model=None) works on functions, coroutines, generators and async generators. A stream's step stays open until the stream ends.
  • driftseer.record(input_tokens, output_tokens, content=None, model=None) reports usage for the current step. model= replaces a model chosen at decoration time.
  • driftseer.annotate(**labels) adds labels to the run's metadata. Labels are uploaded, so keep personal data out of them.
  • driftseer.outcome(accepted, wasted=[step names]) labels the run explicitly.
  • driftseer.carry(fn) keeps the run when work goes to a thread: pool.submit(driftseer.carry(worker), item).
  • Misuse (for example record() outside any tracked function) warns and is dropped. Capture never raises into your program.

Costs are not computed locally: every step carries cost null and the cloud prices it from tokens and model. Errors upload as the exception type only; with capture_content on, the message goes to the content file.

Cloud upload

driftseer cloud on --url <ingest url>   # also needs DRIFTSEER_CLOUD_KEY in the environment
driftseer cloud off
driftseer cloud status                  # switch, URL, key set or not, runs waiting/rejected

Upload needs all three: the switch on, a saved URL, and DRIFTSEER_CLOUD_KEY set. The key is never written to disk. A failed upload is resent at the next driftseer.init(), or after the next successful upload; a run the cloud refuses for good (HTTP 413 or 422) is kept in ~/.driftseer/rejected/.

Crash safety

While a run is live, each step is journaled in ~/.driftseer/inflight/. If the process dies, the next driftseer.init() on the machine delivers that run with status abandoned and every step that finished.

Files

DRIFTSEER_HOME relocates the whole folder: runs.jsonl, content.jsonl, settings.json, inflight/, rejected/.

Claude Code

python -m driftseer.otel.claude_code_tel --project claude-code --port 4318

Each Claude Code turn becomes one run, with Claude Code's own cost_usd kept. See the module docstring for the OTEL environment variables.

Metadata

Release files for driftseer 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for driftseer 0.0.1
File Size Uploaded Provenance Actions
driftseer-0.0.1.tar.gz 23.6 kB Without provenance Details for driftseer-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for driftseer 0.0.1
File Interpreter ABI Platform Actions
driftseer-0.0.1-py3-none-any.whl Python 3 none any Details for driftseer-0.0.1-py3-none-any.whl

Total release size: 48.3 kB

Release files / driftseer-0.0.1.tar.gz

Download URL driftseer-0.0.1.tar.gz
Size 23.6 kB
Tags Source
SHA-256 checksum
How to use checksums
c6c4f8846d41d440f6941112572a38fe997c89da4e76521a32cf8cf71bc3c98f
BLAKE2b-256 checksum
How to use checksums
ded2bd5fcbf6bd93c40bb9ee5df803049cf42818e439d4443386d2ef2d6064a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.0

Release files / driftseer-0.0.1-py3-none-any.whl

Download URL driftseer-0.0.1-py3-none-any.whl
Size 24.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6fc7eaedfd2d94f4a80fb1a0277aeb2cfcf45a27e91da80a7044bd2dc95eb9d1
BLAKE2b-256 checksum
How to use checksums
54a16955dc71b04fe1943b95b36621e8395101305280639dc71eef6d4e7a3877
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.0

Security for driftseer 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

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