Share via

Are structured outputs available in Azure Agents Service or Azure OpenAI Service for Assistants API?

Fedir Tykhonov 20 Reputation points
2025-04-15T10:42:04.4766667+00:00

Hey everyone,

I need a way to use a Code Interpreter (Like the one available for Azure Agents Service or for Azure OpenAI Assistants API) together with a structured output function. From what I have seen, structured output is available for Completions API for Azure OpenAI Service, but not for Agents Service or Assistants API.

Does anyone know whether these structured outputs are available for any azure service which also supports code interpreter feature?

Kind regards,

F

Foundry Tools
Foundry Tools

Formerly known as Azure AI Services or Azure Cognitive Services is a unified collection of prebuilt AI capabilities within the Microsoft Foundry platform


Answer accepted by question author
  1. Prashanth Veeragoni 5,770 Reputation points Microsoft External Staff Moderator
    2025-04-15T14:55:25.1933333+00:00

    Hi Fedir Tykhonov,

    Yes, Azure OpenAI Assistants API (Preview) and Azure AI Agents Service both support structured outputs even when the Code Interpreter tool is used. You can define function tools alongside the Python tool and the assistant will invoke them as needed.

    Let us see how to Use Both (Code Interpreter + Structured Output):

    Option A: Azure OpenAI Assistants API (Preview)

    Use the Assistants API like this:

    {
      "assistant_id": "...",
      "thread": {
        "messages": [
          {
            "role": "user",
            "content": "Can you calculate something and return results in a structured way?",
            "tool_choice": "auto"
          }
        ]
      }
    }
    

    Your assistant can have both:

    ·       A function (for structured output)

    ·       The code_interpreter tool

    And it will decide when to use which.

    Option B: Azure AI Studio (Agents)

    ·       Build an agent in Azure AI Studio.

    ·       Add:

    o   Code Interpreter (Python Tool)

    o   Function tool (with a defined schema)

    ·       The agent can use Python to calculate and then return via a structured schema you provide.

    Hope this helps, do let me know if you have any further queries.

    Thank you! 

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.