OpenAI · Arazzo Workflow

OpenAI Assistant Run

Version 1.0.0

Create an assistant, open a thread, add a message, run it, poll the run, and read the reply.

1 workflow 1 source API 1 provider
View Spec View on GitHub Artificial IntelligenceLarge Language ModelsT1ArazzoWorkflows

Provider

openai

Workflows

assistant-run
Create an assistant and run a thread to completion, returning the reply.
Creates an assistant, opens a thread with a user message, starts a run, polls the run status to a terminal state, and lists the resulting messages.
6 steps inputs: apiKey, instructions, model, userMessage outputs: assistantId, latestReply, runId, threadId
1
createAssistant
Create an assistant with the supplied model and instructions.
2
createThread
Open a new conversation thread.
3
addMessage
Add the user message to the thread.
4
createRun
Start a run of the assistant on the thread.
5
pollRun
Poll the run until it reaches a terminal status, branching to read the messages when completed and looping while it is still in progress.
6
listMessages
List the thread messages and return the most recent assistant reply.

Source API Descriptions

Arazzo Workflow Specification

Raw ↑
arazzo: 1.0.1
info:
  title: OpenAI Assistant Run
  summary: Create an assistant, open a thread, add a message, run it, poll the run, and read the reply.
  description: >-
    Builds an Assistants v2 conversation end to end: it creates an assistant,
    opens a thread, adds a user message, starts a run, polls the run until it
    reaches a terminal status, and on completion lists the thread messages to
    return the assistant reply. The Assistants endpoints require the OpenAI-Beta
    header, which is supplied inline on every beta step. Every step spells out
    its request inline so the flow can be read and executed without opening the
    underlying OpenAPI description.
  version: 1.0.0
sourceDescriptions:
- name: assistantsApi
  url: ../openapi/openai-assistants-api-openapi.yml
  type: openapi
workflows:
- workflowId: assistant-run
  summary: Create an assistant and run a thread to completion, returning the reply.
  description: >-
    Creates an assistant, opens a thread with a user message, starts a run,
    polls the run status to a terminal state, and lists the resulting messages.
  inputs:
    type: object
    required:
    - apiKey
    - model
    - instructions
    - userMessage
    properties:
      apiKey:
        type: string
        description: OpenAI API key used as a Bearer token.
      model:
        type: string
        description: The model id for the assistant and run (e.g. gpt-4o).
      instructions:
        type: string
        description: The system instructions for the assistant.
      userMessage:
        type: string
        description: The user message to add to the thread.
  steps:
  - stepId: createAssistant
    description: Create an assistant with the supplied model and instructions.
    operationId: createAssistant
    parameters:
    - name: Authorization
      in: header
      value: "Bearer $inputs.apiKey"
    - name: OpenAI-Beta
      in: header
      value: assistants=v2
    requestBody:
      contentType: application/json
      payload:
        model: $inputs.model
        instructions: $inputs.instructions
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      assistantId: $response.body#/id
  - stepId: createThread
    description: Open a new conversation thread.
    operationId: createThread
    parameters:
    - name: Authorization
      in: header
      value: "Bearer $inputs.apiKey"
    - name: OpenAI-Beta
      in: header
      value: assistants=v2
    requestBody:
      contentType: application/json
      payload: {}
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      threadId: $response.body#/id
  - stepId: addMessage
    description: Add the user message to the thread.
    operationId: createMessage
    parameters:
    - name: Authorization
      in: header
      value: "Bearer $inputs.apiKey"
    - name: OpenAI-Beta
      in: header
      value: assistants=v2
    - name: thread_id
      in: path
      value: $steps.createThread.outputs.threadId
    requestBody:
      contentType: application/json
      payload:
        role: user
        content: $inputs.userMessage
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      messageId: $response.body#/id
  - stepId: createRun
    description: Start a run of the assistant on the thread.
    operationId: createRun
    parameters:
    - name: Authorization
      in: header
      value: "Bearer $inputs.apiKey"
    - name: OpenAI-Beta
      in: header
      value: assistants=v2
    - name: thread_id
      in: path
      value: $steps.createThread.outputs.threadId
    requestBody:
      contentType: application/json
      payload:
        assistant_id: $steps.createAssistant.outputs.assistantId
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      runId: $response.body#/id
      status: $response.body#/status
  - stepId: pollRun
    description: >-
      Poll the run until it reaches a terminal status, branching to read the
      messages when completed and looping while it is still in progress.
    operationId: getRun
    parameters:
    - name: Authorization
      in: header
      value: "Bearer $inputs.apiKey"
    - name: OpenAI-Beta
      in: header
      value: assistants=v2
    - name: thread_id
      in: path
      value: $steps.createThread.outputs.threadId
    - name: run_id
      in: path
      value: $steps.createRun.outputs.runId
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      status: $response.body#/status
    onSuccess:
    - name: runCompleted
      type: goto
      stepId: listMessages
      criteria:
      - context: $response.body
        condition: $.status == "completed"
        type: jsonpath
    - name: runInProgress
      type: goto
      stepId: pollRun
      criteria:
      - context: $response.body
        condition: $.status == "queued" || $.status == "in_progress" || $.status == "cancelling"
        type: jsonpath
  - stepId: listMessages
    description: List the thread messages and return the most recent assistant reply.
    operationId: listMessages
    parameters:
    - name: Authorization
      in: header
      value: "Bearer $inputs.apiKey"
    - name: OpenAI-Beta
      in: header
      value: assistants=v2
    - name: thread_id
      in: path
      value: $steps.createThread.outputs.threadId
    - name: order
      in: query
      value: desc
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      messages: $response.body#/data
      latestReply: $response.body#/data/0/content
  outputs:
    assistantId: $steps.createAssistant.outputs.assistantId
    threadId: $steps.createThread.outputs.threadId
    runId: $steps.createRun.outputs.runId
    latestReply: $steps.listMessages.outputs.latestReply

Work with this as data

Every workflow here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for arazzo workflows

4 MCP tools reach this
  • find_arazzoBrowse and filter every workflow in the catalog.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This workflow
curl "https://apis.io/api/v1/arazzo/openai-assistant-run-workflow"
All arazzo workflows
curl "https://apis.io/api/v1/arazzo?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.