Skip to main content

Decorator-based LLM tracing package with OpenAI and Anthropic client instrumentation.

Project description

freesolo

freesolo is a Python tracing package for the Reinforcement Labs app.

It is designed for the lowest-friction integration possible:

  1. Install the package
  2. Configure one endpoint + API key
  3. Start a trace once
  4. Add @trace() to your functions
  5. Optionally wrap your OpenAI, Anthropic, or Google client for automatic provider spans

Install

cd tracing
uv sync

To run the bundled example apps:

cd tracing
uv sync --extra examples

Environment

The package reads these environment variables by default:

  • FREESOLO_BASE_URL
  • FREESOLO_API_KEY

The frontend app must also have:

  • FREESOLO_API_KEY
  • SUPABASE_SECRET_KEY

The canonical database schema lives in frontend/supabase/migrations/. There is no separate tracing-side migration folder because both the ingest API and the Supabase project are owned by the frontend app in this repo.

Runnable examples live in examples/. They will autoload env vars from frontend/.env, tracing/.env, or tracing/examples/.env.

Quickstart

from openai import OpenAI
from freesolo import configure, instrument_openai, start_trace, trace

configure(
    base_url="https://your-app.com",
    api_key="freesolo_api_key",
)

client = instrument_openai(OpenAI())

@trace()
def run_agent(question: str) -> str:
    result = client.chat.completions.create(
        model="gpt-4.1",
        messages=[
            {"role": "user", "content": question},
        ],
    )
    return result.choices[0].message.content or ""


with start_trace("support-agent-run"):
    print(run_agent("How do I reset my password?"))

What Gets Stored

  • Trace metadata if you explicitly pass it to start_trace(..., metadata=...)
  • Spans from decorators
  • OpenAI / Anthropic / Google request + response payloads
  • Token usage when available
  • Image inputs summarized safely instead of storing full base64 blobs

Notes

  • If you do nothing except add @trace(), you still get useful spans.
  • Use start_trace(trace_id=...) when you want several decorated functions to land in one trace.
  • If you also wrap the LLM client, you get dedicated provider/model spans.
  • Delivery is best-effort by default. Trace ingestion failures do not break your app.

Project details


Download files

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

Source Distribution

freesolo-0.1.0.tar.gz (37.6 kB view details)

Uploaded Source

Built Distribution

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

freesolo-0.1.0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file freesolo-0.1.0.tar.gz.

File metadata

  • Download URL: freesolo-0.1.0.tar.gz
  • Upload date:
  • Size: 37.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for freesolo-0.1.0.tar.gz
Algorithm Hash digest
SHA256 87f29d18a1c7a2244d43c01cbecf9c345475ae53595968918e7e2790ca36eb56
MD5 5b9db99a8d4d6a6d3ab9423c99013edd
BLAKE2b-256 e68b91f7ca85ade02c4358c13c1af452116c887aad65c6d24d05a85d83ed8e33

See more details on using hashes here.

File details

Details for the file freesolo-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: freesolo-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for freesolo-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 273e3e4ee785ab753da5d44bf8579129ba8d98ac0408af12a9cc23e61b2d1a82
MD5 53bc9c0f33826d21a10d2d7f5d81d5a4
BLAKE2b-256 91f6cf9b4560ccd32af74c697a3b8bce80cdb63c5a67993516d9527e654cbcd2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page