# Repository Briefing: truera/trulens
> Source: https://repoforai.com/repo/truera/trulens (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/truera/trulens
- **Official Docs / Website**: https://www.trulens.org/
- **Category**: Agents & Frameworks (智能体与框架)
- **Primary Language**: Python
- **License**: MIT
- **Engineering Health**: A+ (91/100 · Maintenance 35/35 · Adoption 19/25 · Releases 17/20 · License 20/20)
- **Latest Release**: trulens-2.16.0 (2026-10-19) — https://github.com/truera/trulens/releases
- **Review Snapshot**: 2026-12-04
- **Deployment / Stack Signals**: Docker, CLI
- **Momentum**: 3,715 ★ total (+2 24h / +15 7d) · 423 forks
- **Topics**: `machine-learning`, `neural-networks`, `explainable-ml`, `llmops`, `ai-monitoring`, `ai-observability`, `evals`, `llm-evaluation`, `llms`, `ai-agents`, `llm-eval`, `agentops`
- **When to Use**: Best for: Python RAG and agent teams that need to pinpoint failures at individual steps, compare quality against latency and cost, and keep control of where traces go. Skip if: You need a turnkey managed platform, cannot modify application instrumentation, or only need final-answer scoring and have no use for step-level traces.

## Overview
```text
### Architecture & Core Mechanics
TruLens is a Python SDK embedded in the application, not an agent execution framework. The `@instrument` decorator turns instrumented calls into OpenTelemetry spans. Typed spans distinguish retrieval, generation, and tool calls; explicit attribute mappings can put a retrieval query and its returned contexts on the same span. OTLP export lets teams route the resulting traces to a compatible observability backend.

Evaluation is a separate layer over those records. A `Metric` pairs an implementation with `Selector` bindings that resolve its arguments from record inputs or span attributes. This is what lets a team score one retrieval context or tool step rather than pass only the final answer to a judge. LangChain/LangGraph and LlamaIndex integrations are packaged separately, as are evaluator providers. The root `pyproject.toml` uses `poetry-core` as the build backend and requires Poetry 2.0 or newer for its Poetry workflow; neither is an app-side instrumentation API.

### Key Capabilities & Differentiators
For RAG, the triad separates answer relevance, context relevance, and groundedness, which helps distinguish a retrieval miss from an answer that ignores its evidence. Seven agent evaluators cover logical consistency, execution efficiency, plan adherence, plan quality, tool selection, tool calling, and tool quality. MCP spans can capture tool names, arguments, outputs, and latency. Per-step traces and version comparisons bring scores, latency, token usage, and cost into the same investigation.

Evaluations can run alongside the app or against existing data. The table-backed `RunConfig` example maps an input column, sets separate worker limits for app invocations and metric computation, and calls `compute_metrics` on the run. Provider packages cover OpenAI/Azure OpenAI, LiteLLM, Gemini, Bedrock, Snowflake Cortex, HuggingFace, LangChain models, and the OpenAI-compatible OrcaRouter gateway. Agent GPA caught 267 of 281 human-annotated errors on TRAIL/GAIA (95%, versus 55% for the baseline trace judge); that result is a benchmark reference, not a production acceptance threshold.

### Trade-offs & Limitations
Against LangSmith, the strongest reason to pilot TruLens is control over in-process instrumentation, metric-to-span bindings, and the destination for exported traces. That flexibility creates setup work: teams must define span boundaries, verify that selectors still resolve the intended values after app changes, and own backend operations if they self-host. OTLP makes traces portable; it does not imply another backend can execute TruLens metrics or import its run workflow.

Inline judging provides earlier feedback but can add work while the app is serving requests; batch evaluation moves that work out of live traffic at the cost of delayed results. Pin judge models and rubrics for version comparisons, and calibrate against a human-reviewed sample before using scores as release gates. The MIT license permits commercial SDK use, but prompts, retrieved text, and tool arguments may be sensitive. Decide what to capture and retain, and what can be sent to a judge, before enabling broad collection.

### Hardware & Deployment Guide
Start with `pip install trulens`, then add the provider package and any framework integration the app needs. Run tracing in the Python application and configure an OTLP destination if you want external export, such as to Jaeger or Grafana Tempo. Budget provider credentials, network access, and rate limits separately from trace ingestion. Running a batch after collection does not make it network-free if the metric calls a hosted judge; there is no universal GPU or VRAM requirement.

For upgrades, 2.14 added coding-agent instrumentation for Claude Code and Cursor workflows. Version 2.15 improved cross-HTTP trace continuity and preservation of GenAI message content across persistence and export. Version 2.16 adds metrics and Jury reliability metadata, improves handling of unparsable judge scores, and fixes cost accounting, batch evaluation, and tracing issues. It also removes Streamlit-in-Snowflake dashboard support, so teams using that dashboard need a replacement before upgrading.
```

## Key Capabilities
```text
- Trace semantics: OpenTelemetry spans distinguish generation, retrieval, and tool calls, with OTLP export to compatible backends.
- Metric inputs: Selectors bind evaluator arguments to record inputs or span attributes, including individual retrieved contexts.
- Agent diagnosis: Seven evaluators distinguish reasoning consistency, execution efficiency, plan quality and adherence, and three aspects of tool use.
- Batch control: `RunConfig` exposes separate `invocation_max_workers` and `metric_max_workers` settings.
- MCP visibility: The `MCP` span type can capture tool name, arguments, output, and latency.
- Upgrade boundary: 2.16 adds Jury reliability metadata and removes Streamlit-in-Snowflake dashboard support.
```

## Quick Start / Clone
```bash
pip install trulens
```
