TruLens: OpenTelemetry-Native Evaluation for LLM Agents
Project brief: Evaluation and Tracking for LLM Experiments and AI Agents. Tracing is OpenTelemetry-native, so a trace is portable to any OTLP backend, and evaluations run either as traces land or over a dataset after the fact.
At a glance
- What is it?
- TruLens instruments LLM apps with OpenTelemetry spans, scores every step with LLM judges, and compares versions by quality and cost. This review covers its mechanism, setup, limitations, and alternatives.
- Who is it for?
- Adopt TruLens if you need OpenTelemetry-native tracing plus LLM-judge evaluations in one tool, especially for RAG or agentic systems where cost and quality tradeoffs matter. Do not adopt it if you want a fully managed platform, need no-code setup, or require a specific provider not in the supported list.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 3 days ago.
- What is it written in?
- Mainly Python, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on September 15, 2026, and from our analysis. They are not legal advice.
DEEP OPEN-SOURCE ANALYSIS
What TruLens Solves and Who It Is For
TruLens addresses a specific pain: when an LLM application returns a bad answer, you often cannot tell which step caused it. The README frames this as replacing a "vibe" with a traceable cause. It records latency, inputs, outputs, tokens, and cost per step, then scores those steps with LLM judges that explain themselves. The target user is an engineer building RAG pipelines or agentic systems in Python who needs both tracing and evaluation without stitching together separate tools. It is not for someone who wants a hosted dashboard with zero infrastructure work, because TruLens is a library you install and integrate into your code. The project's own marketing says it finds where your agent fails and where you can cut cost without losing quality, which suggests a focus on production tuning rather than just debugging.
The OpenTelemetry Mechanism Under the Hood
The core mechanism is OpenTelemetry-native tracing. Every function call, LLM generation, retrieval, and tool invocation becomes a structured OTEL span. You annotate methods with the `@instrument` decorator, specifying a span type and attributes. The README shows a retrieval method decorated with `span_type=SpanAttributes.SpanType.RETRIEVAL` and attributes for query text and retrieved contexts. This design means traces are portable to any OTLP backend: Jaeger, Grafana Tempo, Datadog, or others. That portability is a real advantage over tools that lock you into a proprietary trace format. The span attributes follow a semantic convention defined in `trulens.otel.semconv.trace`, which gives you a standardized way to mark span types like RETRIEVAL or MCP. Evaluations can run inline as traces land, or in batch over a dataset after the fact. This dual mode is useful: you can catch problems live during a demo, then run a full evaluation over a stored dataset without replaying the app.
Installation and Getting a RAG Instrumented
Installation is straightforward via pip. The base package is `trulens`, but you usually add a provider package and an app framework integration. The README gives these commands: `pip install trulens trulens-providers-openai` for OpenAI, or `trulens-providers-litellm` for Anthropic, Cohere, Mistral, and others. For LangChain or LlamaIndex, you add `trulens-apps-langchain` or `trulens-apps-llamaindex`. The quickstart is a Colab notebook linked from the README, which is the fastest way to see a working example. To instrument a custom RAG, you decorate methods with `@instrument` and set span attributes. For evaluation, you define a `Metric` with selectors. The README shows a context relevance metric that selects the record input and the context. Batch evaluation uses the Run API: you create a `RunConfig` with a run name, dataset name, source type, and worker counts, then call `add_run`, `start`, and `compute_metrics`. The configuration keys are explicit: `invocation_max_workers` and `metric_max_workers` control parallelism. This setup requires you to write code; there is no CLI or YAML config file mentioned.
Agentic Evaluators: Seven Specific Judges
TruLens includes seven purpose-built evaluators for agentic systems, each measuring a distinct aspect. The README lists LogicalConsistency for reasoning coherence and hallucination flags, ExecutionEfficiency for redundant steps and wasted computation, PlanAdherence for whether execution followed the plan, PlanQuality for intrinsic plan strategy, ToolSelection for choosing the right tool, ToolCalling for argument validity, and ToolQuality for external tool reliability. This is a concrete set, not a single generic score. The distinction between PlanAdherence and PlanQuality is worth noting: one checks if the agent did what it said, the other judges whether the plan itself was sound. That separation is useful for debugging, because a failure can be a planning failure or an execution failure. The README claims these judges are graded against human annotations, with a 95% agent error detection rate on TRAIL/GAIA, but that is a benchmark result, not a guarantee for your domain. You should treat these evaluators as starting points, not final truth.
Selector API and MCP Support: Targeting the Right Spans
The Selector API lets you target any span attribute for evaluation. The example defines a `Metric` with a name, an implementation (the provider's context relevance function), and selectors that map an input key to the record input and a context key to the retrieved contexts. This is a flexible mechanism, but it requires you to understand the span structure of your app. If you do not know which attributes hold the query or the retrieved contexts, you will have to inspect your traces first. The MCP support is a newer addition: you can decorate a tool call with `span_type=SpanAttributes.SpanType.MCP` to capture tool name, arguments, output, and latency. This is relevant if you are building agents that use MCP servers. The README shows a minimal decorator example, but it does not explain how MCP spans interact with the seven agentic evaluators. That gap means you may need to experiment to see if ToolSelection or ToolCalling work on MCP spans out of the box.
Limitations and Wrong-Tool Cases
The most obvious limitation is that TruLens is a Python library. If your app is in JavaScript, Go, or another language, this is not the tool. Even within Python, the README only shows explicit integrations for LangChain and LlamaIndex. Custom apps require manual decorator work, which is more effort than a framework that auto-instruments everything. Another limitation is the dependency on external LLM providers for feedback evaluation. You must install a provider package, and the evaluation quality depends on the judge model you choose. The README's benchmark scores are impressive, but they are tied to specific datasets and models; your results will vary. The batch Run API requires a dataset table with a source type and spec, which implies you need a database setup, not just a CSV file. The README does not mention a built-in vector store or UI, so you may need to build your own dashboard for viewing results. If you want a zero-code SaaS solution, TruLens will feel heavy.
Alternatives: RAGAS, DeepEval, and the Difference
The README itself names three alternatives in its benchmark table: RAGAS, DeepEval, and UpTrain. The key difference is the OpenTelemetry foundation. RAGAS and DeepEval are primarily evaluation frameworks; they focus on metrics and datasets, not on tracing. TruLens makes tracing the backbone, so you get spans that are portable to any OTLP backend. That means you can keep using your existing observability stack (Jaeger, Datadog) and still get evaluation scores attached to those spans. RAGAS, for example, typically works with your own retrieval results and does not force a specific trace format. DeepEval offers a similar metric suite but its tracing story is not OpenTelemetry-native, according to the README's comparison context. If you already have a tracing solution and only need evaluation, a lighter tool like RAGAS might be simpler. If you need both tracing and evaluation in one place, TruLens saves you from integrating two systems.
Maintenance, License, and Upgrade Considerations
The repository is actively maintained, with the latest release 2.13.1 pushed on 2026-08-20, and previous releases in August 2026. That cadence suggests a healthy project, but you should check the changelog for breaking changes between minor versions. The license is MIT, which is permissive for commercial use, but that does not cover the LLM providers you call; those have their own terms. The README does not mention a migration guide or upgrade path, so moving from 2.11 to 2.13 might require checking release notes yourself. The project is not archived, which is a positive signal. Maintenance cost includes keeping up with new provider packages and the core library. Because the instrumentation relies on decorators, changes to your app code will affect spans, so you need to re-test after refactors. The README's benchmark claims are dated, so you should verify those numbers against the current version before relying on them.
Editorial conclusion
Adopt TruLens if you need OpenTelemetry-native tracing plus LLM-judge evaluations in one tool, especially for RAG or agentic systems where cost and quality tradeoffs matter. Do not adopt it if you want a fully managed platform, need no-code setup, or require a specific provider not in the supported list. Before committing, verify that the current version supports your chosen LLM provider and app framework (LangChain, LlamaIndex, or custom), and test the evaluator accuracy on your own data, since the README's headline scores come from specific benchmarks like TRAIL/GAIA and LLM-AggreFact, not your workload.
Community notes