Set the retrieval reasoning effort

Note

Foundry IQ (Azure AI Search) provides direct indexing and query APIs alongside higher-level knowledge source and knowledge base APIs for managed retrieval. Use the Azure portal, REST APIs, or Azure SDKs to configure these capabilities, or connect agents to knowledge bases in the Microsoft Foundry portal.

Important

Features or capabilities marked (preview) in this article are in Public Preview and are subject to the Supplemental Terms of Use for Microsoft Azure Previews. For preview terms specific to Foundry IQ (Azure AI Search), see Preview functionality.

In agentic retrieval, use retrieval reasoning effort to control how much query planning happens before your knowledge base retrieves content. The GA 2026-10-01 REST API supports minimal, low, and medium. auto is a preview feature that requires a supporting preview API version. In the 2026-11-01-preview REST API, reasoning effort can also apply to Microsoft Retriever 1 query planning. For more information, see Use Microsoft Retriever 1.

Set this property in a knowledge base or a retrieve request. The request setting overrides the knowledge base setting. Set it explicitly rather than relying on a service default, which can vary by enabled features. Planning effort and answer synthesis are separate choices.

Usage support

Azure portal Microsoft Foundry portal .NET SDK Python SDK Java SDK JavaScript SDK REST API
✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️

Prerequisites

  • An existing knowledge base with at least one knowledge source. A model is required for low, medium, auto (preview), answer synthesis, or web summarization, but not for model-free minimal extraction.

  • Permission to update and query knowledge bases. Configure keyless authentication with the Search Service Contributor and Search Index Data Reader roles assigned to your user account (recommended) or use an admin API key.

  • The latest Azure.Search.Documents preview package: dotnet add package Azure.Search.Documents --prerelease

  • For keyless authentication, the Azure.Identity package: dotnet add package Azure.Identity

  • The 2026-10-01 Search REST API for GA effort levels. For auto, the REST examples use 2026-11-01-preview, while SDK examples retain their existing preview package contract.

  • For keyless authentication, include a Microsoft Entra ID token in the Authorization header of each HTTP request.

Choose a reasoning effort

Choose a reasoning effort based on the tradeoff you want between latency, cost, and retrieval depth.

Reasoning effort levels

In the 2026-11-01-preview REST API, adding Microsoft Retriever 1 ({"kind":"microsoftRetriever1"}) to a knowledge base changes how Minimal and Auto plan queries. For setup steps, see Use Microsoft Retriever 1.

  • Minimal: A knowledge base with only Microsoft Retriever 1 supports Minimal but not Auto, Low, or Medium.

    • With exactly one semantic intent containing the complete question, Minimal can use Microsoft Retriever 1 for query planning.
    • With multiple semantic intents, Minimal skips Microsoft Retriever 1 planning, runs ordinary Minimal retrieval for each intent, and merges the results.
  • Auto (preview): Requires a two-model pair: exactly one Microsoft Retriever 1 model and exactly one external azureOpenAI or openAICompatible planning model, in any order. Microsoft Retriever 1 handles retrieval planning only, so answer synthesis requires the external model.

    • For an eligible request with one semantic intent, Auto starts with an initial confidence pass and can return results right away. If it doesn't, Auto can use Microsoft Retriever 1 for deeper retrieval and then escalate to the external model at Medium.
    • With multiple semantic intents, Auto skips the initial pass and Microsoft Retriever 1, and starts with the external model at Medium.
Level Description Recommendation Limits
minimal Ordinary Minimal bypasses model-based planning and searches all candidate knowledge sources. alwaysQuerySource: false doesn't exclude a source. Use minimal with semantic intents when you manage planning yourself.
  • Rejects messages input.
  • Model-free extraction uses extractiveData.
  • Answer synthesis and web summarization separately require a model.
  • Subject to knowledge source limits.
low Runs a single pass of LLM-based planning and source selection, then merges the results. Answer synthesis is optional. Use low for model-backed planning without the deeper iterative pass. Requires a model. Output budgets depend on configuration and enabled features, not a fixed synthesized-answer length.
medium Adds deeper retrieval and evaluates whether a follow-up iteration is needed. Use medium for deeper model-assisted retrieval. Requires a model. Available in select regions.
auto (preview) Starts with a lightweight retrieval pass and can escalate to model-based planning. Use auto to let the service select effort for a request. Requires a model and a supporting preview API, such as 2026-08-01-preview or 2026-11-01-preview. Not supported in 2026-10-01. The initial pass is available in select regions.

For a GA REST example with explicit effort, see Retrieve with 2026-10-01 REST. For a separate 2026-11-01-preview example, see Use answer synthesis with REST.

Iterative search for medium retrieval

A medium retrieval reasoning effort provides iterative search if initial results aren't sufficiently relevant. An extra semantic classifier model is called to determine if a second iteration is necessary.

The semantic classifier:

  • Recognizes when there's enough context to answer the question.

  • Retries on insufficient results, using existing information for context. New queries might drill down for more focused detail, or broaden the search. The activity log in the response shows the generated queries used for a more comprehensive answer.

  • Rescores using L3 classification. The range is identical to L2 ranking, an absolute range of zero through 4.0.

There's only one retry. Each iteration adds latency and cost, so the system constrains retry to one pass. A second iteration adds input tokens to the query pipeline, which adds to the overall billable input token count.

Iteration can reuse existing knowledge sources or choose different sources. The second pass selects the most promising knowledge source to provide the missing information.

Region support for medium retrieval

You can set a medium retrieval reasoning effort if your Foundry IQ service is in one of the following regions:

  • East US 2
  • East US
  • South Central US
  • West US 3
  • West US 2
  • West US
  • Germany West Central
  • North Europe
  • Switzerland North
  • Sweden Central
  • Spain Central
  • UK South
  • Korea Central
  • Japan East
  • Southeast Asia

Set the reasoning effort in a knowledge base

Set retrievalReasoningEffort in a knowledge base definition to establish the default for its queries. The auto reasoning effort requires a model configuration. The following example preserves the existing knowledgeSources and models configuration, sets the reasoning effort to auto, and updates the knowledge base.

using Azure.Identity;
using Azure.Search.Documents.Indexes;
using Azure.Search.Documents.Indexes.Models;
using Azure.Search.Documents.KnowledgeBases.Models;

var endpoint = new Uri("<search-endpoint>");
var credential = new DefaultAzureCredential();
var knowledgeBaseName = "<knowledge-base-name>";

var indexClient = new SearchIndexClient(endpoint, credential);
var knowledgeBase = (
    await indexClient.GetKnowledgeBaseAsync(knowledgeBaseName)).Value;
knowledgeBase.RetrievalReasoningEffort =
    new KnowledgeRetrievalAutoReasoningEffort();
await indexClient.CreateOrUpdateKnowledgeBaseAsync(knowledgeBase);

Reference: KnowledgeBase

To use another level, replace KnowledgeRetrievalAutoReasoningEffort with KnowledgeRetrievalMinimalReasoningEffort, KnowledgeRetrievalLowReasoningEffort, or KnowledgeRetrievalMediumReasoningEffort.

from azure.identity import DefaultAzureCredential
from azure.search.documents.indexes import SearchIndexClient
from azure.search.documents.knowledgebases.models import (
    KnowledgeRetrievalAutoReasoningEffort,
)

endpoint = "<search-endpoint>"
credential = DefaultAzureCredential()
knowledge_base_name = "<knowledge-base-name>"

index_client = SearchIndexClient(endpoint, credential)
knowledge_base = index_client.get_knowledge_base(knowledge_base_name)
knowledge_base.retrieval_reasoning_effort = (
    KnowledgeRetrievalAutoReasoningEffort()
)
index_client.create_or_update_knowledge_base(knowledge_base)

Reference: KnowledgeBase

To use another level, replace KnowledgeRetrievalAutoReasoningEffort with KnowledgeRetrievalMinimalReasoningEffort, KnowledgeRetrievalLowReasoningEffort, or KnowledgeRetrievalMediumReasoningEffort.

@api-version = 2026-11-01-preview
@knowledge-base-url = {{search-endpoint}}/knowledgebases/{{knowledge-base-name}}

PUT {{knowledge-base-url}}?api-version={{api-version}}
Content-Type: application/json
Authorization: Bearer {{search-access-token}}

{
  "name": "{{knowledge-base-name}}",
  "knowledgeSources": [
    {
      "name": "{{knowledge-source-name}}"
    }
  ],
  "models": [
    {
      "kind": "azureOpenAI",
      "azureOpenAIParameters": {
        "resourceUri": "{{aoai-endpoint}}",
        "authIdentity": null,
        "deploymentId": "{{model-deployment-name}}",
        "modelName": "{{model-name}}"
      }
    }
  ],
  "retrievalReasoningEffort": {
    "kind": "auto"
  }
}

Reference: Knowledge Bases - Create or Update

To use another level, set retrievalReasoningEffort.kind to minimal, low, or medium.

Set the reasoning effort in a retrieve request

Set retrievalReasoningEffort in a retrieve request to override the knowledge base default for that request. The following example sends a message, uses low to override the auto default from the previous section, and enables answer synthesis (preview).

using Azure.Identity;
using Azure.Search.Documents.KnowledgeBases;
using Azure.Search.Documents.KnowledgeBases.Models;

var endpoint = new Uri("<search-endpoint>");
var credential = new DefaultAzureCredential();
var knowledgeBaseName = "<knowledge-base-name>";

var kbClient = new KnowledgeBaseRetrievalClient(
    endpoint, knowledgeBaseName, credential);
var request = new KnowledgeBaseRetrievalRequest
{
    RetrievalReasoningEffort =
        new KnowledgeRetrievalLowReasoningEffort(),
    OutputMode = KnowledgeRetrievalOutputMode.AnswerSynthesis
};

request.Messages.Add(
    new KnowledgeBaseMessage(
        content: new[] {
            new KnowledgeBaseMessageTextContent("What is the return policy?")
        }
    ) { Role = "user" }
);

var result = await kbClient.RetrieveAsync(request);

Reference: KnowledgeBaseRetrievalRequest

from azure.identity import DefaultAzureCredential
from azure.search.documents.knowledgebases import KnowledgeBaseRetrievalClient
from azure.search.documents.knowledgebases.models import (
    KnowledgeBaseMessage,
    KnowledgeBaseMessageTextContent,
    KnowledgeBaseRetrievalRequest,
    KnowledgeRetrievalOutputMode,
    KnowledgeRetrievalLowReasoningEffort,
)

endpoint = "<search-endpoint>"
credential = DefaultAzureCredential()
knowledge_base_name = "<knowledge-base-name>"

kb_client = KnowledgeBaseRetrievalClient(
    endpoint,
    credential,
    knowledge_base_name=knowledge_base_name,
)
request = KnowledgeBaseRetrievalRequest(
    messages=[
        KnowledgeBaseMessage(
            role="user",
            content=[
                KnowledgeBaseMessageTextContent(
                    text="What is the return policy?"
                )
            ],
        )
    ],
    retrieval_reasoning_effort=KnowledgeRetrievalLowReasoningEffort(),
    output_mode=KnowledgeRetrievalOutputMode.ANSWER_SYNTHESIS,
)

result = kb_client.retrieve(request)

Reference: KnowledgeBaseRetrievalRequest

@api-version = 2026-11-01-preview
@retrieve-url = {{search-endpoint}}/knowledgebases/{{knowledge-base-name}}/retrieve

POST {{retrieve-url}}?api-version={{api-version}}
Content-Type: application/json
Authorization: Bearer {{search-access-token}}

{
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "What is the return policy?"
        }
      ]
    }
  ],
  "retrievalReasoningEffort": {
    "kind": "low"
  },
  "outputMode": "answerSynthesis"
}

Reference: Knowledge Retrieval - Retrieve

The retrieve request returns a grounded answer based on the knowledge sources configured in the knowledge base.