Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

trulens-instrumentation

Skill by truera

Guides developers through instrumenting LLM apps with TruLens OTEL-based tracing. It covers setup, framework wrappers, and custom spans for evaluation and debugging.

  • Score 81
  • 3.7k stars
  • MIT
  • Updated
Works withClaude CodeClaude apps Antigravity CLI

Install trulens-instrumentation

Built from the published package, never by AI.

git clone --depth 1 https://github.com/truera/trulens /tmp/trulens && mkdir -p ~/.claude/skills && cp -r /tmp/trulens/src/core/trulens/.agents/skills/trulens-instrumentation ~/.claude/skills/trulens-instrumentation

Run in your terminal. Claude Code loads skills from ~/.claude/skills automatically.

Step-by-step: install trulens-instrumentation in Claude Code

Skills can run scripts on your machine. Some need an API key: check the README.

About

The trulens-instrumentation skill guides an assistant through instrumenting an LLM application with TruLens OTEL-based tracing. It covers initial TruSession setup and choosing a framework wrapper such as TruChain, TruGraph, TruLlama or TruLlamaWorkflow. It also covers adding custom spans with the @instrument() decorator, instrument_method() for third-party classes, and lambda-based attribute extraction.

The traces it captures are meant for evaluation with feedback functions and for debugging in the TruLens dashboard. The skill explains which span types suit each step, such as RETRIEVAL, GENERATION, TOOL, AGENT and RECORD_ROOT. The source is written for developers building RAG, agent or custom LLM apps who want clearer traces or fixes for missing attributes that break evaluations.

Written from the project's SKILL.md and checked against it.

What it can do

  • Session setupInitialize a TruSession and choose an instrumentation approach.
  • Framework wrappersWrap LangChain, LangGraph, LlamaIndex and custom apps with TruChain, TruGraph, TruLlama or TruApp.
  • Custom spansAdd @instrument() decorators with span types and attributes to your functions.
  • Third-party classesInstrument external classes you cannot edit with instrument_method().
  • Span type guidanceMap query, retrieval, generation, tool and agent steps to matching span types.
  • Lambda extractionPull complex return values into span attributes with a lambda expression.
  • Deep Agents supportInstrument LangChain Deep Agents, which are built on LangGraph, using TruGraph.
  • Feedback selector rulesExplain why TruGraph creates RECORD_ROOT spans needed for on_input and on_output.

What you need

  • Python with pip
  • trulens package
  • trulens-apps-langchain for LangChain or LangGraph
  • trulens-apps-llamaindex for LlamaIndex

Try asking

  • Instrument my LangChain chain with TruChain and add tracing
  • Add @instrument() spans to my retrieve and generate functions
  • Wrap my LangGraph agent with TruGraph so feedback works

Good to know

  • Manual AGENT spans do not work with .on_input() and .on_output() shortcuts, which need RECORD_ROOT spans.
  • The source ends mid-section in the span types and feedback selectors part, so that guidance is incomplete.
  • Framework wrappers need the matching trulens-apps package installed.

Security check

A

No download-and-run commands, hidden instructions or signs of sending keys out were found.

Checked automatically: src/core/trulens/.agents/skills/trulens-instrumentation/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work

Alternatives to trulens-instrumentation

All alternatives →

Compare with agent-reproduce-align, google_contacts or m06-error-handling

trulens-instrumentation: common questions

Which frameworks does this skill cover?

The source covers LangChain, LangGraph and LlamaIndex wrappers, plus custom apps through TruApp. Deep Agents built on LangGraph are covered through TruGraph.

Why use TruGraph instead of TruApp with @instrument?

The source says TruGraph captures all LangGraph nodes and creates the RECORD_ROOT spans needed for the .on_input() and .on_output() shortcuts.

Does it work with custom Python apps?

Yes. The source shows @instrument() on methods of a custom class, wrapped with TruApp, and instrument_method() for classes you cannot modify.

How do I install trulens-instrumentation?

Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.

Is trulens-instrumentation free?

The code is published under the MIT licence. The service it connects to may have its own pricing.

Is trulens-instrumentation safe to use?

It scores 81 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.

What are alternatives to trulens-instrumentation?

Similar skills: agent-reproduce-align, google_contacts, m06-error-handling, caveman.

trulens-instrumentation Install

Add to stack

Loading.