Forum Discussion
Issue with: Connected Agent Tool Forcing from an Orchestrator Agent
hi AyusmanBasu Firstly You cannot use tool_choice.type = "connected_agent"
Even though ConnectedAgentTool is valid in the SDK for registering child agents, it is NOT a valid value for:
tool_choice = { "type": "connected_agent" }
The service only accepts:
'function', 'openapi', 'azure_function', 'fabric_dataagent', 'file_search', etc.
So your Approach 1 fails by design because:
"connected_agent" is NOT a supported tool_choice type at runtime
Connected agents are exposed as "function" tools to the Orchestrator Agent
Why Approach 2 and 3 also failed
This error is the big clue:
"Invalid tool_choice: Fabric_Agent. You must also pass this tool in the 'tools' list on the Run."
But…
Then when you pass tools on the run →"got multiple values for keyword argument 'tools'"
The Only Working Pattern (Today)
If you really want to force a connected agent, the only supported way is:
- Register child agents as tools on the Orchestrator (you did this correctly)
- Force them using function type
- DO NOT pass tools again in the run call
- Name must match the registered tool name exactly
run = agents_client.runs.create_and_process(
thread_id=st.session_state.thread.id,
agent_id=ORCH_AGENT_ID,
tool_choice={
"type": "function",
"function": {
"name": "Fabric_Agent" # must match ConnectedAgentTool name
}
}
)
If still not triggered → the model can override it unless you use tool-only execution
How to reduce hallucinations (Better than forcing tools)
Instead of hard forcing, I recommend this in your orchestrator instructions:
You MUST use one of the connected agents for ALL user queries.
You are NOT allowed to answer directly.
If a tool is unavailable, say: "Tool not available".
Always choose one of:
- Fabric_Agent
- Fabric_Pipeline_Trigger
Never answer from your own knowledge.
This works much better than tool_choice in practice.
If you want 100% guarantee, use:
tool_choice = { "type": "required" }
Let the model choose the connected agent, but force tool usage.
Important Product Reality (Straight answer to your question)
Is it possible to fully force connected agent selection today?
Short answer: No, not cleanly or officially.
Azure currently supports:
Capability | Supported |
Registering connected agents | Yes |
Auto-selection by orchestrator | Yes |
“Tool-required” enforcement | Yes |
Manual hard-routing (connected_agent) | No |
Full deterministic child control | No (Roadmap item) |
Final advise
Keep your 3-agent architecture
Remove forced routing in code
Enforce with system prompt
Use tool_choice = "required"
Log which agent is selected
Add validation agent if accuracy is critical
This is far more reliable than manual tool forcing in current SDK versions.