skillfed

trulens-core

Library to systematically track and evaluate LLM based applications.

trulens-core v2.13.0 126.1K downloads/30d#11,789 on PyPI3,508
Permissive license MIT Active released

What it is and what it does

TruLens is an instrumentation and evaluation framework for LLM-based applications built on OpenTelemetry. It decorates functions to capture structured traces of every step—retrieval, LLM calls, tool invocations—recording latency, tokens, and cost per operation. Once traces are collected, the package evaluates them using LLM judges that score and explain their reasoning, enabling you to identify where applications fail, compare versions, and measure quality tradeoffs against cost.

The package ships with seven agentic evaluators (LogicalConsistency, ExecutionEfficiency, PlanAdherence, ToolSelection, and others) and supports both inline evaluation as your app runs and batch evaluation over pre-collected datasets. Because tracing is OpenTelemetry-native, traces are portable to any OTLP-compatible backend—Jaeger, Grafana Tempo, Datadog—making it interoperable with existing observability infrastructure. Runtime dependencies include SQLAlchemy for storage, Pydantic for validation, and OpenTelemetry libraries for instrumentation.

Use it for:

  • Instrument a RAG pipeline to trace retrieval, ranking, and generation steps, then score groundedness and context relevance per query.
  • Compare two versions of an agent by running both against a dataset and measuring latency, token cost, and evaluation scores side-by-side.
  • Debug agent failures by examining structured traces that show which tool was called, what arguments were passed, and where reasoning broke down.
  • Evaluate agentic systems for plan quality and tool selection by running purpose-built judges that flag redundant steps or incorrect tool choices.
  • Export traces to an existing observability backend (Datadog, Grafana) while running evaluations in TruLens without duplicating instrumentation.
  • Batch-evaluate a historical dataset of app runs using the Run API to compute metrics offline and identify systematic quality issues.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Instruments LLM applications with OpenTelemetry-native tracing and evaluates them with LLM-based judges that explain their reasoning, capturing latency, cost, and quality per step.

Yes. TruLens is actively maintained, has no known vulnerabilities, and solves a real problem for LLM application teams: making agent behavior traceable and measurable. The OpenTelemetry foundation ensures portability, and the built-in evaluators are benchmarked against human annotations. Install it if you need to instrument and evaluate LLM apps; skip it if you only need basic logging.

Install

trulens-core on PyPI

pip

pip install trulens-core

uv

uv add trulens-core

poetry

poetry add trulens-core

Installing trulens-core

Before you install

Low friction: pure Python wheel with 19 runtime dependencies including well-established libraries like SQLAlchemy, Pydantic, and OpenTelemetry. Active maintenance with release on 2026-08-14 and 3508 GitHub stars.

License in practice

MIT license permits commercial and private use with minimal restrictions; suitable for most projects.

Quickstart

pip install trulens-core

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.9 or later; LLM provider packages (e.g., trulens-providers-openai) must be installed separately for feedback evaluation.

Verify before relying

  • Whether the package works with Python 3.14 in practice, given it is marked as Alpha status.
  • Performance characteristics when evaluating large-scale batch runs with the Run API.
  • Compatibility with OTLP backends beyond those mentioned (Jaeger, Grafana Tempo, Datadog).

Package facts

License MIT (permissive)
Python support supports the current Python release (<4.0,>=3.9)
Install friction low — pure-Python wheel
Runtime dependencies 19 — alembic, dill, importlib-resources, munch, nest-asyncio, numpy, opentelemetry-api, opentelemetry-proto, opentelemetry-sdk, packaging, pandas, pydantic, python-dotenv, requests, rich, sqlalchemy, trulens-otel-semconv, typing_extensions, wrapt
Maintenance actively maintained — 0 days since the last release
Last repo commit
First released
Downloads 126,116/month — #11,789 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: trulens_core-2.13.0-py3-none-any.whl

Development Status :: 3 - AlphaLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9

Tags

llm application tracing and evaluationopentelemetry instrumentation for agentsrag evaluation and monitoringllm judge feedback functionsagent performance debuggingtrace-based cost and quality analysisagentic system evaluation
llm-evaluationobservabilityagent-debugging

More Quality Assurance packages

coverage

Coverage.py measures which lines of Python code…

permissive · top 1,000 on PyPI

ruff

Ruff is a Python linter and code formatter…

permissive · top 1,000 on PyPI

pexpect

Pexpect spawns and controls interactive console…

permissive · top 1,000 on PyPI

black

Black reformats Python source code to a…

permissive · top 1,000 on PyPI

pytest-xdist

pytest-xdist distributes pytest tests across…

permissive · top 1,000 on PyPI

cfn-lint

Validates AWS CloudFormation templates in YAML…

permissive · top 1,000 on PyPI

trulens

TruLens instruments LLM applications to trace…

permissive · top 15,000 on PyPI

judgeval

Judgeval is an SDK for tracing and evaluating…

permissive · top 15,000 on PyPI

cleanlab-tlm

Cleanlab TLM scores the trustworthiness of LLM…

permissive · top 15,000 on PyPI

ragas

Ragas provides objective metrics, test data…

permissive · top 5,000 on PyPI

opentelemetry-instrumentation-openai-agents

Adds distributed tracing to OpenAI Agents…

permissive · top 5,000 on PyPI

opentelemetry-instrumentation-remoulade

Adds distributed tracing instrumentation for…

permissive · top 5,000 on PyPI

azure-core-tracing-opentelemetry

Integrates Azure SDK clients with OpenTelemetry…

unclear · top 5,000 on PyPI

opentelemetry-instrumentation-sklearn

Adds distributed tracing instrumentation to…

permissive · top 15,000 on PyPI

opentelemetry-instrumentation-celery

Adds distributed tracing and observability to…

permissive · top 5,000 on PyPI

opentelemetry-instrumentation-llamaindex

Adds distributed tracing to LlamaIndex…

permissive · top 5,000 on PyPI