Skip to content

Python: [Bug]: Run Error with Create/Get Agent API for Azure V2: model_deployment_name must be a non-empty string #3228

@mhmtkcm

Description

@mhmtkcm

Description

I receive the attached error during the agent run phase after creating or using an agent with the get/create APIs in the new Foundry V2 update.

As you can see in the screenshot below, a model has already been chosen.

Image

Code Sample

import asyncio
import os

from agent_framework.azure import AzureAIProjectAgentProvider
from azure.ai.projects.aio import AIProjectClient
from azure.core.exceptions import ResourceNotFoundError
from azure.identity import InteractiveBrowserCredential

async def main():
    credential = InteractiveBrowserCredential()
    async with AIProjectClient(
        endpoint=os.environ["AZURE_AI_FOUNDRY_PROJECT_ENDPOINT"],
        credential=credential,
    ) as project_client:
        provider = AzureAIProjectAgentProvider(project_client=project_client)
        agent_name = "summarizer-agent"
        try:
            agent = await provider.get_agent(name=agent_name)
            print(f"Agent found: {agent.name}")
        except ResourceNotFoundError:
            agent = await provider.create_agent(
                name=agent_name,
                model="gpt-5.2",
                instructions="You are responsible for writing a brief summary of a few sentences on the given subject.",
                description="An agent that summarizes a given subject.",
            )
            print(f"Agent created: {agent.name}")

        response = await agent.run(subject="Artificial Intelligence")
        print("===== Agent Response =====")
        print(response)


if __name__ == "__main__":
    asyncio.run(main())

Error Messages / Stack Traces

File ".../.venv/lib/python3.13/site-packages/agent_framework_azure_ai/_client.py", line 410, in _check_model_presence
    raise ValueError("model_deployment_name must be a non-empty string")
ValueError: model_deployment_name must be a non-empty string

Package Versions

1.0.0b260114

Python Version

3.13

Additional Context

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpythonv1.0Features being tracked for the version 1.0 GA

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions