trulens
Library to systematically track and evaluate LLM based applications.
What it is and what it does
TruLens is an open-source library for systematically tracing and evaluating LLM-based applications. It uses OpenTelemetry-native instrumentation to capture every function call, LLM generation, retrieval, and tool invocation as structured spans, then scores outputs using LLM judges that explain their reasoning. The core workflow is: decorate your app functions with the @instrument decorator, run queries or batch datasets through your app, collect traces and evaluation scores, then compare versions to identify which performs best on the tradeoff between quality and cost.
The package bundles five internal components (trulens-core, trulens-dashboard, trulens-feedback, trulens-otel-semconv, trulens_eval) and is designed to integrate with existing observability infrastructure via OTLP backends. It includes evaluators for agentic systems and supports both inline evaluation (as the app runs) and offline batch evaluation over pre-collected datasets. Additional LLM provider packages and app framework integrations are installed separately.
Use it for:
- Trace retrieval latency and token usage in a RAG pipeline to identify cost-quality tradeoffs.
- Evaluate agent reasoning chains step-by-step to catch logical inconsistencies and tool-selection errors.
- Compare two versions of an LLM application on a fixed dataset using batch evaluation.
- Export traces to an OTLP backend to correlate LLM behavior with infrastructure metrics.
- Score context relevance and groundedness of RAG outputs using LLM judges.
- Capture Model Context Protocol tool calls with structured spans to debug agentic workflows.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
TruLens instruments LLM applications to trace execution step-by-step, evaluate outputs with LLM-based judges, and compare versions to identify failures and cost-quality tradeoffs.
Yes. TruLens is actively maintained, has low install friction, carries a permissive MIT license, and solves a concrete problem—systematic tracing and evaluation of LLM applications—that most LLM teams face. It is adopted by major organizations and integrates with standard observability infrastructure. Install it if you need to debug agent failures, compare LLM app versions, or measure quality-cost tradeoffs.
Install
trulens on PyPI
pip
pip install trulensuv
uv add trulenspoetry
poetry add trulensInstalling trulens
Before you install
Low friction: pure Python wheel with five internal runtime dependencies (trulens-core, trulens-dashboard, trulens-feedback, trulens-otel-semconv, trulens_eval). Active maintenance as of 2026-08-14 with 3508 GitHub stars.
License in practice
MIT license (permissive) allows commercial and private use with minimal restrictions—suitable for production deployment in most organizational contexts.
Quickstart
pip install trulens
from trulens.core.otel.instrument import instrument
from trulens.otel.semconv.trace import SpanAttributes
class MyRAG:
@instrument(
span_type=SpanAttributes.SpanType.RETRIEVAL,
attributes={
SpanAttributes.RETRIEVAL.QUERY_TEXT: "query",
SpanAttributes.RETRIEVAL.RETRIEVED_CONTEXTS: "return",
},
)
def retrieve(self, query: str) -> list:
pass
Requires Python 3.10 or later; LLM provider packages must be installed separately for feedback evaluation.
Verify before relying
- Whether the seven agentic evaluators are available in the base package or distributed across the five runtime dependencies.
- Whether the Run API for batch evaluation and Selector API are part of core or split across dependencies.
- Performance characteristics and latency overhead of inline vs. batch evaluation on large datasets.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (<4.0,>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 5 — trulens-core, trulens-dashboard, trulens-feedback, trulens-otel-semconv, trulens_eval |
| Maintenance | actively maintained — 0 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 107,852/month — #12,591 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: trulens-2.13.0-py3-none-any.whl
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
judgevalJudgeval is an SDK for tracing and evaluating…
permissive · top 15,000 on PyPI
trulens-coreInstruments LLM applications with…
permissive · top 15,000 on PyPI
ragasRagas provides objective metrics, test data…
permissive · top 5,000 on PyPI
cleanlab-tlmCleanlab TLM scores the trustworthiness of LLM…
permissive · top 15,000 on PyPI
opikOpik is an open-source LLM observability and…
permissive · top 5,000 on PyPI
lmnrPython SDK that traces, evaluates, and analyzes…
permissive · top 1,000 on PyPI
opentelemetry-instrumentation-llamaindexAdds distributed tracing to LlamaIndex…
permissive · top 5,000 on PyPI
opentelemetry-instrumentation-openai-agentsAdds distributed tracing to OpenAI Agents…
permissive · top 5,000 on PyPI
evidentlyEvidently evaluates, tests, and monitors ML and…
permissive · top 5,000 on PyPI
weaveWeave is a toolkit for tracing, logging, and…
permissive · top 5,000 on PyPI