Issue with Integrating Azure Function into AI Foundry Agent — Role and Requirement of Capability Host

Mian Omair 0 Reputation points
2025-04-28T08:20:10.56+00:00

Background and Objective:

I am building an AI Agent in Azure AI Foundry which needs to invoke an Azure Function dynamically during conversations.

Example Scenario: A user asks about weather information → the agent triggers an Azure Function ("GetWeather") → the function processes the request and returns results.

This example is simplified but meant to understand the full production-grade process of connecting Azure Functions as callable tools inside AI Foundry Agents.


Steps Taken:

Using the Python SDK (azure-ai-projects), I tried defining an agent with a tool of type azure_function.

The tool definition binds the Azure Function via Storage Queue input and output bindings (no HTTP trigger for now).

Attempted agent creation with this tool specified.

Problem Encountered:

While creating the agent, I get this error:

azure.core.exceptions.HttpResponseError: (None) Invalid tool value(s): azure_function
Code: None
Message: Invalid tool value(s): azure_function

This suggests that azure_function tool type is not directly accepted unless further setup is done.


Investigation and Current Understanding:

From documentation and forums, I learned about Capability Hosts, a new experimental concept in Azure ML and AI Foundry:

Capability Hosts seem to act as a bridge layer, allowing agents to interact with external resources like Functions, Storage, Databases, etc.

It is mentioned that certain tools like azure_function, storage_blob, etc., require an active Capability Host.

I attempted to create a Capability Host using the CLI (az ml capability-host create) but ran into YAML validation errors (specifically around connections field not being recognized).


Structured Questions Needing Clarification:

  1. High-Level Flow

What is the full end-to-end process required to enable an AI Foundry Agent to invoke an Azure Function? (From agent creation, linking external resources, to actual runtime invocation)


  1. Necessity of Capability Host

Is creating a Capability Host mandatory to allow an agent to use a tool of type azure_function?

If yes, what components need to be part of a Capability Host?

If no, is there an alternative simpler mechanism when using Storage Queue-based bindings only?


  1. Role and Significance of Capability Host

What exactly does a Capability Host do?

Does it merely act as a credential and connection broker?

Does it also route execution requests dynamically to registered resources?


  1. Correct Capability Host Definition

What is the correct YAML structure to create a Capability Host that supports Azure Function tool execution? (Especially since the error I encountered suggests my YAML is invalid around connections field)

Example of error faced:

Validation for CapabilityHostSchema failed:
{
  "connections": [
    "Unknown field."
  ]
}

My original capabilityhost.yml:

name: mg-voice-agent-capability-host
description: Capability host for MG AI voice agent project
connections:
  ai_services_connections:
    - mgaiagentshub17057533407_aoai
  storage_connections:
    - MG-AI-AGENTS-PROJECT-1/workspaceblobstore

  1. Portal / UI Options

Is there a way to create and manage Capability Hosts via the Azure Portal or Azure ML Studio interface instead of CLI and YAML? (If yes, where exactly?)


Summary: I want to create an AI agent that can call an Azure Function, understand whether Capability Host is mandatory, how to correctly define and configure it and how the agent-resource interaction is established.

Azure AI services
Azure AI services
A group of Azure services, SDKs, and APIs designed to make apps more intelligent, engaging, and discoverable.
3,396 questions
{count} votes

1 answer

Sort by: Most helpful
  1. JAYA SHANKAR G S 2,350 Reputation points Microsoft External Staff
    2025-05-02T09:14:59.12+00:00

    Hello @Mian Omair ,

    We got update from product team, issue is happening because there is no capability host created on this project, which essentially makes this an Basic Agent Project, for which the azure function tool is not supported.

    So, you need to create a Standard Agent project setup with capability host which can be created with custom template.

    Go to this page, click on Deploy to Azure under standard agent setup.

    User's image

    You will be redirected to custom deployment page like below, fill the required details and deploy it.

    User's image

    After successfully deployed, run the agent creation code and it successfully created.

    User's image

    For existing resources, you can use this bicep template

    If you have any query, please let us know in the comments or in private message.

    Thank you

    0 comments No comments

Your answer

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