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.
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.
The thread_id / threadId can be any string — typically a session ID or conversation ID from your app.
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.
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.
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.
You can attach custom metadata and tags to a thread to label production conversations with attributes like DVA version, client, agent ID, or status flags. Both are filterable and groupable across the observatory, which makes it easy to slice production traffic.
Thread fields are set by including a thread object on any trace you ingest into the thread. thread.id is an alternate, idiomatic way to specify the thread — it’s equivalent to top-level threadId and either one is sufficient. Metadata values can be any JSON-serializable type (stringified server-side), and tags are an array of strings.
thread.metadata and thread.tags only take effect when a thread id is
resolvable — either via thread.id or top-level threadId. Requests without
one are rejected with a 400. If both thread.id and threadId are sent they
must match.
Successive ingestions for the same thread merge metadata keys, so you can build up a thread’s metadata incrementally across turns. Sending the same key again overwrites the previous value. Tags replace any previously stored value, so always send the full set you want on the thread:
After the two requests above, the thread’s metadata is:
You can view a thread’s metadata and tags directly from the platform on the thread details page.
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.
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.
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.
With threads set up, evaluate conversation quality or add more context to your traces.