Docs
Tracing
Tags

Tagging traces

Tags allow you to categorize and filter traces. You can tag traces only from the Langfuse SDKs or from the Langfuse UI. To tag a trace, add a list of tags to the tags field of the trace object. Tags are strings and a trace may have multiple tags.

from langfuse import Langfuse
langfuse = Langfuse()
 
trace = langfuse.trace(
    tags=["my-first-tag", "even-better-tag"]
)

Working with tags

Tags enable you to flexibly add metadata to your traces. You can filter for tags in the Langfuse UI and GET API (opens in a new tab).

When choosing tags, consider what aspects of the traces you might want to filter for or group by in your analysis. You may use tags to indicate specific versions of your app ('app-v1', 'app-v2'), specific LLM techniques you used ('rag', 'one-shot', 'few-shot'), or the environment of your app ('local', 'staging', 'prod').

Was this page useful?

Questions? We're here to help

Subscribe to updates