This example shows how to create an agent using the latest AI Foundry SDK and and the Foundry Agent server. Bing Tool is attached to the agent.
How to change the behavior of the function calling:
# Option 1: Force any available tool (simplest)
tool_choice="required"
# Option 2: Using tool type (your original approach)
tool_choice={
"type": "bing_grounding"
}
# Option 3: Using function specification (current implementation)
tool_choice={
"type": "function",
"function": {
"name": "bing_grounding"
}
}
# Option 4: Let agent decide (default)
tool_choice="auto"
# Option 5: Disable all tools
tool_choice="none"
To determine if the tool was successfuly called List the steps of the run:
run_steps = project_client.agents.run_steps.list(
thread_id=thread.id,
run_id=run.id
)
Then check for tool calls in the step
if hasattr(step, 'step_details') and step.step_detail