You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/search/includes/quickstarts/agentic-retrieval-python.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -227,9 +227,9 @@ with SearchIndexingBufferedSender(endpoint=endpoint, index_name=index_name, cred
227
227
print(f"Documents uploaded to index '{index_name}'")
228
228
```
229
229
230
-
## Create a search agent
230
+
## Create a knowledge agent
231
231
232
-
To connect Azure AI Search to your `gpt-4o-mini` deployment and target the `earth_at_night` index at query time, you need a search agent. The following code defines an agent named `earth-search-agent`, which you specified using the `agent_name` variable in a previous section.
232
+
To connect Azure AI Search to your `gpt-4o-mini` deployment and target the `earth_at_night` index at query time, you need a knowledge agent. The following code defines a knowledge agent named `earth-search-agent`, which you specified using the `agent_name` variable in a previous section.
233
233
234
234
To ensure relevant and semantically meaningful responses, `default_reranker_threshold`isset to exclude responses with a reranker score of `2.5`or lower.
235
235
@@ -261,7 +261,7 @@ print(f"Knowledge agent '{agent_name}' created or updated successfully")
261
261
262
262
## Set up messages
263
263
264
-
The next step is to define the agent instructions and conversation context using the `messages` array. Each message includes a `role`, such as`user`or`assistant`, and`content`in natural language. A user message represents the query to be processed, while an assistant message guides the agent on how to respond. During the retrieval process, these messages are sent to an LLM to extract relevant responses from indexed documents.
264
+
The next step is to define the knowledge agent instructions and conversation context using the `messages` array. Each message includes a `role`, such as`user`or`assistant`, and`content`in natural language. A user message represents the query to be processed, while an assistant message guides the knowledge agent on how to respond. During the retrieval process, these messages are sent to an LLM to extract relevant responses from indexed documents.
265
265
266
266
For now, create the following assistant message, which instructs `earth-search-agent` to answer questions about the Earth at night, cite sources using their `ref_id`, and respond with"I don't know" when answers are unavailable.
In Azure AI Search, *agentic retrieval* is a new parallel query processing architecture that incorporates user conversation history and Azure OpenAI models to plan, retrieve and synthesize queries for improved results. It produces high-quality grounding data for custom chat and generative AI solutions that include agents.
19
+
In Azure AI Search, *agentic retrieval* is a new parallel query processing architecture that incorporates user conversation history and Azure OpenAI models to plan, retrieve and synthesize queries for improved results. It produces high-quality grounding data for custom chat and generative AI solutions that include knowledge agents.
20
20
21
-
Programmatically, agentic retrieval is supported through a new Knowledge Agents object (also known as a search agent) in the 2025-05-01-preview data plane REST API and in Azure SDK prerelease packages that provide the feature. An agent's retrieval response is designed for downstream consumption by other agents and chat apps.
21
+
Programmatically, agentic retrieval is supported through a new Knowledge Agents object in the 2025-05-01-preview data plane REST API and in Azure SDK prerelease packages that provide the feature. A knowledge agent's retrieval response is designed for downstream consumption by other agents and chat apps.
22
22
23
23
## Why use agentic retrieval
24
24
@@ -54,9 +54,9 @@ Agentic retrieval has these components:
54
54
55
55
| Component | Resource | Usage |
56
56
|-----------|----------|-------|
57
-
| LLM (gpt-4o and gpt-4.1 series) | Azure OpenAI | An LLM has two functions. First, it formulates subqueries for the query plan and sends it back to the search agent. Second, after the query executes, the LLM receives grounding data from the query response and uses it for answer formulation. |
57
+
| LLM (gpt-4o and gpt-4.1 series) | Azure OpenAI | An LLM has two functions. First, it formulates subqueries for the query plan and sends it back to the knowledge agent. Second, after the query executes, the LLM receives grounding data from the query response and uses it for answer formulation. |
58
58
| Search index | Azure AI Search | Contains plain text and vector content, a semantic configuration, and other elements as needed. |
59
-
|Search agent | Azure AI Search | Connects to your LLM, providing parameters and inputs to build a query plan. |
59
+
|Knowledge agent | Azure AI Search | Connects to your LLM, providing parameters and inputs to build a query plan. |
60
60
| Retrieval engine | Azure AI Search | Executes on the LLM-generated query plan and other parameters, returning a rich response that includes content and query plan metadata. Queries are keyword, vector, and hybrid. Results are merged and ranked. |
61
61
| Semantic ranker | Azure AI Search | Provides L2 reranking, promoting the most relevant matches. Semantic ranker is required for agentic retrieval. |
62
62
@@ -65,12 +65,12 @@ Your solution should include a tool or app that drives the pipeline. An agentic
65
65
<!-- Insert multiquery pipeline diagram here -->
66
66
Agentic retrieval has these processes:
67
67
68
-
+ Requests for agentic retrieval are initiated by calls to an agent on Azure AI Search.
69
-
+Agents connect to an LLM and provide conversation history as input. How much history is configurable by the number of messages you provide.
68
+
+ Requests for agentic retrieval are initiated by calls to a knowledge agent on Azure AI Search.
69
+
+Knowledge agents connect to an LLM and provide conversation history as input. How much history is configurable by the number of messages you provide.
70
70
+ LLMs look at the conversation and determine whether to break it up into subqueries. The number of subqueries depends on what the LLM decides and whether the `maxDocsForReranker` parameter is higher than 50. A new subquery is defined for each 50-document batch sent to semantic ranker.
71
71
+ Subqueries execute simultaneously on Azure AI Search and generate structured results and extracted references.
72
72
+ Results are ranked and merged.
73
-
+Agent responses are formulated and returned as a three-part response consisting of a unified result (a long string), a reference array, and an activities array that enumerates all operations.
73
+
+Knowledge agent responses are formulated and returned as a three-part response consisting of a unified result (a long string), a reference array, and an activities array that enumerates all operations.
74
74
75
75
Your search index determines query execution and any optimizations that occur during query execution. This includes your semantic configuration, as well as optional scoring profiles, synonym maps, analyzers, and normalizers (if you add filters).
76
76
@@ -80,7 +80,7 @@ Agentic retrieval is available in [all regions that provide semantic ranker](sea
80
80
81
81
Billing for agentic retrieval has two parts:
82
82
83
-
+ Billing for query planning is pay-as-you-go in Azure OpenAI. It's token based for both input and output tokens. The model you assign to the agent is the one charged for token usage. For example, if you use gpt-4o, the token charge appears in the bill for gpt-4o.
83
+
+ Billing for query planning is pay-as-you-go in Azure OpenAI. It's token based for both input and output tokens. The model you assign to the knowledge agent is the one charged for token usage. For example, if you use gpt-4o, the token charge appears in the bill for gpt-4o.
84
84
85
85
+ Billing for semantic ranking during query execution. Billing is suspended during the initial roll-out phase but then transitions to pay-as-you-go on the Azure AI Search side through the semantic ranker. Semantic ranker, which is a premium billable feature, is an integral part of agentic retrieval. You're charged on the Azure AI Search side for token inputs to the semantic ranking models.
86
86
@@ -154,11 +154,11 @@ Choose any of these options for your next step.
154
154
155
155
+ How-to guides for a focused look at development tasks:
156
156
157
-
+[Create an agent](search-agentic-retrieval-how-to-create.md)
158
-
+[Use an agent to retrieve data](search-agentic-retrieval-how-to-retrieve.md)
157
+
+[Create a knowledge agent](search-agentic-retrieval-how-to-create.md)
158
+
+[Use a knowledge agent to retrieve data](search-agentic-retrieval-how-to-retrieve.md)
159
159
+[Build an agent-to-agent retrieval solution](search-agentic-retrieval-how-to-pipeline.md).
160
160
161
-
+ REST API reference, [Agents](/rest/api/searchservice/knowledge-agents?view=rest-searchservice-2025-05-01-preview&preserve-view=true) and [retrieve](/rest/api/searchservice/knowledge-retrieval/retrieve?view=rest-searchservice-2025-05-01-preview&preserve-view=true).
161
+
+ REST API reference, [Knowledge Agents](/rest/api/searchservice/knowledge-agents?view=rest-searchservice-2025-05-01-preview&preserve-view=true) and [Knowledge Retrieval](/rest/api/searchservice/knowledge-retrieval/retrieve?view=rest-searchservice-2025-05-01-preview&preserve-view=true).
162
162
163
163
+[Azure OpenAI Demo](https://github.com/Azure-Samples/azure-search-openai-demo), updated to use agentic retrieval.
In Azure AI Search, an *agent* is a top-level resource representing a connection to a conversational language model for use in agentic retrieval workloads. It specifies a model that provides reasoning capabilities, and it identifies the search index used at query time.
18
+
In Azure AI Search, a *knowledge agent* is a top-level resource representing a connection to a conversational language model for use in agentic retrieval workloads. It specifies a model that provides reasoning capabilities, and it identifies the search index used at query time.
19
19
20
-
After you can create an agent, you can update its properties at any time. If the agent is in use, updates take effect on the next job.
20
+
After you can create a knowledge agent, you can update its properties at any time. If the knowledge agent is in use, updates take effect on the next job.
21
21
22
22
## Prerequisites
23
23
@@ -27,11 +27,11 @@ After you can create an agent, you can update its properties at any time. If the
27
27
28
28
+ Azure AI Search, in any [region that provides semantic ranker](search-region-support.md), on basic tier and above. Your search service must have a [managed identity](search-howto-managed-identities-data-sources.md) for role-based access to a chat model.
29
29
30
-
+ Permission requirements on Azure AI Search. An **Owner/Contributor** or **Search Service Contributor** can create and manage an agent. **Search Index Data Contributor** uploads and indexes document. **Search Index Data Reader** runs queries. Instructions are provided in this article.
30
+
+ Permission requirements on Azure AI Search. An **Owner/Contributor** or **Search Service Contributor** can create and manage a knowledge agent. **Search Index Data Contributor** uploads and indexes document. **Search Index Data Reader** runs queries. Instructions are provided in this article.
31
31
32
32
+ A search index containing plain text or vectors. The index must [meet requirements for agentic retrieval](search-agentic-retrieval-how-to-index.md), including a [semantic configuration](semantic-how-to-configure.md) with the `defaultConfiguration` specified.
33
33
34
-
+ API requirements. To create or use an agent, use 2025-05-01-preview data plane REST API or a prerelease package of an Azure SDK that provides Agent APIs.
34
+
+ API requirements. To create or use a knowledge agent, use 2025-05-01-preview data plane REST API or a prerelease package of an Azure SDK that provides knowledge agent APIs.
35
35
36
36
To follow the steps in this guide, we recommend [Visual Studio Code](https://code.visualstudio.com/download) with a [REST client](https://marketplace.visualstudio.com/items?itemName=humao.rest-client) for sending REST API calls to Azure AI Search. There's no portal support at this time.
37
37
@@ -100,31 +100,31 @@ You can use API keys if you don't have permission to create role assignments.
100
100
api-key: {{search-api-key}}
101
101
```
102
102
103
-
## Check for existing agents
103
+
## Check for existing knowledge agents
104
104
105
-
The following request lists agents by name. Within the agents collection, all agents must be uniquely named. It's helpful for knowing about existing agents for reuse or naming purposes.
105
+
The following request lists knowledge agents by name. Within the knowledge agents collection, all knowledge agents must be uniquely named. It's helpful for knowing about existing knowledge agents for reuse or naming purposes.
106
106
107
107
<!-- ### [**REST APIs**](#tab/rest-get) -->
108
108
109
109
```http
110
-
# List Agents
110
+
# List knowledge agents
111
111
GET https://{{search-url}}/agents?api-version=2025-05-01-preview
112
112
api-key: {{search-api-key}}
113
113
```
114
114
115
115
You can also return a single agent by name.
116
116
117
117
```http
118
-
# Get Agent
118
+
# Get knowledge agent
119
119
GET https://{{search-url}}/agents/{{agent-name}}?api-version=2025-05-01-preview
120
120
api-key: {{search-api-key}}
121
121
```
122
122
123
123
<!-- --- -->
124
124
125
-
## Create an agent
125
+
## Create a knowledge agent
126
126
127
-
An agent represents a connection to a model that you've deployed. Parameters on the model establish the connection.
127
+
A knowledge agent represents a connection to a model that you've deployed. Parameters on the model establish the connection.
128
128
129
129
<!-- ### [**REST APIs**](#tab/rest-create) -->
130
130
@@ -138,7 +138,7 @@ To create an agent, use the 2025-05-01-preview data plane REST API or an Azure S
+`name` must be unique within the agents collection it must adhere to [naming rules](/rest/api/searchservice/naming-rules) for objects on Azure AI Search.
177
+
+`name` must be unique within the knowledge agents collection it must adhere to [naming rules](/rest/api/searchservice/naming-rules) for objects on Azure AI Search.
178
178
179
-
+`targetIndexes` is required for agent creation. It lists the search indexes that can use the agent. Currently in this preview release, the `targetIndexes` array can contain only one index. *It must have a default semantic configuration* (`defaultConfiguration`). For more information, see [Design an index for agentic retrieval](search-agentic-retrieval-how-to-index.md).
179
+
+`targetIndexes` is required for knowledge agent creation. It lists the search indexes that can use the knowledge agent. Currently in this preview release, the `targetIndexes` array can contain only one index. *It must have a default semantic configuration* (`defaultConfiguration`). For more information, see [Design an index for agentic retrieval](search-agentic-retrieval-how-to-index.md).
Call the **retrieve** action on the agent object to confirm the model connection and return a response. Use the [2025-05-01-preview](/rest/api/searchservice/operation-groups?view=rest-searchservice-2025-05-01-preview&preserve-view=true) data plane REST API or an Azure SDK prerelease package that provides equivalent functionality for this task.
209
+
Call the **retrieve** action on the knowledge agent object to confirm the model connection and return a response. Use the [2025-05-01-preview](/rest/api/searchservice/operation-groups?view=rest-searchservice-2025-05-01-preview&preserve-view=true) data plane REST API or an Azure SDK prerelease package that provides equivalent functionality for this task.
210
210
211
211
Replace "What are my vision benefits?" with a query string that's valid for your search index.
For more information about the **retrieve** API and the shape of the response, see [Retrieve data using an agent in Azure AI Search](search-agentic-retrieval-how-to-retrieve.md).
246
+
For more information about the **retrieve** API and the shape of the response, see [Retrieve data using a knowledge agent in Azure AI Search](search-agentic-retrieval-how-to-retrieve.md).
0 commit comments