Thread Traces
Overview
A “thread” on Confident AI is a group of one or more traces linked by a shared thread ID. This is useful for building conversational AI apps — chatbots, multi-turn agents, etc. — where you want to view and evaluate an entire conversation as a single unit.
Each call to your app creates a trace, and traces with the same thread ID are grouped together chronologically as turns in a conversation.
Threads group traces together, not spans. Each trace represents one turn in the conversation.
Create a Thread
To create a thread, set a thread_id on your traces using update_current_trace / updateCurrentTrace. Any traces that share the same thread ID will be grouped into a single thread.
Python
TypeScript
The thread_id / threadId can be any string — typically a session ID or conversation ID from your app.
Set Thread I/O
Although not strictly enforced, you should set the input to the raw user text and the output to the generated LLM text for each trace. These are used as the conversation turns for display on Confident AI and for thread evaluations.
Python
TypeScript
You don’t have to set both input and output on every trace. If a turn only has a user input or only an LLM output, you can set just one. Confident AI will format the turns accordingly on the UI and for evals.
Python
TypeScript
If I/O is not provided, it defaults to the trace’s default I/O values. There must be at least one trace in the thread with an input or output set.
Set Tools Called
If your LLM app uses tool/function calling, you can log which tools were invoked for a given turn. This is attached to the trace alongside the output it helped generate.
Python
TypeScript
Set Retrieval Context
For RAG-based conversational apps, you can log the retrieval context used to generate a response. This enables Confident AI to evaluate retrieval quality across conversation turns.
Python
TypeScript
You can combine tools_called and retrieval_context on the same trace —
they provide complementary context about how the output was generated for that
turn.
Next Steps
With threads set up, evaluate conversation quality or add more context to your traces.