I’m building a production chat app with multiple users, and I’m trying to understand the recommended way to associate LangGraph threads (or LangSmith Threads) with a user_id. I used this tutorial to put something together quickly and now I want to extend it to multiple users.
My production requirement is:
-
many users (multi-tenant)
-
each user may have multiple conversations
-
I need to ensure conversation state is isolated per user
-
ideally I can query/filter traces by user in LangSmith too
Questions:
-
Is there a built-in concept of
user_id/ tenant in LangGraph threads, or is the expected approach to map(user_id → thread_id)in my own DB? -
If the second approach is recommended, should I generate
thread_idas a UUID, or something likef"{user_id}:{conversation_id}"? -
Is there a recommended way to attach
user_idinto LangSmith tracing metadata so I can filter traces by user (without merging state between users)?