Trouble with assistant API - Response

hi guys,
I have an on if you are using I am addressing the above. My procedure is as follows.

  1. i send a message via API to the endpoint
    api.openai.com/v1/threads/{{thread}}/messages
  2. i assign the assistant with the corresponding ID via api.openai.com/v1/threads/{{thread}}/runs
  3. I wait 15 seconds
  4. i retrieve the answer to the given thread via
    api.openai.com/v1/threads/{{thread}}/messages

My problem now is that in 2 out of 10 cases the assistant ID = null in the response.
What can I optimize here or do differently so that it works?

I use the following header in the call - in addition to the Authorization and the Content-Type:
OpenAI-Beta = assistants=v2

Thank you very much!

Best regards
Bernd

There are a log of examples source code to show the flow in several languages that are probably good to check out. Once you ‘run’ you need to check the status - and until the status is completed you won’t be able to see messages.

ok - that makes sense. do you have an example of what that might look like? Which endpoint do I use to query this?
Thank you very much!