← Back to changelog
January 16, 2024

Trace Tagging

Picture Richard KrümmelRichard Krümmel

Categorize and manage your traces with tags in Langfuse.

Tagging allows you to flexibly add metadata to your traces, making it easier to categorize, filter, and manage them. Tags are a simple yet effective way to organize your traces. They can be added directly to the trace object from the SDK and can be used to filter and group traces in Langfuse.

🎯 How it works

You add tags to your traces using the Langfuse SDK or directly from the UI. You can filter and group your traces based on these tags.

Python

trace = langfuse.trace(
    name = "docs-retrieval",
    tags = ["my-first-tag", "even-better-tag"]
)

Typescript

const trace = langfuse.trace({
  name: "docs-retrieval",
  tags: ["my-first-tag", "even-better-tag"],
});

You can also use the GET API to retrieve traces with specific tags.

GET /api/public/traces?tags=my-first-tag&tags=even-better-tag

Note: The GET API will return only the traces that have all the specified tags. If a trace does not have every tag specified in the API call, it will not be included in the returned results.

🕹️ Try it out

Head over to the docs to learn more and get started.

Was this page useful?

Questions? We're here to help

Subscribe to updates