sentry-javascript icon indicating copy to clipboard operation
sentry-javascript copied to clipboard

Explore thread/session concept and document which AI providers expose thread ID (or session ID)

Open RulaKhaled opened this issue 1 month ago • 1 comments

RulaKhaled avatar Dec 10 '25 10:12 RulaKhaled

JS-1285

linear[bot] avatar Dec 10 '25 10:12 linear[bot]

TLDR;

  • Built‑in support: OpenAI’s Assistants API and LangGraph provide native conversation identifiers. thread_id for OpenAI (returned with each message) and an internal thread_id in LangGraph’s runtime, making it easy to persist and reference chat history.
  • Requires workarounds: Google’s REST generate_content method 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_id or thread_id metadata to traces to group conversations Without such mechanisms, maintaining context becomes a manual process.

RulaKhaled avatar Dec 11 '25 13:12 RulaKhaled