QuestionQ122

VerifiedImplement generative AI and agentic solutions

You have a Microsoft Foundry project that includes an agent. The agent has a Model Context Protocol (MCP) tool named kbsearch that queries a knowledge base stored in Azure AI Search.

Some agent runs produce answers from the base model without calling the knowledge base, resulting in responses that lack grounded citations.

You are given the following code snippet used to run the agent.

Question Image

You need to deterministically require the agent to invoke kbsearch on every run.

What should you do?

Explanation

tool_choice is the deterministic run-level control for requiring a specific tool call. Setting it in create_and_process() to select kbsearch prevents the default automatic model decision from bypassing the knowledge-base tool, so responses are grounded in its results.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!