Skip to content

Commit aa412e1

Browse files
authored
Merge pull request #4892 from aahill/rest-update
updating rest samples
2 parents 030bded + ccc17c4 commit aa412e1

13 files changed

+266
-211
lines changed

articles/ai-services/agents/how-to/tools/azure-ai-search-samples.md

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -413,26 +413,25 @@ for (let i = messages.data.length - 1; i >= 0; i--) {
413413
414414
:::zone pivot="rest"
415415
416-
## Create an Azure AI Client
417-
Follow the [REST API Quickstart](../../quickstart.md?pivots=rest-api) to set the right values for the environment variables `AZURE_AI_AGENTS_TOKEN` and `AZURE_AI_AGENTS_ENDPOINT`.
416+
Follow the [REST API Quickstart](../../quickstart.md?pivots=rest-api#api-call-information) to set the right values for the environment variables `AGENT_TOKEN`, `AZURE_AI_FOUNDRY_PROJECT_ENDPOINT` and `API_VERSION`.
418417
419418
## Get the connection ID for the Azure AI Search resource
420-
Follow the next section on how to get the connection ID from the Azure AI Foundry.
421419
422-
The second way to get the connection ID is to navigate to the project in the Azure AI Foundry and click on the **Connected resources** tab and then select your Azure AI Search resource.
420+
To get the connection ID, navigate to the project in the Azure AI Foundry and click on the **Connected resources** tab and then select your Azure AI Search resource.
423421
424422
:::image type="content" source="../../media/tools/ai-search/success-connection.png" alt-text="A screenshot of an AI Search resource connection page in Azure AI Foundry." lightbox="../../media/tools/ai-search/success-connection.png":::
425423
426-
In the URL, you see the wsid=/subscription/your-subscription-id..., this is the connection ID you need to use. Copy everything that comes after wsid=.
424+
In the URL, you see the `wsid=/subscription/your-subscription-id...`, this is the connection ID you need to use. Copy everything that comes after `wsid=`.
427425
428426
:::image type="content" source="../../media/tools/ai-search/connection-id.png" alt-text="A screenshot of an AI Search resource connection and how to copy the connection ID." lightbox="../../media/tools/ai-search/connection-id.png":::
429427
430428
## Configure the Azure AI Search tool
431429
Using the connection ID you got in the previous step, you can now configure the Azure AI Search tool to use your Azure AI Search index.
432430
433-
```console
434-
curl $AZURE_AI_AGENTS_ENDPOINT/assistants?api-version=2024-12-01-preview \
435-
-H "Authorization: Bearer $AZURE_AI_AGENTS_TOKEN" \
431+
```bash
432+
curl --request POST \
433+
--url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/assistants?api-version=$API_VERSION \
434+
-H "Authorization: Bearer $AGENT_TOKEN" \
436435
-H "Content-Type: application/json" \
437436
-d '{
438437
"instructions": "You are a helpful agent.",
@@ -460,18 +459,20 @@ Now that the agent is created, ask it questions about the data in your Azure AI
460459
461460
#### Create a thread
462461
463-
```console
464-
curl $AZURE_AI_AGENTS_ENDPOINT/threads?api-version=2024-12-01-preview \
465-
-H "Authorization: Bearer $AZURE_AI_AGENTS_TOKEN" \
462+
```bash
463+
curl --request POST \
464+
--url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads?api-version=$API_VERSION \
465+
-H "Authorization: Bearer $AGENT_TOKEN" \
466466
-H "Content-Type: application/json" \
467467
-d ''
468468
```
469469
470470
#### Add a user question to the thread
471471
472-
```console
473-
curl $AZURE_AI_AGENTS_ENDPOINT/threads/thread_abc123/messages?api-version=2024-12-01-preview \
474-
-H "Authorization: Bearer $AZURE_AI_AGENTS_TOKEN" \
472+
```bash
473+
curl --request POST \
474+
--url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads/thread_abc123/messages?api-version=$API_VERSION \
475+
-H "Authorization: Bearer $AGENT_TOKEN" \
475476
-H "Content-Type: application/json" \
476477
-d '{
477478
"role": "user",
@@ -480,9 +481,10 @@ curl $AZURE_AI_AGENTS_ENDPOINT/threads/thread_abc123/messages?api-version=2024-1
480481
```
481482
#### Run the thread
482483
483-
```console
484-
curl $AZURE_AI_AGENTS_ENDPOINT/threads/thread_abc123/runs?api-version=2024-12-01-preview \
485-
-H "Authorization: Bearer $AZURE_AI_AGENTS_TOKEN" \
484+
```bash
485+
curl --request POST \
486+
--url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads/thread_abc123/runs?api-version=$API_VERSION \
487+
-H "Authorization: Bearer $AGENT_TOKEN" \
486488
-H "Content-Type: application/json" \
487489
-d '{
488490
"assistant_id": "asst_abc123",
@@ -491,16 +493,18 @@ curl $AZURE_AI_AGENTS_ENDPOINT/threads/thread_abc123/runs?api-version=2024-12-01
491493
492494
#### Retrieve the status of the run
493495
494-
```console
495-
curl $AZURE_AI_AGENTS_ENDPOINT/threads/thread_abc123/runs/run_abc123?api-version=2024-12-01-preview \
496-
-H "Authorization: Bearer $AZURE_AI_AGENTS_TOKEN"
496+
```bash
497+
curl --request GET \
498+
--url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads/thread_abc123/runs/run_abc123?api-version=$API_VERSION \
499+
-H "Authorization: Bearer $AGENT_TOKEN"
497500
```
498501
499502
#### Retrieve the agent response
500503
501-
```console
502-
curl $AZURE_AI_AGENTS_ENDPOINT/threads/thread_abc123/messages?api-version=2024-12-01-preview \
503-
-H "Authorization: Bearer $AZURE_AI_AGENTS_TOKEN"
504+
```bash
505+
curl --request GET \
506+
--url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads/thread_abc123/messages?api-version=$API_VERSION \
507+
-H "Authorization: Bearer $AGENT_TOKEN"
504508
```
505509
506510
:::zone-end

articles/ai-services/agents/how-to/tools/azure-functions-samples.md

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -176,14 +176,16 @@ For any issues with the Python code, create an issue on the [sample code reposit
176176

177177
::: zone pivot="rest"
178178

179-
## Create an AI project client and agent
179+
## Create an agent
180180

181181
In the sample below we create a client and an agent that has the tools definition for the Azure Function
182182

183-
Follow the [REST API Quickstart](../../quickstart.md?pivots=rest-api) to set the right values for the environment variables `AZURE_AI_AGENTS_TOKEN` and `AZURE_AI_AGENTS_ENDPOINT`. Then create the agent using:
184-
```console
185-
curl $AZURE_AI_AGENTS_ENDPOINT/assistants?api-version=2024-12-01-preview \
186-
-H "Authorization: Bearer $AZURE_AI_AGENTS_TOKEN" \
183+
Follow the [REST API Quickstart](../../quickstart.md?pivots=rest-api#api-call-information) to set the right values for the environment variables `AGENT_TOKEN`, `AZURE_AI_FOUNDRY_PROJECT_ENDPOINT` and `API_VERSION`.
184+
185+
```bash
186+
curl --request POST \
187+
--url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/assistants?api-version=$API_VERSION \
188+
-H "Authorization: Bearer $AGENT_TOKEN" \
187189
-H "Content-Type: application/json" \
188190
-d '{
189191
"instructions": "You are a helpful support agent. Answer the user's questions to the best of your ability.",
@@ -226,44 +228,49 @@ curl $AZURE_AI_AGENTS_ENDPOINT/assistants?api-version=2024-12-01-preview \
226228
227229
## Create a thread for the agent
228230
229-
```console
230-
curl $AZURE_AI_AGENTS_ENDPOINT/threads?api-version=2024-12-01-preview \
231-
-H "Authorization: Bearer $AZURE_AI_AGENTS_TOKEN" \
231+
```bash
232+
curl --request POST \
233+
--url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads?api-version=$API_VERSION \
234+
-H "Authorization: Bearer $AGENT_TOKEN" \
232235
-H "Content-Type: application/json" \
233236
-d ''
234237
```
235238
236239
## Create a run and check the output
237240
238-
```console
239-
curl $AZURE_AI_AGENTS_ENDPOINT/threads/thread_abc123/messages?api-version=2024-12-01-preview \
240-
-H "Authorization: Bearer $AZURE_AI_AGENTS_TOKEN" \
241+
```bash
242+
curl --request POST \
243+
--url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads/thread_abc123/messages?api-version=$API_VERSION \
244+
-H "Authorization: Bearer $AGENT_TOKEN" \
241245
-H "Content-Type: application/json" \
242246
-d '{
243247
"role": "user",
244248
"content": "What is the weather in Seattle, WA?"
245249
}'
246250
```
247251
248-
```console
249-
curl $AZURE_AI_AGENTS_ENDPOINT/threads/thread_abc123/runs?api-version=2024-12-01-preview \
250-
-H "Authorization: Bearer $AZURE_AI_AGENTS_TOKEN" \
252+
```bash
253+
curl --request POST \
254+
--url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads/thread_abc123/runs?api-version=$API_VERSION \
255+
-H "Authorization: Bearer $AGENT_TOKEN" \
251256
-H "Content-Type: application/json" \
252257
-d '{
253258
"assistant_id": "asst_abc123",
254259
}'
255260
```
256261
257-
```console
258-
curl $AZURE_AI_AGENTS_ENDPOINT/threads/thread_abc123/runs/run_abc123?api-version=2024-12-01-preview \
259-
-H "Authorization: Bearer $AZURE_AI_AGENTS_TOKEN"
262+
```bash
263+
curl --request GET \
264+
--url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads/thread_abc123/runs/run_abc123?api-version=$API_VERSION \
265+
-H "Authorization: Bearer $AGENT_TOKEN"
260266
```
261267
262268
## Get the result of the run
263269
264-
```console
265-
curl $AZURE_AI_AGENTS_ENDPOINT/threads/thread_abc123/messages?api-version=2024-12-01-preview \
266-
-H "Authorization: Bearer $AZURE_AI_AGENTS_TOKEN"
270+
```bash
271+
curl --request GET \
272+
--url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads/thread_abc123/messages?api-version=$API_VERSION \
273+
-H "Authorization: Bearer $AGENT_TOKEN"
267274
```
268275
269276
::: zone-end

articles/ai-services/agents/how-to/tools/bing-code-samples.md

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Use this article to find step-by-step instructions and code samples for Groundin
2020
## Prerequisites
2121

2222
* A [connected Grounding with Bing Search resource](./bing-grounding.md#setup).
23+
* Your connection ID needs to be in this format: `/subscriptions/<subscription_id>/resourceGroups/<resource_group_name>/providers/Microsoft.CognitiveServices/accounts/<ai_service_name>/projects/<project_name>/connections/<connection_name>`
2324

2425
> [!IMPORTANT]
2526
> There are requirements for displaying Grounding with Bing Search results. See the [overview article](./bing-grounding.md#how-to-display-grounding-with-bing-search-results) for details.
@@ -394,23 +395,20 @@ Create a run and observe that the model uses the Grounding with Bing Search tool
394395
395396
::: zone pivot="rest"
396397
397-
## Create a project client
398-
399-
Create a client object, which will contain the connection string for connecting to your AI project and other resources.
400-
401398
>[!IMPORTANT]
402399
> 1. This REST API allows developers to invoke the Grounding with Bing Search tool through the Azure AI Foundry Agent Service. It does not send calls to the Grounding with Bing Search API directly.
403400
404-
Follow the [REST API Quickstart](../../quickstart.md?pivots=rest-api) to set the right values for the environment variables `AZURE_AI_AGENTS_TOKEN` and `AZURE_AI_AGENTS_ENDPOINT`. The client creation is demonstrated in the next section.
401+
Follow the [REST API Quickstart](../../quickstart.md?pivots=rest-api#api-call-information) to set the right values for the environment variables `AGENT_TOKEN`, `AZURE_AI_FOUNDRY_PROJECT_ENDPOINT` and `API_VERSION`.
405402
406403
407404
## Create an Agent with the Grounding with Bing search tool enabled
408405
409406
To make the Grounding with Bing search tool available to your agent, use a connection to initialize the tool and attach it to the agent. You can find your connection in the **connected resources** section of your project in the [Azure AI Foundry portal](https://ai.azure.com/).
410407
411-
```console
412-
curl $AZURE_AI_AGENTS_ENDPOINT/assistants?api-version=2025-05-01 \
413-
-H "Authorization: Bearer $AZURE_AI_AGENTS_TOKEN" \
408+
```bash
409+
curl --request POST \
410+
--url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/assistants?api-version=$API_VERSION \
411+
-H "Authorization: Bearer $AGENT_TOKEN" \
414412
-H "Content-Type: application/json" \
415413
-d '{
416414
"instructions": "You are a helpful agent.",
@@ -437,18 +435,20 @@ curl $AZURE_AI_AGENTS_ENDPOINT/assistants?api-version=2025-05-01 \
437435
438436
## Create a thread
439437
440-
```console
441-
curl $AZURE_AI_AGENTS_ENDPOINT/threads?api-version=2025-05-01 \
442-
-H "Authorization: Bearer $AZURE_AI_AGENTS_TOKEN" \
438+
```bash
439+
curl --request POST \
440+
--url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads?api-version=$API_VERSION \
441+
-H "Authorization: Bearer $AGENT_TOKEN" \
443442
-H "Content-Type: application/json" \
444443
-d ''
445444
```
446445
447446
## Add a user question to the thread
448447
449-
```console
450-
curl $AZURE_AI_AGENTS_ENDPOINT/threads/thread_abc123/messages?api-version=2025-05-01 \
451-
-H "Authorization: Bearer $AZURE_AI_AGENTS_TOKEN" \
448+
```bash
449+
curl --request POST \
450+
--url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads/thread_abc123/messages?api-version=$API_VERSION \
451+
-H "Authorization: Bearer $AGENT_TOKEN" \
452452
-H "Content-Type: application/json" \
453453
-d '{
454454
"role": "user",
@@ -460,9 +460,10 @@ curl $AZURE_AI_AGENTS_ENDPOINT/threads/thread_abc123/messages?api-version=2025-0
460460
461461
Create a run and observe that the model uses the Grounding with Bing Search tool to provide a response to the user's question.
462462
463-
```console
464-
curl $AZURE_AI_AGENTS_ENDPOINT/threads/thread_abc123/runs?api-version=2025-05-01 \
465-
-H "Authorization: Bearer $AZURE_AI_AGENTS_TOKEN" \
463+
```bash
464+
curl --request POST \
465+
--url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads/thread_abc123/runs?api-version=$API_VERSION \
466+
-H "Authorization: Bearer $AGENT_TOKEN" \
466467
-H "Content-Type: application/json" \
467468
-d '{
468469
"assistant_id": "asst_abc123",
@@ -471,20 +472,22 @@ curl $AZURE_AI_AGENTS_ENDPOINT/threads/thread_abc123/runs?api-version=2025-05-01
471472
472473
### Retrieve the status of the run
473474
474-
```console
475-
curl $AZURE_AI_AGENTS_ENDPOINT/threads/thread_abc123/runs/run_abc123?api-version=2025-05-01 \
476-
-H "Authorization: Bearer $AZURE_AI_AGENTS_TOKEN"
475+
```bash
476+
curl --request GET \
477+
--url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads/thread_abc123/runs/run_abc123?api-version=$API_VERSION \
478+
-H "Authorization: Bearer $AGENT_TOKEN"
477479
```
478480
479481
### Retrieve the agent response
480482
481-
```console
482-
curl $AZURE_AI_AGENTS_ENDPOINT/threads/thread_abc123/messages?api-version=2025-05-01 \
483-
-H "Authorization: Bearer $AZURE_AI_AGENTS_TOKEN"
483+
```bash
484+
curl --request GET \
485+
--url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads/thread_abc123/messages?api-version=$API_VERSION \
486+
-H "Authorization: Bearer $AGENT_TOKEN"
484487
```
485488
486489
::: zone-end
487490
488491
## Next steps
489492
490-
[See the full sample for Grounding with Bing Search.](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-projects/samples/agents/sample_agents_bing_grounding.py)
493+
[See the full sample for Grounding with Bing Search.](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-projects/samples/agents/sample_agents_bing_grounding.py)

articles/ai-services/agents/how-to/tools/bing-custom-search-samples.md

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -376,23 +376,20 @@ Create a run and observe that the model uses the Grounding with Bing Custom Sear
376376
377377
::: zone pivot="rest"
378378
379-
## Create a project client
380-
381-
Create a client object, which will contain the connection string for connecting to your AI project and other resources.
382-
383379
>[!IMPORTANT]
384380
> 1. This REST API allows developers to invoke the Grounding with Bing Custom Search tool through the Azure AI Foundry Agent Service. It does not send calls to the Grounding with Bing Custom Search API directly.
385381
386-
Follow the [REST API Quickstart](../../quickstart.md?pivots=rest-api) to set the right values for the environment variables `AZURE_AI_AGENTS_TOKEN` and `AZURE_AI_AGENTS_ENDPOINT`. The client creation is demonstrated in the next section.
382+
Follow the [REST API Quickstart](../../quickstart.md?pivots=rest-api#api-call-information) to set the right values for the environment variables `AGENT_TOKEN`, `AZURE_AI_FOUNDRY_PROJECT_ENDPOINT` and `API_VERSION`.
387383
388384
389385
## Create an Agent with the Grounding with Bing Custom Search tool enabled
390386
391387
To make the Grounding with Bing Custom Search tool available to your agent, use a connection to initialize the tool and attach it to the agent. You can find your connection in the **connected resources** section of your project in the [Azure AI Foundry portal](https://ai.azure.com/).
392388
393-
```console
394-
curl $AZURE_AI_AGENTS_ENDPOINT/assistants?api-version=2025-05-15-preview \
395-
-H "Authorization: Bearer $AZURE_AI_AGENTS_TOKEN" \
389+
```bash
390+
curl --request POST \
391+
--url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/assistants?api-version=$API_VERSION \
392+
-H "Authorization: Bearer $AGENT_TOKEN" \
396393
-H "Content-Type: application/json" \
397394
-d '{
398395
"instructions": "You are a helpful agent.",
@@ -420,18 +417,20 @@ curl $AZURE_AI_AGENTS_ENDPOINT/assistants?api-version=2025-05-15-preview \
420417
421418
## Create a thread
422419
423-
```console
424-
curl $AZURE_AI_AGENTS_ENDPOINT/threads?api-version=2025-05-15-preview \
425-
-H "Authorization: Bearer $AZURE_AI_AGENTS_TOKEN" \
420+
```bash
421+
curl --request POST \
422+
--url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads?api-version=$API_VERSION \
423+
-H "Authorization: Bearer $AGENT_TOKEN" \
426424
-H "Content-Type: application/json" \
427425
-d ''
428426
```
429427
430428
## Add a user question to the thread
431429
432-
```console
433-
curl $AZURE_AI_AGENTS_ENDPOINT/threads/thread_abc123/messages?api-version=2025-05-15-preview \
434-
-H "Authorization: Bearer $AZURE_AI_AGENTS_TOKEN" \
430+
```bash
431+
curl --request POST \
432+
--url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads/thread_abc123/messages?api-version=api-version=$API_VERSION \
433+
-H "Authorization: Bearer $AGENT_TOKEN" \
435434
-H "Content-Type: application/json" \
436435
-d '{
437436
"role": "user",
@@ -443,9 +442,10 @@ curl $AZURE_AI_AGENTS_ENDPOINT/threads/thread_abc123/messages?api-version=2025-0
443442
444443
Create a run and observe that the model uses the Grounding with Bing Custom Search tool to provide a response to the user's question.
445444
446-
```console
447-
curl $AZURE_AI_AGENTS_ENDPOINT/threads/thread_abc123/runs?api-version=2025-05-15-preview \
448-
-H "Authorization: Bearer $AZURE_AI_AGENTS_TOKEN" \
445+
```bash
446+
curl --request POST \
447+
--url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads/thread_abc123/runs?api-version=$API_VERSION \
448+
-H "Authorization: Bearer $AGENT_TOKEN" \
449449
-H "Content-Type: application/json" \
450450
-d '{
451451
"assistant_id": "asst_abc123",
@@ -454,16 +454,18 @@ curl $AZURE_AI_AGENTS_ENDPOINT/threads/thread_abc123/runs?api-version=2025-05-15
454454
455455
### Retrieve the status of the run
456456
457-
```console
458-
curl $AZURE_AI_AGENTS_ENDPOINT/threads/thread_abc123/runs/run_abc123?api-version=2025-05-15-preview \
459-
-H "Authorization: Bearer $AZURE_AI_AGENTS_TOKEN"
457+
```bash
458+
curl --request GET \
459+
--url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads/thread_abc123/runs/run_abc123?api-version=$API_VERSION \
460+
-H "Authorization: Bearer $AGENT_TOKEN"
460461
```
461462
462463
### Retrieve the agent response
463464
464-
```console
465-
curl $AZURE_AI_AGENTS_ENDPOINT/threads/thread_abc123/messages?api-version=2025-05-15-preview \
466-
-H "Authorization: Bearer $AZURE_AI_AGENTS_TOKEN"
465+
```bash
466+
curl --request GET \
467+
--url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads/thread_abc123/messages?api-version=$API_VERSION \
468+
-H "Authorization: Bearer $AGENT_TOKEN"
467469
```
468470
469471
::: zone-end

0 commit comments

Comments
 (0)