Skip to content

Commit 56bc902

Browse files
howieleungnick863Copilotl0lawrencedargilco
authored
Feature/azure ai agents/1.1.0b3 (#41829)
* Demonstrate the include parameter usage. (#41523) * Demonstrate the include parameter usage * Enable tests for reference text inclusion. * Add file search with streaming samples (#41551) * Small fix and use projects for getting connection ID (#41576) * Update readme (#41527) * Update readme * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * update * Takes Jarno recommendation --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Howie/next lint (#41621) * Fix pylintrc to exclude agents generated code (#41612) * Fix pylintrc to exclude agents generated code * Update pylintrc Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Resolved * Update eng/pylintrc * Update pylintrc --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Libba Lawrence <llawrence@microsoft.com> * Fix lint --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Libba Lawrence <llawrence@microsoft.com> * Add support for Deep Research tool (#41696) * Minor updates related to Deep Research tool & samples (#41783) * Run black * Remove outdated comment from samples per Jarno's advice * Update chagne log to mention Deep Research tool * fixing a tracing bug with paged lists (#41777) * fixing a tracing bug with paged lists * updating tests * updating assests.json * fixing code checker issues * updating tests * updating assets.json * updating assests.json * updating assests.json * Improve doc for create agent and agentsclient init (#41821) (#41824) * Improve doc for create agent and agentsclient init * resolved comments * resolved comments * Deep Research update (#41823) * update deep research samples * add async sample * update READEM * update * update samples * pr feedback * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md --------- Co-authored-by: Nikolay Rovinskiy <30440255+nick863@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Libba Lawrence <llawrence@microsoft.com> Co-authored-by: Darren Cohen <39422044+dargilco@users.noreply.github.com> Co-authored-by: M-Hietala <78813398+M-Hietala@users.noreply.github.com> Co-authored-by: Jarno Hakulinen <jhakulin@microsoft.com>
1 parent 7d7e69c commit 56bc902

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1757
-414
lines changed

sdk/ai/azure-ai-agents/CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,22 @@
22

33
# Release History
44

5+
## 1.1.0b3 (2025-06-30)
6+
7+
### Features Added
8+
9+
- Added support for Deep Research tool. For more information, see https://aka.ms/agents-deep-research.
10+
11+
### Bugs Fixed
12+
13+
- Fixed a tracing related bug that caused an error when process was ending if messages or run steps were listed and the resulting list was not iterated completely.
14+
15+
### Sample updates
16+
17+
- The file search samples were updated to demonstrate retrieving text associated with citations.
18+
- Added samples for file search citation with streaming.
19+
- Added samples showing usage of Deep Research tool (sync and async).
20+
521
## 1.1.0b2 (2025-06-09)
622

723
### Bugs Fixed
@@ -11,6 +27,7 @@
1127
- Fixed a tracing related bug that caused process_thread_run span to not appear when streaming is used without event handler.
1228

1329
### Sample updates
30+
1431
- Changed all samples to use `AIProjectClient` which is recommended to specify endpoint and credential.
1532
- Added `sample_agents_stream_iteration_with_functions.py`
1633

sdk/ai/azure-ai-agents/README.md

Lines changed: 126 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ To report an issue with the client library, or request additional features, plea
3737
- [Azure Function Call](#create-agent-with-azure-function-call)
3838
- [OpenAPI](#create-agent-with-openapi)
3939
- [Fabric data](#create-an-agent-with-fabric)
40+
- [Deep Research](#create-agent-with-deep-research)
4041
- [Create thread](#create-thread) with
4142
- [Tool resource](#create-thread-with-tool-resource)
4243
- [Create message](#create-message) with:
@@ -81,37 +82,96 @@ pip install azure-ai-agents
8182

8283
### Create and authenticate the client
8384

84-
To construct a synchronous client:
85+
To use this SDK, start by creating an `AIProjectClient`. For more information on `azure-ai-projects`, refer to its [README](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-projects/README.md).
86+
87+
Here is an example of creating a synchronous `AIProjectClient`:
8588

8689
```python
8790
import os
88-
from azure.ai.agents import AgentsClient
91+
from azure.ai.projects import AIProjectClient
8992
from azure.identity import DefaultAzureCredential
9093

91-
agents_client = AgentsClient(
94+
project_client = AIProjectClient(
9295
endpoint=os.environ["PROJECT_ENDPOINT"],
9396
credential=DefaultAzureCredential(),
9497
)
9598
```
9699

97-
To construct an asynchronous client, Install the additional package [aiohttp](https://pypi.org/project/aiohttp/):
100+
To construct an asynchronous client, install the `aiohttp` package:
98101

99102
```bash
100103
pip install aiohttp
101104
```
102105

103-
and update the code above to import `asyncio`, and import `AgentsClient` from the `azure.ai.agents.aio` namespace:
106+
Then use the code below with `AIProjectClient` and `DefaultAzureCredential` in `aio` packages:
107+
108+
```python
109+
import asyncio
110+
import os
111+
from azure.ai.projects.aio import AIProjectClient
112+
from azure.identity.aio import DefaultAzureCredential
113+
114+
async def main() -> None:
115+
project_client = AIProjectClient(
116+
endpoint=os.environ["PROJECT_ENDPOINT"],
117+
credential=DefaultAzureCredential(),
118+
)
119+
120+
if __name__ == "__main__":
121+
asyncio.run(main())
122+
```
123+
124+
Once you have an `AIProjectClient`, you can obtain an `AgentsClient` like this:
125+
126+
**Synchronous Client:**
127+
```python
128+
with project_client:
129+
agents_client = project_client.agents
130+
```
131+
132+
**Asynchronous Client:**
133+
```python
134+
async with project_client:
135+
agents_client = project_client.agents
136+
```
137+
138+
Alternatively, you can instantiate an AgentsClient directly as a standalone approach without using `azure-ai-projects`. However, this is not recommended, as it has limitations and lacks the integrated capabilities provided by using an `AIProjectClient`. Here is is the example:
104139

140+
**Synchronous Client:**
105141
```python
106142
import os
143+
from azure.ai.agents import AgentsClient
144+
from azure.identity import DefaultAzureCredential
145+
146+
agents_client = AgentsClient(
147+
endpoint=os.environ["PROJECT_ENDPOINT"],
148+
credential=DefaultAzureCredential()
149+
)
150+
151+
with agents_client:
152+
# your code to consume the client
153+
pass
154+
155+
```
156+
157+
**Asynchronous Client:**
158+
```python
107159
import asyncio
160+
import os
108161
from azure.ai.agents.aio import AgentsClient
109-
from azure.core.credentials import AzureKeyCredential
162+
from azure.identity.aio import DefaultAzureCredential
110163

111-
agent_client = AgentsClient(
112-
endpoint=os.environ["PROJECT_ENDPOINT"],
113-
credential=DefaultAzureCredential(),
114-
)
164+
async def main() -> None:
165+
agents_client = AgentsClient(
166+
endpoint=os.environ["PROJECT_ENDPOINT"],
167+
credential=DefaultAzureCredential()
168+
)
169+
async with agents_client:
170+
# your code to consume the client
171+
pass
172+
173+
if __name__ == "__main__":
174+
asyncio.run(main())
115175
```
116176

117177
## Examples
@@ -311,6 +371,47 @@ with project_client:
311371

312372
<!-- END SNIPPET -->
313373

374+
### Create Agent with Deep Research
375+
376+
To enable your Agent to do a detailed research of a topic, use the `DeepResearchTool` along with a connection to a Bing Grounding resource.
377+
This scenarios requires you to specify two model deployments. One is the generic chat model that does arbitration, and is
378+
specified as usual when you call the `create_agent` method. The other is the Deep Research model, which is specified
379+
when you define the `DeepResearchTool`.
380+
381+
Here is an example:
382+
383+
<!-- SNIPPET:sample_agents_deep_research.create_agent_with_deep_research_tool -->
384+
385+
```python
386+
conn_id = os.environ["AZURE_BING_CONNECTION_ID"]
387+
388+
# Initialize a Deep Research tool with Bing Connection ID and Deep Research model deployment name
389+
deep_research_tool = DeepResearchTool(
390+
bing_grounding_connection_id=conn_id,
391+
deep_research_model=os.environ["DEEP_RESEARCH_MODEL_DEPLOYMENT_NAME"],
392+
)
393+
394+
# Create Agent with the Deep Research tool and process Agent run
395+
with project_client:
396+
397+
with project_client.agents as agents_client:
398+
399+
# Create a new agent that has the Deep Research tool attached.
400+
# NOTE: To add Deep Research to an existing agent, fetch it with `get_agent(agent_id)` and then,
401+
# update the agent with the Deep Research tool.
402+
agent = agents_client.create_agent(
403+
model=os.environ["MODEL_DEPLOYMENT_NAME"],
404+
name="my-agent",
405+
instructions="You are a helpful Agent that assists in researching scientific topics.",
406+
tools=deep_research_tool.definitions,
407+
)
408+
```
409+
410+
<!-- END SNIPPET -->
411+
412+
> **Limitation**: The Deep Research tool is currently recommended **only** in non-streaming scenarios.
413+
> Using it with streaming can work, but it may occasionally time-out and is therefore not yet recommended.
414+
314415
### Create Agent with Azure AI Search
315416

316417
Azure AI Search is an enterprise search system for high-performance applications. It integrates with Azure OpenAI Service and Azure Machine Learning, offering advanced search technologies like vector search and full-text search. Ideal for knowledge base insights, information discovery, and automation. Creating an Agent with Azure AI Search requires an existing Azure AI Search Index. For more information and setup guides, see [Azure AI Search Tool Guide](https://learn.microsoft.com/azure/ai-services/agents/how-to/tools/azure-ai-search?tabs=azurecli%2Cpython&pivots=overview-azure-ai-search).
@@ -320,22 +421,24 @@ Here is an example to integrate Azure AI Search:
320421
<!-- SNIPPET:sample_agents_azure_ai_search.create_agent_with_azure_ai_search_tool -->
321422

322423
```python
323-
conn_id = os.environ["AI_AZURE_AI_CONNECTION_ID"]
324-
325-
print(conn_id)
326-
327-
# Initialize agent AI search tool and add the search index connection id
328-
ai_search = AzureAISearchTool(
329-
index_connection_id=conn_id, index_name="sample_index", query_type=AzureAISearchQueryType.SIMPLE, top_k=3, filter=""
330-
)
331-
332-
# Create agent with AI search tool and process agent run
333-
project_client = AIProjectClient(
424+
with AIProjectClient(
334425
endpoint=os.environ["PROJECT_ENDPOINT"],
335426
credential=DefaultAzureCredential(),
336-
)
427+
) as project_client:
428+
conn_id = project_client.connections.get_default(ConnectionType.AZURE_AI_SEARCH).id
429+
430+
print(conn_id)
431+
432+
# Initialize agent AI search tool and add the search index connection id
433+
ai_search = AzureAISearchTool(
434+
index_connection_id=conn_id,
435+
index_name="sample_index",
436+
query_type=AzureAISearchQueryType.SIMPLE,
437+
top_k=3,
438+
filter="",
439+
)
337440

338-
with project_client:
441+
# Create agent with AI search tool and process agent run
339442
agents_client = project_client.agents
340443

341444
agent = agents_client.create_agent(

sdk/ai/azure-ai-agents/_metadata.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"apiVersion": "2025-05-15-preview"
3+
}

sdk/ai/azure-ai-agents/apiview-properties.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
"azure.ai.agents.models.CodeInterpreterToolResource": "Azure.AI.Agents.CodeInterpreterToolResource",
2727
"azure.ai.agents.models.ConnectedAgentDetails": "Azure.AI.Agents.ConnectedAgentDetails",
2828
"azure.ai.agents.models.ConnectedAgentToolDefinition": "Azure.AI.Agents.ConnectedAgentToolDefinition",
29+
"azure.ai.agents.models.DeepResearchBingGroundingConnection": "Azure.AI.Agents.DeepResearchBingGroundingConnection",
30+
"azure.ai.agents.models.DeepResearchDetails": "Azure.AI.Agents.DeepResearchDetails",
31+
"azure.ai.agents.models.DeepResearchToolDefinition": "Azure.AI.Agents.DeepResearchToolDefinition",
2932
"azure.ai.agents.models.FabricDataAgentToolParameters": "Azure.AI.Agents.FabricDataAgentToolParameters",
3033
"azure.ai.agents.models.FileInfo": "Azure.AI.Agents.FileInfo",
3134
"azure.ai.agents.models.FileListResponse": "Azure.AI.Agents.FileListResponse",
@@ -101,6 +104,8 @@
101104
"azure.ai.agents.models.RunStepCodeInterpreterToolCall": "Azure.AI.Agents.RunStepCodeInterpreterToolCall",
102105
"azure.ai.agents.models.RunStepCodeInterpreterToolCallDetails": "Azure.AI.Agents.RunStepCodeInterpreterToolCallDetails",
103106
"azure.ai.agents.models.RunStepCompletionUsage": "Azure.AI.Agents.RunStepCompletionUsage",
107+
"azure.ai.agents.models.RunStepDeepResearchToolCall": "Azure.AI.Agents.RunStepDeepResearchToolCall",
108+
"azure.ai.agents.models.RunStepDeepResearchToolCallDetails": "Azure.AI.Agents.RunStepDeepResearchToolCallDetails",
104109
"azure.ai.agents.models.RunStepDelta": "Azure.AI.Agents.RunStepDelta",
105110
"azure.ai.agents.models.RunStepDeltaChunk": "Azure.AI.Agents.RunStepDeltaChunk",
106111
"azure.ai.agents.models.RunStepDeltaCodeInterpreterDetailItemObject": "Azure.AI.Agents.RunStepDeltaCodeInterpreterDetailItemObject",

sdk/ai/azure-ai-agents/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "python",
44
"TagPrefix": "python/ai/azure-ai-agents",
5-
"Tag": "python/ai/azure-ai-agents_c924b708a0"
5+
"Tag": "python/ai/azure-ai-agents_ca2235eed8"
66
}

0 commit comments

Comments
 (0)