langwatch.thread.id attribute on the root span.
Setting the thread_id
Inside any traced operation, usesetAttributes() on the span:
langwatch.thread.id will be grouped into a single conversation thread in the LangWatch dashboard.
You can also use the typed attribute constants:
Example: Express Chatbot
threadId is typically the conversation or session ID from your application. It can be any string, as long as it’s consistent across all messages in the same conversation.
What You Get
Once traces share athread_id, you can:
- View the full conversation in the LangWatch dashboard by clicking on any trace in the thread
- Run evaluations by thread to assess conversation-level quality (see Evaluation by Thread)
- Build datasets from threads for testing multi-turn scenarios (see Dataset Threads)
- Filter and search traces by conversation in the messages view