Forcing Tool Invocation in Microsoft Foundry Agents

Answer Correct answer: D — Add the tool_choice parameter to the create_and_process() method call.

You have a Microsoft Foundry project that contains 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 return answers from the base model without invoking the knowledge base, which results in responses without grounded citations. You are provided with the following code snippet that runs the agent. exhibit You need to deterministically force the agent to invoke kbsearch on each run. What should you do?

  1. Add the response_format parameter to the create_and_process() method call.
  2. Replace create_and_process() method with the create_thread_and_process_run() method.
  3. Add the toolset parameter to the create_and_process() method call.
  4. Add the tool_choice parameter to the create_and_process() method call. Correct Answer

Community Insight

Tests knowledge of agent execution parameters; the trap is confusing output formatting or thread management with tool selection logic.

This question addresses how to ensure a Microsoft Foundry agent deterministically invokes specific tools like kbsearch. It establishes that the tool_choice parameter is the correct configuration for this requirement.

Learners often select response_format, mistakenly believing it controls which tools are used rather than just the structure of the final output.

Community Discussion (1 comments)

Amelia233 👍 1 Selected: D
Correct answer: D. Add the tool_choice parameter to the create_and_process() method call. ✅ The tool_choice parameter lets you explicitly force the agent to use a specific tool. Set it to kbsearch so the knowledge base is invoked on every run, ensuring responses are grounded and include citations. A ❌ response_format controls the output format. B ❌ Changing the processing method doesn't force tool usage. C ❌ toolset makes tools available but doesn't force their invocation. D ✅ tool_choice deterministically selects the required tool.

Comments & Corrections

No comments yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Submitted for moderation before publishing. Keep it helpful and respectful.

Expert Analysis

Why the Answer Is Correct

The core issue is that the agent sometimes relies on its base model's internal knowledge instead of using the provided kbsearch tool. To fix this and ensure grounded citations, you must explicitly instruct the agent to use the tool. The tool_choice parameter allows you to specify exactly which tool(s) the agent should invoke. Setting tool_choice to kbsearch forces the agent to call this tool on every run, satisfying the requirement for deterministic behavior.

Why the Other Options Are Wrong

Option A (response_format) only dictates the format of the response (e.g., JSON vs. text) and does not influence tool selection. Option B (create_thread_and_process_run) changes the concurrency model but does not enforce tool usage. Option C (toolset) defines the available tools but does not force their invocation; without tool_choice, the agent still decides whether to use them.

Community Comment Notes

Community consensus strongly supports option D, with users noting that "The tool_choice parameter lets you explicitly force the agent to use a specific tool." This aligns with standard LLM orchestration patterns where explicit tool forcing is required for grounding.

Exam Strategy

When configuring agents, distinguish between defining capabilities (tools) and enforcing behaviors (tool_choice). If the exam asks for deterministic tool usage, look for parameters that override the model's natural routing decisions.

Frequently Asked Questions

Why doesn't adding the tool to the toolset force its use?

The toolset parameter only makes the tool available to the agent. Without tool_choice, the LLM can still decide not to call it if it believes it knows the answer.

What is the difference between tool_choice and response_format?

response_format controls how the final answer is structured (e.g., JSON schema), while tool_choice controls which external functions the agent is allowed or forced to execute.

More AI-103 FAQ →

Related Analysis

Practice All AI-103 Questions

Access 88 questions with complete answers and detailed explanations.

View Full AI-103 Practice Test →

← Back to AI-103 Study Guide