Skip to content

Commit 90a15f7

Browse files
authored
1.0.0b12 release of azure.ai.projects SDK (#41196)
1 parent 4859cb8 commit 90a15f7

File tree

78 files changed

+2267
-1788
lines changed

Some content is hidden

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

78 files changed

+2267
-1788
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@
255255

256256
# PRLabel: %AI Projects
257257
# ServiceLabel: %AI Projects %Service Attention
258-
/sdk/ai/azure-ai-projects/ @dargilco @jhakulin
258+
/sdk/ai/azure-ai-projects/ @dargilco @jhakulin @trangevi @glharper @nick863 @howieleung
259259

260260

261261
# PRLabel: %HDInsight

sdk/ai/azure-ai-projects/AGENTS_MIGRATION_GUIDE.md

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
# Agents migration guide from Hub-based projects to Endpoint-based projects.
2-
This guide describes migration from hub-based to Endpoint-based projects. To create a Endpoint-based project, please use one of the deployment scripts on [foundry samples repository](https://github.com/azure-ai-foundry/foundry-samples/tree/main/samples/microsoft/infrastructure-setup) appropriate for your scenario, also you can use Azure AI Foundry UI. The support of hub-based projects was dropped in `azure-ai-projects` version `1.0.0b11`. In this document, we show the operation implementation of before `1.0.0b11` in **Hub-based** secion, followed by code for `azure-ai-projects` version `1.0.0b11` or later in **Endpoint-based**.
1+
# Agents migration guide from Hub-based projects to Endpoint-based projects
2+
3+
This guide describes migration from hub-based to Endpoint-based projects. To create a Endpoint-based project, please use one of the deployment scripts on [foundry samples repository](https://github.com/azure-ai-foundry/foundry-samples/tree/main/samples/microsoft/infrastructure-setup) appropriate for your scenario, also you can use Azure AI Foundry UI. The support of hub-based projects was dropped in `azure-ai-projects` version `1.0.0b11`. In this document, we show the operation implementation of before `1.0.0b11` in **Hub-based** section, followed by code for `azure-ai-projects` version `1.0.0b11` or later in **Endpoint-based**.
34

45
## Import changes
56

@@ -109,9 +110,11 @@ Files Operations
109110
| `project_client.agents.delete_file` | `project_client.agents.files.delete` |
110111

111112
## API changes
113+
112114
1. Create project. The connection string is replaced by the endpoint. The project endpoint URL has the form https://\<your-ai-services-account-name\>.services.ai.azure.com/api/projects/\<your-project-name\>. It can be found in your Azure AI Foundry Project overview page.
113115

114116
**Hub-based**
117+
115118
```python
116119
project_client = AIProjectClient.from_connection_string(
117120
credential=DefaultAzureCredential(),
@@ -120,22 +123,27 @@ Files Operations
120123
```
121124

122125
**Endpoint-based**
126+
123127
```python
124128
project_client = AIProjectClient(endpoint=endpoint, credential=DefaultAzureCredential())
125129
```
130+
126131
2. Crate an agent. In the new versions of SDK, the agent can be created using project client or directly created by using `AgentsClient` constructor. In the code below, `project_client.agents`is an `AgentsClient` instance so `project_client.agents` and `agents_client` can be used interchangeably. For simplicity we will use ` project_client.agents `.
127132

128133
**Hub-based**
134+
129135
```python
130136
agent = project_client.agents.create_agent(
131137
model= "gpt-4o",
132138
name="my-assistant",
133139
instructions="You are helpful assistant",
134140
)
135141
```
136-
**Endpoint-based**
137142

138-
Agent is instantiated using `AIProjectClient `
143+
**Endpoint-based**
144+
145+
Agent is instantiated using `AIProjectClient`
146+
139147
```python
140148
agent = project_client.agents.create_agent(
141149
model="gpt-4o",
@@ -145,6 +153,7 @@ Files Operations
145153
```
146154

147155
Agent is instantiated using `AgentsClient` constructor:
156+
148157
```python
149158
from azure.ai.agents import AgentsClient
150159

@@ -158,9 +167,11 @@ Files Operations
158167
instructions="You are helpful agent",
159168
)
160169
```
170+
161171
3. List agents. New version of SDK allows more convenient ways of listing threads, messages and agents by returning `ItemPaged` and `AsyncItemPaged`. The list of returned items is split by pages, which may be consequently returned to user. Below we will demonstrate this mechanism for agents. The `limit` parameter defines the number of items on the page. This example is also applicable for listing threads, runs, run steps, vector stores, files in vector store, and messages.
162172

163173
**Hub-based**
174+
164175
```python
165176
has_more = True
166177
last_id = None
@@ -173,6 +184,7 @@ Files Operations
173184
```
174185

175186
**Endpoint-based**
187+
176188
```python
177189
agents = project_client.agents.list_agents(limit=2)
178190
# Iterate items by page. Each page will be limited by two items.
@@ -190,29 +202,36 @@ Files Operations
190202
4. Delete agent. In versions azure-ai-projects 1.0.0b11, all deletion operations used to return deletion status, for example, deletion of agent was returning `AgentDeletionStatus`. In 1.0.0b11 and later, these operations do not return a value.
191203

192204
**Hub-based**
205+
193206
```python
194207
deletion_status = project_client.agents.delete_agent(agent.id)
195208
print(deletion_status.deleted)
196209
```
197210

198211
**Endpoint-based**
212+
199213
```python
200214
project_client.agents.delete_agent(agent.id)
201215
```
202216

203217
5. Create a thread.
204218

205219
**Hub-based**
220+
206221
```python
207222
thread = project_client.agents.create_thread()
208223
```
224+
209225
**Endpoint-based**
226+
210227
```python
211228
thread = project_client.agents.threads.create()
212229
```
230+
213231
6. List threads.
214232

215233
**Hub-based**
234+
216235
```python
217236
with project_client:
218237
last_id = None
@@ -229,6 +248,7 @@ Files Operations
229248
```
230249

231250
**Endpoint-based**
251+
232252
```python
233253
threads = project_client.agents.threads.list(limit=2)
234254
# Iterate items by page. Each page will be limited by two items.
@@ -246,42 +266,52 @@ Files Operations
246266
7. Delete the thread. In previous SDK thread deletion used to return ` ThreadDeletionStatus` object, while in new version it does not return value.
247267

248268
**Hub-based**
269+
249270
```python
250271
delete_status = project_client.agents.delete_thread(tread_id)
251272
print(delete_status.deleted)
252273
```
253274

254275
**Endpoint-based**
276+
255277
```python
256278
project_client.agents.threads.delete(tread_id)
257279
```
280+
258281
8. Create the message on a thread.
259282

260283
**Hub-based**
284+
261285
```python
262286
message = project_client.agents.create_message(thread_id=thread.id, role="user", content="The message text.")
263287
```
264288

265289
**Endpoint-based**
290+
266291
```python
267292
message = agents_client.messages.create(thread_id=thread.id, role="user", content=" The message text."")
268293
```
294+
269295
9. Create and get the run.
270296

271297
**Hub-based**
298+
272299
```python
273300
run = project_client.agents.runs.create(thread_id=thread.id, agent_id=agent.id)
274301
run = project_client.agents.get_run(thread_id=thread.id, run_id=run.id)
275302
```
276303

277304
**Endpoint-based**
305+
278306
```python
279307
run = project_client.agents.runs.create(thread_id=thread.id, agent_id=agent.id)
280308
run = project_client.agents.runs.get(thread_id=thread.id, run_id=run.id)
281309
```
310+
282311
10. List Runs.
283312

284313
**Hub-based**
314+
285315
```python
286316
has_more = True
287317
last_id = None
@@ -294,6 +324,7 @@ Files Operations
294324
```
295325

296326
**Endpoint-based**
327+
297328
```python
298329
runs = project_client.agents.runs.list(thread.id)
299330
for one_run in runs:
@@ -303,6 +334,7 @@ Files Operations
303334
11. List Run steps.
304335

305336
**Hub-based**
337+
306338
```python
307339
has_more = True
308340
last_id = None
@@ -315,6 +347,7 @@ Files Operations
315347
```
316348

317349
**Endpoint-based**
350+
318351
```python
319352
run_steps = project_client.agents.run_steps.list(thread.id, run.id)
320353
for one_run_step in run_steps:
@@ -324,6 +357,7 @@ Files Operations
324357
12. Using streams.
325358

326359
**Hub-based**
360+
327361
```python
328362
with project_client.agents.create_stream(thread_id=thread.id, agent_id=agent.id) as stream:
329363
for event_type, event_data, func_return in stream:
@@ -334,6 +368,7 @@ Files Operations
334368
```
335369

336370
**Endpoint-based**
371+
337372
```python
338373
with project_client.agents.runs.stream(thread_id=thread.id, agent_id=agent.id, event_handler=MyEventHandler()) as stream:
339374
for event_type, event_data, func_return in stream:
@@ -346,6 +381,7 @@ Files Operations
346381
13. List messages.
347382

348383
**Hub-based**
384+
349385
```python
350386
messages = project_client.agents.list_messages(thread_id=thread.id)
351387
# In code below we assume that the number of messages fits one page for brevity.
@@ -356,16 +392,19 @@ Files Operations
356392
```
357393

358394
**Endpoint-based**
395+
359396
```python
360397
messages = project_client.agents.messages.list(thread_id=thread.id)
361398
for msg in messages:
362399
if msg.text_messages:
363400
last_text = msg.text_messages[-1]
364401
print(f"{msg.role}: {last_text.text.value}")
365402
```
403+
366404
14. Create, list and delete files are now handled by file operations, again, delete call in new SDK version does not return a value.
367405

368406
**Hub-based**
407+
369408
```python
370409
# Create file
371410
file = project_client.agents.upload_file_and_poll(file_path="product_info_1.md", purpose=FilePurpose.AGENTS)
@@ -379,6 +418,7 @@ Files Operations
379418
```
380419

381420
**Endpoint-based**
421+
382422
```python
383423
# Create file
384424
file = project_client.agents.files.upload_and_poll(file_path=asset_file_path, purpose=FilePurpose.AGENTS)
@@ -389,9 +429,11 @@ Files Operations
389429
# Delete file.
390430
project_client.agents.files.delete(file_id=file.id)
391431
```
432+
392433
15. Create, list vector store files list and delete vector stores.
393434

394435
**Hub-based**
436+
395437
```python
396438
# Create a vector store with no file and wait for it to be processed
397439
vector_store = project_client.agents.create_vector_store_and_poll(file_ids=[file.id], name="sample_vector_store")
@@ -421,6 +463,7 @@ Files Operations
421463
```
422464

423465
**Endpoint-based**
466+
424467
```python
425468
# Create a vector store with no file and wait for it to be processed
426469
vector_store = project_client.agents.vector_stores.create_and_poll(file_ids=[file.id], name="my_vectorstore")
@@ -441,6 +484,7 @@ Files Operations
441484
16. Vector store batch file search.
442485

443486
**Hub-based**
487+
444488
```python
445489
# Batch upload files
446490
vector_store_file_batch = project_client.agents.create_vector_store_file_batch_and_poll(
@@ -460,6 +504,7 @@ Files Operations
460504
```
461505

462506
**Endpoint-based**
507+
463508
```python
464509
# Batch upload files
465510
vector_store_file_batch = project_client.agents.vector_store_file_batches.create_and_poll(

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
11
# Release History
22

3+
## 1.0.0b12 (2025-06-23)
4+
5+
### Breaking changes
6+
7+
* These 3 methods on `AIProjectClient` were removed: `.inference.get_chat_completions_client()`,
8+
`.inference.get_embeddings_client()` and `.inference.get_image_embeddings_client()`.
9+
For guidance on obtaining an authenticated `azure-ai-inference` client for your AI Foundry Project,
10+
refer to the updated samples in the `samples\inference` directory. For example,
11+
[sample_chat_completions_with_azure_ai_inference_client.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-projects/samples/inference/sample_chat_completions_with_azure_ai_inference_client.py). Alternatively, use the `.inference.get_azure_openai_client()` method to perform chat completions with an Azure OpenAI client.
12+
* Method argument name changes:
13+
* In method `.indexes.create_or_update()` argument `body` was renamed `index`.
14+
* In method `.datasets.create_or_update()` argument `body` was renamed `dataset_version`.
15+
* In method `.datasets.pending_upload()` argument `body` was renamed `pending_upload_request`.
16+
17+
### Bugs Fixed
18+
19+
* Fix to package function `enable_telemetry()` to correctly instrument `azure-ai-agents`.
20+
* Updated RedTeam target type visibility to allow for type being sent in the JSON for redteam run creation.
21+
22+
### Other
23+
24+
* Set dependency on `azure-ai-agents` version `1.0.0` or above,
25+
now that we have a stable release of the Agents package.
26+
327
## 1.0.0b11 (2025-05-15)
428

529
There have been significant updates with the release of version 1.0.0b11, including breaking changes.

0 commit comments

Comments
 (0)