Launch Week 3: Five days of launches

Add Tags to Traces

Adding tags to your traces for better visibility on Confident AI

Overview

Unlike metadata, which can contain complex structured data, tags are simple string labels that make it easy to group related traces together, and cannot be applied to spans.

Add Tags to Traces

Tags are applied at the trace level, making them visible for all spans within that trace. Open a trace context around the work you want to tag:

main.py
from langchain_openai import ChatOpenAI
from confident_trace import init, trace_context

init()
model = ChatOpenAI(model="gpt-4o")

def llm_app(query: str):
    with trace_context(tags=["Causal Chit-Chat"]):
        return model.invoke(query)

A trace context supplies defaults to traces started inside it and never overwrites tags already set on a trace. Tag lists are not merged, so provide every tag you want in one list. See Update Trace Properties for the full behavior.

Next Steps

Ready to monitor AI in production?Connect traces, alerts, dashboards, and evals in one production workflowBook a demo

Last updated on

Built byConfident AI