How to use an agent with Knowledge Base in Foundry Workflow (UI)

Mohamed ZAIEM 0 Reputation points
2025-12-21T14:42:24.8733333+00:00

I’m not able to use an agent with Knowledge Base in the Microsoft Foundry workflow (UI).

1- If I create the agent from the UI => Approval is required and the workflow is blocked.

2- If I create the agent from the code (python or REST API) => The agent is created successfully but when I use it in the foundry workflow, I get the error: The requested operation requires an element of type 'Object', but the target element has type 'Array'.

I follow this article to create the agent (Python and REST): https://learn.microsoft.com/en-us/azure/ai-foundry/agents/how-to/tools/knowledge-retrieval?view=foundry&tabs=foundry%2Cpython

Would appreciate any help!

Azure AI services
Azure AI services
A group of Azure services, SDKs, and APIs designed to make apps more intelligent, engaging, and discoverable.
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Gowtham CP 7,245 Reputation points Volunteer Moderator
    2025-12-23T05:53:55.7733333+00:00

    Hi Mohamed ZAIEM ,

    Thanks for the question.

    At the moment, Azure AI Foundry Workflows (UI) do not fully support agents that use the Knowledge Retrieval tool, regardless of whether the agent is created from the UI or via code.

    What is happening

    UI-created agents
    When you create an agent with a Knowledge Base from the Foundry UI, the Knowledge Retrieval tool requires approval. Foundry Workflows do not support approval steps, so the workflow blocks. This is expected behavior.

    Code-created agents (Python / REST)
    Agents created via code are valid, but when used inside a Foundry Workflow, execution fails with:
    The requested operation requires an element of type 'Object', but the target element has type 'Array'.

    This happens because Foundry Workflows expect tool outputs to be JSON objects, while the Knowledge Retrieval tool returns an array-based response, which the workflow runtime cannot process.

    Current supported state

    Knowledge Retrieval works when running agents directly (SDK / Playground)

    Knowledge Retrieval is not supported in Foundry Workflow (UI) today

    This limitation is documented implicitly by the workflow and tool behavior

    Recommended approach

    If you need workflows today:

    Expose Azure AI Search as an explicit tool (OpenAPI or Azure Function), or

    Run the agent outside the Workflow UI and orchestrate in your application


    References

    Knowledge Retrieval tool for agents
    https://learn.microsoft.com/azure/ai-foundry/agents/how-to/tools/knowledge-retrieval

    Tools in Azure AI Foundry agents
    https://learn.microsoft.com/azure/ai-foundry/agents/how-to/tools/overview

    Azure AI Foundry Agents overview (workflow limitations implied)
    https://learn.microsoft.com/azure/ai-foundry/agents/overview


    I hope this clarifies the current behavior.
    If the answer is useful, please accept it to close the thread.

    0 comments No comments

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.