How to attach assistant to thread?

Hi there,

I am trying to attach an assistant to a thread I’ve created. I have the thread and the thread id, however the docs: have nothing about taking the assistant and combining it with the thread.

Can someone walk me through what I am missing?

So far I’ve uploaded a file, attached it to the assistant which I’ve created, created a thread, now I am trying to combine the assistant and the thread.

Thanks in advance.

Answer from…

Hello, To attach an assistant to a thread, you need to create a “Run”. A Run is essentially the process of running the Assistant on the Thread, which triggers responses and automatically calls the relevant tools. Here’s how you can do it:

run = client.beta.threads.runs.create(,

In this code, thread_id is the ID of the thread you’ve created, and assistant_id is the ID of the assistant you’ve created. This will run the Assistant on the Thread, effectively “attaching” the Assistant to the Thread. You can also optionally pass new instructions to the Assistant while creating the Run, but note that these instructions override the default instructions of the Assistant.

run = client.beta.threads.runs.create(,,
 instructions="Please address the user as Jane Doe. The user has a premium account."

You can find more details in the OpenAI documentation ( I hope this helps! Let me know if you have any other questions.

1 Like