-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Open
Labels
AI ProjectsService AttentionWorkflow: This issue is responsible by Azure service team.Workflow: This issue is responsible by Azure service team.customer-reportedIssues that are reported by GitHub users external to the Azure organization.Issues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
Description
I'm implementing deep research with the Azure SDK, but I'm stuck in what feels like endless calls as described below. I'd really appreciate any help.
Reference
- Official doc: How to use the Deep Research tool
- Implementation follows the above: Deep Research tool with Bing connection + O3 model, then agent creation and run. Project and region are set per documentation.
What we did (code)
### 1. Imports and Deep Research tool creation
from azure.ai.projects import AIProjectClient
from azure.ai.agents import AgentsClient
from azure.ai.agents.models import DeepResearchTool, MessageRole
...
# Deep Research tool init (same as docs: bing_grounding_connection_id, deep_research_model)
deep_research_tool = DeepResearchTool(
bing_grounding_connection_id=bing_connection_id,
deep_research_model=deep_research_model,
)2. Creating an agent with the Deep Research tool
agent = agents_client.create_agent(
model=model_deployment_name, name=agent_name,
instructions="You are a helpful Agent that assists in researching scientific topics.", tools=deep_research_tool.definitions,)- If AZURE_AGENT_ID is set, we use get_agent(); otherwise we create a new agent with only the Deep Research tool as above.
Problem
- During the run, internal reasoning (e.g. cot_summary) repeatedly shows thoughts like “search doesn’t seem to work well” and “let’s try changing the query.”
- So we suspect Bing search is not working correctly inside the Deep Research pipeline.
- If we wait for 100+ search calls, a final report sometimes appears, but the number of calls and cost are excessively high, so this does not look like correct behavior and we suspect something is wrong.
Log (cot_summary) example
Example of cot_summary (The real run log is shown below)
cot_summary: Search doesn't seem to be working well. Let's try changing the query.
cot_summary: Looks like backend issues. Retrying.
cot_summary: Might be internet issues. Trying a different search term.
cot_summary: Could be a permissions problem. Trying again with a different query.
... (similar reasoning repeats)
Note (unlikely to be firewall/region)
An agent with only the Bing search tool (same Bing resource) returns web search results and answers normally.
So we don’t think this is a firewall, region, or Bing resource configuration issue.
he same issue is reproducible in the playground as well as in code: 100+ calls and cot_summary indicating that search results are not being fetched correctly. So it doesn’t seem to be a code-only issue. We’d like to know whether this is an inherent limitation of the Deep Research tool or something we’ve misconfigured.
Minimal code example (relevant parts only)
from azure.ai.projects import AIProjectClient
from azure.ai.agents import AgentsClient
from azure.ai.agents.models import DeepResearchTool, MessageRole
from azure.identity import DefaultAzureCredential # or ClientSecretCredential
# Config (from env or app config)
project_endpoint = "https://<your-resource>.services.ai.azure.com/api/projects/<project>"
deep_research_model = "o3-deep-research-..." # AZURE_DEEP_RESEARCH_MODEL_DEPLOYMENT_NAME
model_deployment_name = "gpt-4o-..." # base model for agent
bing_resource_name = "your-bing-connection" # AZURE_BING_RESOURCE_NAME
bing_connection_id_config = None # or full AZURE_BING_CONNECTION_ID
existing_agent_id = None # or AZURE_AGENT_ID to reuse an agent
api_version = "2025-11-15-preview"
credential = DefaultAzureCredential()
# 1) Resolve Bing connection ID
project_client = AIProjectClient(endpoint=project_endpoint, credential=credential, api_version=api_version)
bing_connection_id = None
if bing_resource_name:
conn = project_client.connections.get(name=bing_resource_name)
if conn and getattr(conn, "id", None):
bing_connection_id = conn.id
if not bing_connection_id and bing_connection_id_config:
bing_connection_id = bing_connection_id_config
# ... validate bing_connection_id not empty ...
# 2) Deep Research tool
deep_research_tool = DeepResearchTool(
bing_grounding_connection_id=bing_connection_id,
deep_research_model=deep_research_model,
)
# 3) Agents client and agent (reuse or create)
agents_client = AgentsClient(endpoint=project_endpoint, credential=credential, api_version=api_version)
agent = None
if existing_agent_id:
agent = agents_client.get_agent(existing_agent_id)
if agent is None:
agent = agents_client.create_agent(
model=model_deployment_name,
name="Research_Agent_TEST",
instructions="You are a helpful Agent that assists in researching scientific topics.",
tools=deep_research_tool.definitions,
)
# 4) Run
thread = agents_client.threads.create()
agents_client.messages.create(thread_id=thread.id, role="user", content="Your research question here")
run = agents_client.runs.create_and_process(
thread_id=thread.id,
agent_id=agent.id,
truncation_strategy={"type": "last_messages", "last_messages": 30},
)
final_message = agents_client.messages.get_last_message_by_role(thread_id=thread.id, role=MessageRole.AGENT)
# final_message contains cot_summary-style reasoning and (often empty or minimal) report body- Actual log example (user prompt and cot_summary)
User
Assess the UK outlook for 2026 - economic growth and inflation, based on IMF sources and provide a detailed report.
Agent
I will review the IMF's most recent analysis to assess the UK’s economic growth and inflation outlook for 2026. This will include projections, key macroeconomic indicators, and any relevant context from official IMF reports. I’ll provide a comprehensive report shortly. Title: UK Economic Outlook 2026 from IMF Sources Starting deep research...
Agent
cot_summary: **Gathering economic insights** I'm piecing together the UK economic outlook for 2026, focusing on growth and inflation forecasts using IMF sources, including key macroeconomic indicators and global context.
Agent
cot_summary: **Rephrasing the query** I'm thinking through this: perhaps refining the question to a more straightforward version will yield better results.
Agent
cot_summary: **Searching for data** I’m looking for the 2026 forecast on the IMF website. Options include the "World Economic Outlook 2023" or "World Economic Outlook 2024" for specific references.
Agent
cot_summary: **Considering alternatives** I'm thinking about trying "source: google" instead of Bing to see if it helps resolve the error.
Agent
cot_summary: **Evaluating options** I'm considering different search terms to find the IMF's 2026 forecast for the UK's growth, like "IMF UK 2026 WEO 2023" or "IMF forecast UK 2026 growth".
Agent
cot_summary: **Refining the search** I'm narrowing down the search to "IMF October 2024 WEO UK" to find the most relevant information.
Agent
cot_summary: **Narrowing my focus** OK, let's refine the search to refine results. Time to zoom in and tighten things up.
Agent
cot_summary: **Evaluating alternatives** I'm gathering info on Google's potential benefits.
Agent
cot_summary: Pulling up the IMF site directly or tweaking the search could yield better results.
Agent
cot_summary: **Piecing together macroeconomic context** Thinking about IMF UK forecasts, inflation trends, and global economic events to analyze 2026 growth and potential risks.

Metadata
Metadata
Assignees
Labels
AI ProjectsService AttentionWorkflow: This issue is responsible by Azure service team.Workflow: This issue is responsible by Azure service team.customer-reportedIssues that are reported by GitHub users external to the Azure organization.Issues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatThe issue doesn't require a change to the product in order to be resolved. Most issues start as that