Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
mlflow avatar

Instrumenting With Mlflow Tracing

  • 563 installs
  • 66 repo stars
  • Updated July 30, 2026
  • mlflow/skills

instrumenting-with-mlflow-tracing is a coding-agent skill that instruments Python and TypeScript LLM applications with MLflow Tracing autolog, experiment tracking, and span verification for developers who need reproducib

About

instrumenting-with-mlflow-tracing is an MLflow-maintained agent skill in the mlflow/skills repository that walks coding agents through a four-step instrumentation workflow: detect the LLM framework, add the correct autolog call, configure experiment tracking, and verify spans, inputs, outputs, and latency in the MLflow UI. The skill targets Python and TypeScript GenAI apps using OpenAI, Anthropic, LangChain, LangGraph, LiteLLM, and related stacks, with reference patterns for async tracing, multi-thread context propagation, PII redaction, sampling, and production deployment. Developers reach for it when debugging agent chains, comparing prompt experiments, or preparing LLM apps for evaluation. Install via `npx skills add mlflow/skills`; the repo also ships companion skills for trace analysis, chat-session debugging, and trace retrieval. MLflow documents a production-focused mlflow-tracing SDK that reduces install footprint versus the full mlflow package while preserving tracing capabilities.

  • Span and trace decorators
  • LLM and tool call capture
  • Experiment and run linkage
  • Latency and token metadata
  • Local and remote tracking server setup

Instrumenting With Mlflow Tracing by the numbers

  • 563 all-time installs (skills.sh)
  • +43 installs in the week ending Aug 4, 2026 (Skillselion tracking)
  • Ranked #424 of 2,064 Data Science & ML skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/mlflow/skills --skill instrumenting-with-mlflow-tracing

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs563
repo stars66
Last updatedJuly 30, 2026
Repositorymlflow/skills

How do you add MLflow tracing to LLM apps?

Add MLflow tracing to LLM chains, model calls, and pipelines so spans, inputs, outputs, and latency are captured for debugging and experiment comparison.

Who is it for?

Backend and ML engineers shipping Python or TypeScript LLM agents who need structured trace capture before debugging or evaluation runs.

Skip if: Teams only browsing existing traces in MLflow UI without changing application code, or projects using unrelated observability stacks exclusively.

When should I use this skill?

User asks to add MLflow tracing, instrument an LLM chain, enable agent observability, or verify spans for OpenAI, LangChain, or LiteLLM code.

What you get

Instrumented codebase with MLflow autolog calls, configured experiment tracking, and verified trace spans showing inputs, outputs, and latency.

  • Autolog instrumentation patches
  • Experiment tracking configuration
  • Verified MLflow trace spans

By the numbers

  • Follows a four-step detect-autolog-configure-verify instrumentation workflow
  • Supports OpenAI, Anthropic, LangChain, LangGraph, and LiteLLM integrations
  • mlflow/skills bundles at least four related MLflow observability skills

Files

SKILL.mdMarkdownGitHub ↗

MLflow Tracing Instrumentation Guide

Language-Specific Guides

Based on the user's project, load the appropriate guide:

  • Python projects: Read references/python.md
  • TypeScript/JavaScript projects: Read references/typescript.md

If unclear, check for package.json (TypeScript) or requirements.txt/pyproject.toml (Python) in the project.

---

What to Trace

Trace these operations (high debugging/observability value):

Operation TypeExamplesWhy Trace
Root operationsMain entry points, top-level pipelines, workflow stepsEnd-to-end latency, input/output logging
LLM callsChat completions, embeddingsToken usage, latency, prompt/response inspection
RetrievalVector DB queries, document fetches, searchRelevance debugging, retrieval quality
Tool/function callsAPI calls, database queries, web searchExternal dependency monitoring, error tracking
Agent decisionsRouting, planning, tool selectionUnderstand agent reasoning and choices
External servicesHTTP APIs, file I/O, message queuesDependency failures, timeout tracking

Skip tracing these (too granular, adds noise):

  • Simple data transformations (dict/list manipulation)
  • String formatting, parsing, validation
  • Configuration loading, environment setup
  • Logging or metric emission
  • Pure utility functions (math, sorting, filtering)

Rule of thumb: Trace operations that are important for debugging and identifying issues in your application.

---

Verification

After instrumenting the code, always verify that tracing is working.

Planning to evaluate your agent? Tracing must be working before you run agent-evaluation. Complete verification below first.

1. Run the instrumented code — execute the application or agent so that at least one traced operation fires 2. Confirm traces are logged — use mlflow.search_traces() or MlflowClient().search_traces() to check that traces appear in the experiment:

import mlflow

traces = mlflow.search_traces(experiment_ids=["<experiment_id>"])
print(f"Found {len(traces)} trace(s)")
assert len(traces) > 0, "No traces were logged — check tracking URI and experiment settings"

3. Verify spans were captured — confirm the trace contains the expected spans, not just an empty shell:

trace = traces.iloc[0]
spans = mlflow.get_trace(trace.trace_id).data.spans
print(f"Trace has {len(spans)} span(s)")
for span in spans:
    print(f"  - {span.name} ({span.span_type})")

4. Report the result — tell the user how many traces and spans were found and confirm tracing is working

If no traces appear

Check these in order:

  • Tracking URI not set — is mlflow.set_tracking_uri(...) called before the agent run? Without this, traces go to a local ./mlruns directory instead of the configured server.
  • Autolog warnings — did mlflow.autolog() or framework-specific mlflow.<framework>.autolog() raise any warnings during setup? Check stderr for patching failures.
  • Wrong experiment ID — verify the experiment ID passed to search_traces() matches the experiment active when the code ran (mlflow.get_experiment_by_name(...) to confirm).
  • Network/auth issues — can the process reach the tracking server? Check for connection errors or 401/403 responses in logs.

For automated validation, use agent-evaluation/scripts/validate_tracing_runtime.py.

---

Feedback Collection

Log user feedback on traces for evaluation, debugging, and fine-tuning. Essential for identifying quality issues in production.

See references/feedback-collection.md for:

  • Recording user ratings and comments with mlflow.log_feedback()
  • Capturing trace IDs to return to clients
  • LLM-as-judge automated evaluation

---

Reference Documentation

Production Deployment

See references/production.md for:

  • Environment variable configuration
  • Async logging for low-latency applications
  • Sampling configuration (MLFLOW_TRACE_SAMPLING_RATIO)
  • Lightweight SDK (mlflow-tracing)
  • Docker/Kubernetes deployment

Advanced Patterns

See references/advanced-patterns.md for:

  • Async function tracing
  • Multi-threading with context propagation
  • PII redaction with span processors

Distributed Tracing

See references/distributed-tracing.md for:

  • Propagating trace context across services
  • Client/server header APIs

Related skills

How it compares

Pick this over generic logging skills when you need MLflow-native spans, experiment linkage, and framework-specific autolog rather than ad-hoc print debugging.

FAQ

Which LLM frameworks does instrumenting-with-mlflow-tracing support?

instrumenting-with-mlflow-tracing supports Python and TypeScript stacks including OpenAI, Anthropic, LangChain, LangGraph, and LiteLLM. The skill detects the framework in the repo, adds the matching MLflow autolog integration, configures experiment tracking, and verifies spans ar

How do you install instrumenting-with-mlflow-tracing?

Install instrumenting-with-mlflow-tracing from the mlflow/skills repository with `npx skills add mlflow/skills` or by copying skills into your agent skills directory. After installation, prompts like “Add MLflow tracing to my OpenAI app” trigger the four-step detect-autolog-confi

What should MLflow tracing capture in LLM apps?

instrumenting-with-mlflow-tracing focuses on high-signal events: LLM calls, retrieval steps, and tool use rather than noisy helpers like string formatting. Verified traces record spans with inputs, outputs, and latency so developers can compare experiments and debug agent behavio

Data Science & MLanalyticspipelines

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.