Create Thread and Run
A 3-step recipe with OpenAI. We can help you get access.
Recipe · 3 steps
Create Thread and Run
with OpenAI
Create a thread and run in one call, poll to completion, and read messages.
- Create a thread seeded with the user message and immediately run it.
- Poll the run until it reaches a terminal status, branching to read the messages when completed and looping while it is still in progress.
- List the thread messages and return the most recent assistant reply.
What you'll need to have ready
- apiKey: OpenAI API key used as a Bearer token.
- assistantId: The id of an existing assistant to execute the run.
- userMessage: The initial user message to seed the thread.
For your developer
Arazzo workflow openai:thread-and-run, 3 operations: createThreadAndRun → getRun → listMessages. Specs on APIs.io.