How do I configure and access the cache for azure ai foundry agents' responses?

Sriram Vasan 20 Reputation points
2025-06-06T02:07:40.52+00:00

I am using azure AI foundry and it's SDK to create and make

So I am unable to access the cache or understand how the agents are storing the memory for most frequently asked questions based on a given context or thread.
Using Model : Gpt-4.1
Tools : Bing search.

Azure AI services
Azure AI services
A group of Azure services, SDKs, and APIs designed to make apps more intelligent, engaging, and discoverable.
3,604 questions
0 comments No comments
{count} votes

Accepted answer
  1. Saideep Anchuri 9,425 Reputation points Microsoft External Staff Moderator
    2025-06-09T06:33:53.8666667+00:00

    Hi Sriram Vasan

    To configure and access the cache for Azure AI Foundry agents' responses, you can enable semantic caching in Azure API Management.

    Here are some steps:

    1. Add the azure-openai-semantic-cache-lookup policy to check the cache before sending requests. You need to specify the embeddings-backend-id attribute for the Embeddings API backend you created.
         <azure-openai-semantic-cache-lookup 
         score-threshold="0.8"
          embeddings-backend-id="embeddings-deployment" 
         embeddings-backend-auth="system-assigned" 
         ignore-system-messages="true" 
         max-message-count="10"> <vary-by>@(context.Subscription.Id)</vary-by> 
         </azure-openai-semantic-cache-lookup>
      
    2. Add the azure-openai-semantic-cache-store policy to store responses for future reuse.
         <azure-openai-semantic-cache-store duration="60" />
         
         
      
      3.To verify that semantic caching is functioning correctly, you can trace a test Completion or Chat Completion operation using the test console in the portal. Check if the cache was utilized on subsequent tries by inspecting the trace.

    Kindly refer below link: configure-semantic-caching-policies

    Thank You.


1 additional answer

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.