sentry-javascript
sentry-javascript copied to clipboard
Explore thread/session concept and document which AI providers expose thread ID (or session ID)
TLDR;
-
Built‑in support: OpenAI’s Assistants API and LangGraph provide native conversation identifiers.
thread_idfor OpenAI (returned with each message) and an internalthread_idin LangGraph’s runtime, making it easy to persist and reference chat history. -
Requires workarounds: Google’s REST
generate_contentmethod and Anthropic’s Claude Messages API are stateless, developers must include the full conversation on each call Google’s Live WebSocket API is an exception, offering a session handle to resume conversations. - Client‑side management: Vercel’s AI SDK doesn’t manage sessions; it keeps messages in memory and sends the full history by default, so developers must create and store their own chat IDs and histories (e.g., in a database).
-
More complex: LangChain (core) lacks a universal session ID; it relies on memory modules or provider‑specific IDs, and you can attach
session_idorthread_idmetadata to traces to group conversations Without such mechanisms, maintaining context becomes a manual process.