1. SDK
  2. Continuing conversations

​
What this page is for

After your first message, you get back thread_id and assistant_id. This guide explains what to pass next so users stay in the same chat—or start a new chat without losing memory.

GoalPass
Keep talking in the same chatSame thread_id on every send_message / sendMessage
Start a new chat but keep memory & docsOmit thread_id, pass the same assistant_id
Let the API pick defaultsOmit both (you get a new assistant + thread each time unless you reuse IDs from a prior response)

​
Continue on the same thread

Pass thread_id from the last response. The model receives full prior context for that conversation.

  • Python

  • JavaScript

  • TypeScript

first = await client.send_message("My favorite color is blue.")

second = await client.send_message(
    "What did I just tell you?",
    thread_id=first.thread_id,
)
print(second.content)

​
New chat, same assistant (shared memory)

Memories are stored per assistant. To remember the user across different threads, reuse assistant_id and start a new thread (omit thread_id on that call).

  • Python

  • JavaScript

  • TypeScript

r1 = await client.send_message(
    "I'm allergic to peanuts.",
    assistant_id=my_assistant_id,
    memory="Auto",
)

r2 = await client.send_message(
    "Any dietary restrictions you remember?",
    assistant_id=my_assistant_id,
    memory="Auto",
)

​
Create a thread explicitly (optional)

If you already have an assistant_id, you can create an empty thread via the REST API, then send messages with that thread_id. Most integrations only need send_message and the IDs it returns—see Conversation threads for the HTTP shape.