Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/langsmith/threads.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ Many LLM applications have a chatbot-like interface in which the user and the LL
To associate traces together into a thread, you need to pass in a special `metadata` key where the value is the unique identifier for that thread. The key name should be one of:

- `session_id`
- `conversation_id`
- `thread_id`

The ingest pipeline checks these keys in the order listed and uses the first one present.

The value can be any string you want, but we recommend using **UUID v7** thread IDs.

The [LangSmith SDK](/langsmith/reference) exports a `uuid7` helper (Python v0.4.43+, JS v0.3.80+):
Expand All @@ -29,7 +32,7 @@ The [LangSmith SDK](/langsmith/reference) exports a `uuid7` helper (Python v0.4.
For instructions, refer to [Add metadata and tags to traces](/langsmith/add-metadata-tags).

<Warning>
**Important:** To ensure filtering and token counting work correctly across your entire thread, you must set the thread metadata (`session_id` or `thread_id`) on **all runs**, including child runs within a trace.
**Important:** To ensure filtering and token counting work correctly across your entire thread, you must set the thread metadata (`session_id`, `conversation_id`, or `thread_id`) on **all runs**, including child runs within a trace.

If child runs don't have the thread_id metadata, they won't be included when:

Expand Down
Loading