[Azure OpenAI] Built-in Memory not working

I’m attempting to use the built-in memory feature in connection with an Azure OpenAI model, but it seems to be struggling with retrieving the message history. When I ask it “What’s my first message?” the response is typically along the lines of, “I’m currently unable to access your initial message. Could I assist you with something else, or do you have any further questions?”

Agent config:

   Agent(
        name="Normal",
        agent_id="normal",
        user_id=user_id,
        session_id=session_id,
        model=AzureOpenAI(id=model_id),
        markdown=True,
        add_datetime_to_instructions=True,
        add_history_to_messages=True,
        num_history_responses=3,
        read_chat_history=True,
        debug_mode=debug_mode,
        read_tool_call_history=True,
    )

Metrics output:

EBUG ************************************ Async Agent Run Start: 39d24242-c32c-4293-894b-9510022881db *************************************
DEBUG Processing tools for model
DEBUG Included function get_chat_history
DEBUG Included function get_tool_call_history

DEBUG ************************************************************* METRICS **************************************************************
DEBUG Getting function get_chat_history
DEBUG Running: get_chat_history(num_chats=1)
DEBUG ================================================================ tool ================================================================
DEBUG Tool call Id: call_c0H3nIum1dR5YAjxxjHklLKL
DEBUG *********************************************************** TOOL METRICS ***********************************************************
DEBUG * Time: 0.0005s
DEBUG *********************************************************** TOOL METRICS ************************

DEBUG -------------------------------------------------- Azure Async Response Stream End ---------------------------------------------------
DEBUG Added 4 Messages to AgentMemory
DEBUG Added AgentRun to AgentMemory
DEBUG Logging Agent Run (Async)
DEBUG **************************************** Agent Run End: 39d24242-c32c-4293-894b-9510022881db *****************************************

Hi @schligp
Thanks for reaching out and for using Agno! I’ve looped in the right engineers to help with your question. We usually respond within 48 hours, but if this is urgent, just let us know, and we’ll do our best to prioritize it.
Appreciate your patience—we’ll get back to you soon!

@schligp I’d like to understand how you’re asking the questions to the agent in the same session.

Are the two questions part of the same session (using the same session ID) but run as separate runs? If you’re running the questions independently—each as a separate run—they won’t share session history or access the built-in memory, because the memory and session DB aren’t attached.

You can try something like this: agno/cookbook/agent_concepts/memory/01_builtin_memory.py at main · agno-agi/agno · GitHub

They are a part of the same session and hence able to share the built-in memory

1 Like