You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Python: [Bug]: Run Error with Create/Get Agent API for Azure V2: model_deployment_name must be a non-empty string #3228
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.
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
I don't think subject is correct parameter here, the correct one would be messages. It is also a first parameter in the method, so you can simply pass a string. Same applies to your code sample in #3229 issue. Thanks!
@mhmtkcm Thanks for reporting this issue! Should be fixed by: #3246.
One note: in your code sample in line:
response = await agent.run(subject="Artificial Intelligence")
I don't think subject is correct parameter here, the correct one would be messages. It is also a first parameter in the method, so you can simply pass a string. Same applies to your code sample in #3229 issue. Thanks!
After opening the issue, I realized that I had written the example incorrectly. However, I don't use it this way in my original code. Thank you for the information.
Activity
dmytrostruk commentedon Jan 16, 2026
Mehmet Koçum (@mhmtkcm) Thanks for reporting this issue! Should be fixed by: #3246.
One note: in your code sample in line:
I don't think
subjectis correct parameter here, the correct one would bemessages. It is also a first parameter in the method, so you can simply pass a string. Same applies to your code sample in #3229 issue. Thanks!mhmtkcm commentedon Jan 16, 2026
After opening the issue, I realized that I had written the example incorrectly. However, I don't use it this way in my original code. Thank you for the information.
Thanks for the fix, too!