Getting Started With Azure OpenAI Assistant API

Shweta Lodha
3 min readFeb 16, 2024

Few months back, I wrote an article on Assistant API provided by OpenAI. Now as Microsoft has released its own Assistant API with Azure OpenAI, I thought to touch upon that and that’s why this article is here.

Azure OpenAI Assistants (Preview) allows us to create AI assistants which works based on the custom instructions using some advanced tools.

In this article we’ll provide an in-depth walkthrough of getting started with the Assistants API.

Before you start working on this, make sure that you have enough context on it’s key terms like Thread, Message, run and Run step. I’ll not be deep diving into these concepts, but you want to know about these — I’ve briefed in the video attached at the end of this article.

Let’s go ahead and see how we can get started with this.

Image generated from Bing


In order to get started with your first assistant, you will need the following:

  • An Azure subscription — Create one for free.
  • An Azure OpenAI resource with required model deployed.

At the time of writing this article, only below models and regions are supported:

So, make sure that one of these are selected.

Next, we need to create an assistant and that can be done either in playground or using code. Let’s have a look at each of these.

Create An Assistant In Playground

Navigate to Azure AI Studio from Azure portal and click on Assistant, this will open up a window like the one shown below:

In above screen, provide name for your assistant, instructions and the model which you have deployed. Make sure to enable the Code Interpreter settings and upload your dataset. Once the assistant is saved, you will notice that an assistant Id is generated.

Next, we will go ahead and ask questions to our assistant:

You can even ask it to generate teh code for us:

In fact, it can plot the graphs for us as well:

Isn’t it impressive?

Well, let’s move on to another way of creating an AI assistant.

Create An Assistant Using VS Code

Here is the core part, which is creating our assistant:

assistant = client.beta.assistants.create(
name="Your Data Analyst",
instructions="You're a data analyst which can provide insights based on the data.",

thread = client.beta.threads.create()
client.beta.threads.messages.create(, role="user", content=content)
run = client.beta.threads.runs.create(,,

run = client.beta.threads.runs.retrieve(,
if run.status == "completed":
messages = client.beta.threads.messages.list(


There are many things, which I didn’t cover in this article. Hence, I recommend you watch my whole video uploaded on YouTube:


How to create Assistants with Azure OpenAI Service — Azure OpenAI | Microsoft Learn

Top 50 Fast-Food Chains in USA (