Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Note
This feature is currently in public preview. This preview is provided without a service-level agreement and isn't recommended for production workloads. Certain features might not be supported or might have constrained capabilities. For more information, see Supplemental Terms of Use for Azure Previews.
By default, a knowledge agent in Azure AI Search performs data extraction, which returns raw grounding chunks from your knowledge sources. Data extraction is useful for retrieving specific information, but it lacks the context and reasoning necessary for complex queries.
You can configure the agent to perform answer synthesis, which uses your deployed chat completion model to respond to queries in natural language. Each answer includes citations to the retrieved sources and follows any instructions you provide, such as using bulleted lists.
This article explains how to configure and test answer synthesis for an existing agent. Although you can use this configuration for new agents, agent creation is beyond the scope of this article.
Prerequisites
A knowledge agent that uses the 2025-08-01-preview syntax, which requires
knowledgeSourcesinstead oftargetIndexes.Visual Studio Code with the REST Client extension or a prerelease package of an Azure SDK that provides the knowledge agent REST APIs. Currently, there's no portal support.
Configure answer synthesis
To configure your knowledge agent for answer synthesis, use the 2025-08-01-preview of Knowledge Agent - Create or Update (REST API).
In the outputConfiguration section:
Set
modalitytoanswerSynthesis.(Optional) Use
answerInstructionsto customize the answer output. Our example instructs the agent toUse concise bulleted lists.
@search-url = <YourSearchServiceUrl>
@agent-name = <YourAgentName>
@api-key = <YourApiKey>
### Configure answer synthesis
PUT https://{{search-url}}/knowledgeAgents/{{agent-name}}?api-version=2025-08-01-preview HTTP/1.1
Content-Type: application/json
api-key: {{api-key}}
{
"name": "{{agent-name}}",
"models": [
... // Redacted for brevity
],
"knowledgeSources": [
... // Redacted for brevity
],
"outputConfiguration": {
"modality": "answerSynthesis",
"answerInstructions": "Use concise bulleted lists"
}
}
Important
This example assumes that you're using key-based authentication for local proof-of-concept testing. We recommend role-based access control for production workloads. For more information, see Connect to Azure AI Search using roles.
Get a synthesized answer
After your knowledge agent is configured for answer synthesis, use the 2025-08-01-preview of Knowledge Retrieval - Retrieve (REST API) to test its output.
### Send a query to the agent
POST https://{{search-url}}/agents/{{agent-name}}/retrieve?api-version=2025-08-01-preview HTTP/1.1
Content-Type: application/json
api-key: {{api-key}}
{
"messages": [
{
"role": "user",
"content" : [
{
"text": "<YourQueryText>",
"type": "text"
}
]
}
]
}
The response should include a natural-language answer based on your instructions, with citations to your knowledge sources formatted as [ref_id:<number>]. For example, if your instructions are Use concise bulleted lists and your query is What is healthcare?, the response might look like this:
{
"response": [
{
"content": [
{
"type": "text",
"text": "- Healthcare encompasses various services provided to patients and the general population ... // Trimmed for brevity
}
]
}
],
... // Redacted for brevity
}
The full text output is as follows:
"- Healthcare encompasses various services provided to patients and the general population, including primary health services, hospital care, dental care, mental health services, and alternative health services [ref_id:1].\n- It involves the delivery of safe, effective, patient-centered care through different modalities, such as in-person encounters, shared medical appointments, and group education sessions [ref_id:0].\n- Behavioral health is a significant aspect of healthcare, focusing on the connection between behavior and overall health, including mental health and substance use [ref_id:2].\n- The healthcare system aims to ensure quality of care, access to providers, and accountability for positive outcomes while managing costs effectively [ref_id:2].\n- The global health system is evolving to address complex health needs, emphasizing the importance of cross-sectoral collaboration and addressing social determinants of health [ref_id:4]."
Depending on your agent's configuration, the response might include other information, such as activity logs and reference arrays. For more information, see Create a knowledge agent.