Forum Discussion
Azure AI foundry SDK-Tool Approval Not Triggered When Using ConnectedAgentTool() Between Agents
I am building an orchestration workflow in Azure AI Foundry using the Python SDK. Each agent uses tools exposed via an MCP server (deployed in Azure container app), and individual agents work perfectly when run independently — tool approval is triggered, and execution proceeds as expected.
I have a main agent which orchestrates the flow of these individual agents.However, when I connect one agent to another using ConnectedAgentTool(), the tool approval flow never occurs, and orchestration halts. All I see is the run status as IN-PROGRESS for some time and then exits. The downstream (child) agent is never invoked.
I have tried mcp_tool.set_approval_mode("never") , but that didn't help.
Auto-Approval Implementation:
I have implemented a polling loop that checks the run status and auto-approves any requires_action events.
async def poll_run_until_complete(project_client: AIProjectClient, thread_id: str, run_id: str):
"""
Polls the run until completion. Auto-approves any tool calls encountered.
"""
while True:
run = await project_client.agents.runs.get(thread_id=thread_id, run_id=run_id)
status = getattr(run, "status", None)
print(f"[poll] Run {run_id} status: {status}")
# Completed states
if status in ("succeeded", "failed", "cancelled", "completed"):
print(f"[poll] Final run status: {status}")
if status == "failed":
print("Run last_error:", getattr(run, "last_error", None))
return run
# Auto-approve any tool calls
if status == "requires_action" and isinstance(getattr(run, "required_action", None), SubmitToolApprovalAction):
submit_action = run.required_action.submit_tool_approval
tool_calls = getattr(submit_action, "tool_calls", []) or []
if not tool_calls:
print("[poll] requires_action but no tool_calls found. Waiting...")
else:
approvals = []
for tc in tool_calls:
print(f"[poll] Auto-approving tool call: {tc.id} name={tc.name} args={tc.arguments}")
approvals.append(ToolApproval(tool_call_id=tc.id, approve=True))
if approvals:
await project_client.agents.runs.submit_tool_outputs(
thread_id=thread_id,
run_id=run_id,
tool_approvals=approvals
)
print("[poll] Submitted tool approvals.")
else:
# Debug: Inspect run steps if stuck
run_steps = [s async for s in project_client.agents.run_steps.list(thread_id=thread_id, run_id=run_id)]
if run_steps:
for step in run_steps:
sid = getattr(step, "id", None)
sstatus = getattr(step, "status", None)
print(f" step: id={sid} status={sstatus}")
step_details = getattr(step, "step_details", None)
if step_details:
tool_calls = getattr(step_details, "tool_calls", None)
if tool_calls:
for call in tool_calls:
print(f" tool_call id={getattr(call,'id',None)} name={getattr(call,'name',None)} args={getattr(call,'arguments',None)} output={getattr(call,'output',None)}")
await asyncio.sleep(1)
This code works and auto-approves tool calls for MCP tools. But while using ConnectedAgentTool(), the run never enters requires_action — so no approvals are requested, and the orchestration halts.
Environment:
azure-ai-agents==1.2.0b4
azure-ai-projects==1.1.0b4
- Python: 3.11.13
- Auth: DefaultAzureCredential
Notes: MCP tools work and trigger approval normally when directly attached. and I ndividual agents function as expected in standalone runs.
Can anyone help here..!