TruLens instruments AI apps with decorators, records OpenTelemetry spans, and scores steps with LLM judges. Teams compare app versions on quality, latency, and cost.
Overview
TruLens is an open-source toolkit for evaluating and tracing large language model applications and agents. You instrument functions with a decorator so each LLM call, retrieval, and tool use becomes a structured OpenTelemetry span. Feedback metrics—often LLM-as-judge—explain scores so failures have traceable causes instead of opaque outputs.
Tracing captures latency, inputs, outputs, tokens, and cost per step. Evaluations can run inline as traces arrive or over datasets in batch runs. Traces export to any OTLP-compatible backend such as Jaeger, Grafana Tempo, Datadog, or New Relic, so TruLens can sit alongside existing observability stacks.
Built-in evaluators target agent behavior, including tool selection, plan adherence, execution efficiency, and reasoning consistency, plus RAG-focused metrics like groundedness and context relevance. Integrations cover LangGraph, LlamaIndex, LangChain-style apps, and plain Python via the instrument API. Provider packages supply judges from OpenAI, LiteLLM, Google, Bedrock, and others.
The selector API lets teams aim metrics at specific span fields. MCP tool calls can be traced with dedicated span types. Documentation emphasizes comparing versions on a leaderboard to pick tradeoffs between quality and cost before shipping changes.
Key features
- OpenTelemetry-based tracing
- LLM-as-judge feedback metrics
- Agent-specific evaluators
- RAG triad style evaluations
- LangGraph and LlamaIndex integrations
- Batch and inline evaluation runs
- MCP tool span instrumentation
- Flexible span attribute selectors
Use cases
- Debugging failing AI agents
- Comparing RAG pipeline versions
- Exporting traces to OTLP backends
- Batch scoring on labeled datasets
- Cost-quality frontier analysis