litellm - 💡(How to fix) Fix [Feature]: Support Azure AI Foundry Agents v2 (Responses API with agent_reference) [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
BerriAI/litellm#25372Fetched 2026-04-09 07:52:28
View on GitHub
Comments
0
Participants
1
Timeline
1
Reactions
0
Author
Participants
Timeline (top)
labeled ×1

Code Example

from azure.ai.projects import AIProjectClient
from azure.identity import DefaultAzureCredential

project_client = AIProjectClient(
    endpoint="https://<resource>.services.ai.azure.com/api/projects/<project>",
    credential=DefaultAzureCredential(),
)

openai_client = project_client.get_openai_client()

response = openai_client.responses.create(
    input=[{"role": "user", "content": "Tell me what you can help with."}],
    extra_body={
        "agent_reference": {
            "name": "my-agent-name",
            "version": "1",
            "type": "agent_reference",
        }
    },
)

---

azure_ai/agents/<agent_name>:<version>
RAW_BUFFERClick to expand / collapse

Feature Request

What is your use case?

We are integrating with Microsoft Foundry Agent Service. We've deployed agents using the new Foundry Agents v2 experience, which uses the Responses API with agent_reference (referencing agents by name and version) rather than the deprecated Assistants API (thread/run pattern with asst_* IDs).

The current azure_ai/agents/{agent_id} route in LiteLLM implements the old Assistants API pattern, which:

  1. Requires agent IDs beginning with asst_ (but the new Foundry experience does not surface these IDs)
  2. Uses the thread → message → run → poll flow (but the new Foundry Agents v2 uses openai_client.responses.create() with an agent_reference in extra_body)

Microsoft has deprecated the Assistants API with retirement set for August 26, 2026.

The new API pattern

From the Azure AI Foundry getting-started code:

from azure.ai.projects import AIProjectClient
from azure.identity import DefaultAzureCredential

project_client = AIProjectClient(
    endpoint="https://<resource>.services.ai.azure.com/api/projects/<project>",
    credential=DefaultAzureCredential(),
)

openai_client = project_client.get_openai_client()

response = openai_client.responses.create(
    input=[{"role": "user", "content": "Tell me what you can help with."}],
    extra_body={
        "agent_reference": {
            "name": "my-agent-name",
            "version": "1",
            "type": "agent_reference",
        }
    },
)

Key differences from the current azure_ai/agents implementation:

  • Endpoint: Project-level (https://<resource>.services.ai.azure.com/api/projects/<project>)
  • API: Responses API (/openai/responses), not Assistants/Threads API
  • Agent identification: By name + version via agent_reference in extra_body, not by asst_* ID
  • Auth: Azure AD (Entra ID) bearer token — same as current implementation

Proposed model format

azure_ai/agents/<agent_name>:<version>

For example: azure_ai/agents/my-agent-name:1

Reference docs

Are you a LiteLLM Enterprise customer?

No

extent analysis

TL;DR

Update the azure_ai/agents/{agent_id} route to support the new Foundry Agents v2 experience using the Responses API with agent_reference.

Guidance

  • Identify the current implementation of the azure_ai/agents/{agent_id} route and its dependencies on the deprecated Assistants API.
  • Update the route to use the Responses API with agent_reference in extra_body, as shown in the Azure AI Foundry getting-started code.
  • Modify the agent identification to use name and version via agent_reference, instead of asst_* IDs.
  • Verify that the updated implementation works with the new Foundry Agents v2 experience and the proposed model format azure_ai/agents/<agent_name>:<version>.

Example

openai_client = project_client.get_openai_client()
response = openai_client.responses.create(
    input=[{"role": "user", "content": "Tell me what you can help with."}],
    extra_body={
        "agent_reference": {
            "name": "my-agent-name",
            "version": "1",
            "type": "agent_reference",
        }
    },
)

Notes

The current implementation needs to be updated to support the new Foundry Agents v2 experience before the Assistants API is retired on August 26, 2026.

Recommendation

Apply workaround by updating the azure_ai/agents/{agent_id} route to support the new Foundry Agents v2 experience using the Responses API with agent_reference, as the Assistants API is deprecated and will be retired soon.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING