Lightweight LLM observability. Zero infrastructure.
One SQLite file. One pip install. Full tracing for any LLM application.
pip install llmtracex
Why llm-trace?
| Feature | Langfuse | LangSmith | llm-trace |
|---|---|---|---|
| Setup | Docker + PostgreSQL + Redis | Cloud account | pip install llmtracex |
| Infrastructure | 4 services | Managed | Zero |
| Storage | ClickHouse | Cloud | SQLite |
| Dependencies | Many | Many | Zero |
| Dashboard | Yes | Yes | Built-in (:7600) |
| Cost | Free/Paid | Paid | Free forever |
Quick Start
1. Decorate any function
from llm_trace import observe
@observe()
def my_pipeline(query: str) -> str:
docs = retrieve(query)
return generate(query, docs)
2. Wrap OpenAI / Anthropic SDKs
from llm_trace.wrappers import wrap_openai
import openai
client = wrap_openai(openai.OpenAI())
# Every call is traced automatically — tokens, cost, latency
response = client.chat.completions.create(model="gpt-4o", messages=[...])
3. LangChain / LangGraph (recommended)
from llm_trace.langchain import CallbackHandler
handler = CallbackHandler(trace_name="my-agent", session_id="chat-123")
result = graph.invoke(input, config={"callbacks": [handler]})
handler.flush()
# 1 invoke = 1 trace. All nodes captured automatically.
4. OpenTelemetry (LlamaIndex, Haystack, CrewAI, DSPy...)
from llm_trace.otel import install_otel
install_otel(instrumentors=["llama_index", "haystack"])
# Any OTEL-instrumented framework is now traced
5. Webhook (any language)
curl -X POST http://localhost:7601/api/ingest \
-H "Content-Type: application/json" \
-d '{"trace":{"name":"from-curl"}, "observations":[{"type":"generation","model":"gpt-4o","usage":{"input_tokens":100,"output_tokens":50}}]}'
6. Scores
from llm_trace import score
score("quality", 0.92, trace_id=handler.get_trace_id())
Dashboard
llm-trace dashboard
# or
python -c "from llm_trace import tracer; tracer.dashboard()"
# Custom port
llm-trace dashboard --port 8080
llm-trace dashboard -p 3000 --no-browser
Opens http://localhost:7600 with:
- Overview with tokens/cost/latency charts over time
- Trace list with search and filtering
- Tree view with expandable observations
- Graph view showing execution flow
- Per-trace stats (tokens, cost, latency, status)
- Delete individual traces or clear all
CLI
llm-trace stats # Summary
llm-trace list # Recent traces
llm-trace show <trace-id> # Detail view
llm-trace dashboard # Web UI
llm-trace clear # Delete all
llm-trace export > traces.json # Export
Architecture
┌─────────────┬──────────────┬───────────────┬──────────────┐
│ @observe() │ wrap_openai()│ CallbackHandler│ install_otel()│
│ any func │ wrap_anthropic│ LangChain/LG │ OTEL spans │
├─────────────┴──────────────┴───────────────┴──────────────┤
│ Tracer (singleton) │
│ background flush, contextvars │
├───────────────────────────────────────────────────────────┤
│ SQLite WAL (~/.llm-trace/) │
│ traces → observations → scores │
├───────────────────────────────────────────────────────────┤
│ Dashboard (:7600) │ CLI │ Webhook (:7601) │
└───────────────────────────────────────────────────────────┘
Data Model
Follows the Langfuse data model:
- Trace — one execution (1
graph.invoke()= 1 trace) - Observation — a step within a trace (generation, tool, retriever, agent, span, guardrail, embedding, event)
- Score — evaluation metric attached to a trace
Configuration
# Database location (default: ~/.llm-trace/traces.db)
export LLM_TRACE_DB_PATH=./my-traces.db
# Environment tag
export LLM_TRACE_ENVIRONMENT=production
# Release version
export LLM_TRACE_RELEASE=v1.2.3
Optional Dependencies
pip install llmtracex # Zero deps, @observe + wrappers + CLI
pip install llmtracex[langchain] # + LangChain CallbackHandler
pip install llmtracex[langgraph] # + LangChain + LangGraph
pip install llmtracex[otel] # + OpenTelemetry SpanProcessor
pip install llmtracex[webhook] # + FastAPI webhook router
pip install llmtracex[all] # Everything
License
MIT
Metadata
Release files for llmtracex 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| llmtracex-0.2.0.tar.gz | 42.0 kB | Without provenance | Details for llmtracex-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| llmtracex-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for llmtracex-0.2.0-py3-none-any.whl |
Total release size: 88.8 kB
Release files / llmtracex-0.2.0.tar.gz
| Download URL | llmtracex-0.2.0.tar.gz |
|---|---|
| Size | 42.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8f073d5a5a1348906b2f7fb867826be13c273a0ab03303d6248fe40b72765e32
|
|
BLAKE2b-256 checksum How to use checksums |
4dd0432d7eaf5412fee675144fe643c40a78dc9ffed8c65c0a0141510749dccb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / llmtracex-0.2.0-py3-none-any.whl
| Download URL | llmtracex-0.2.0-py3-none-any.whl |
|---|---|
| Size | 46.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a1e2352517ecaaba8103940e1472631fc97b24d9a9ee04eedf29c12b34c348cd
|
|
BLAKE2b-256 checksum How to use checksums |
3d260e703dbba1ef3d0c6a9ff85cf1a39e2bbeb7b1c5e84525d053a471e93186
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Security for llmtracex 0.2.0
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.