Unable to create Agent with selected model

Abkari, Prashant 0 Reputation points
2026-09-22T06:11:06.74+00:00

I have created a deployment with the model "Phi-4" and tested it correctly in the playground and worked.

But i create an agent and use this model , its giving me the following error. I am unsure what the cause of the error is

all of the above i have done this in VS Code

Error: The model deployment encountered an error processing your request. You can retry your request, or contact us through an Azure support request at: https://go.microsoft.com/fwlink/?linkid=2213926 if you continue to see this error.

When i test it in the Foundry UI i get the following error

Error{"object":"error","message":""auto" tool choice requires --enable-auto-tool-choice and --tool-call-parser to be set","type":"BadRequestError","param":null,"code":400} Request ID: 4b5197c0-2851-4b3f-bdfb-1bc3101b355b

Microsoft Foundry
Microsoft Foundry

A unified Azure platform for creating and managing AI models, agents, and applications with built‑in enterprise security, monitoring, and governance

0 comments No comments

2 answers

Sort by: Most helpful
  1. Venkata Tarun Kumar Mavillapalli 0 Reputation points
    2026-11-18T12:17:25.5966667+00:00

    Hi Prashant, have you been able to resolve this?

    If not, the specific error indicates that the deployment is rejecting automatic tool calling. Microsoft’s model catalog lists Phi-4 as not supporting tool calling. A successful chat-playground test therefore doesn’t establish compatibility with the agent request that is failing.

    For a Foundry prompt agent, select a model marked as agent-supported that supports the tools you need for example, GPT-4.1-mini, if available in your project’s region. Update the agent to use that deployment and rerun the same test.

    Microsoft also explains that an unsupported model/tool combination can pass agent creation and then fail at runtime:

    Model and tool selection

    If you still receive the same error with a supported deployment, share the selected model, region, and relevant agent configuration, we can dig further.

    Was this answer helpful?

    0 comments No comments

  2. AI answer

    2026-09-22T06:11:22.6566667+00:00

    This usually points to a model/deployment availability issue rather than a basic agent creation problem, especially since the model works in the playground but fails when the agent tries to use it.

    Check these items in order:

    1. Verify the model deployment still exists and is healthy.
      • In Foundry, go to Build > Deployments.
      • Confirm the deployment name is present and matches exactly what the agent is configured to use.
      • If using CLI-managed deployments, verify provisioning completed successfully. A successful deployment should show provisioning state Succeeded.
    2. If the agent shows a deployment-not-found style failure, reselect the model in the agent.
      • In the agent Build tab, open the model picker.
      • Select an available model again and save.
      • This is recommended when a model was retired, removed, or became unavailable in the environment.
    3. Check for quota or capacity issues.
      • If the selected model/region/deployment type combination has no available quota or capacity, agent requests can fail even when earlier testing succeeded.
      • In the Azure portal, check Azure OpenAI > Quotas.
      • If quota is exhausted, request an increase or try a different region with available capacity.
      • If the issue is transient capacity pressure, retry later.
    4. Consider model-specific runtime behavior.
      • The context includes examples where certain models worked in deployment but failed at inference time in agent scenarios, while other models in the same subscription worked.
      • If this is specific to Phi-4, test the agent with another supported model deployment. If another model works, the issue is likely model-specific rather than a general agent configuration problem.
    5. If using a custom connection/gateway-backed model, verify the deployment reference format.
      • The model deployment name must use <connection-name>/<model-name>.
      • If this format is wrong, requests can fail with model lookup errors.
    6. Review deployment or gateway logs.
      • For gateway-backed setups, check request logging or API Management analytics to confirm the agent request is reaching the model endpoint and being routed correctly.

    If the failure continues after confirming the deployment exists, quota is available, and another model works, the strongest supported conclusion is that this may be a model-specific service/runtime issue with the selected deployment path.


    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer 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.