# AzureAIMemoryRetrieverTool

> **Class** in `langchain_azure_ai`

📖 [View in docs](https://reference.langchain.com/python/langchain-azure-ai/tools/_azure_ai_memory/AzureAIMemoryRetrieverTool)

Tool that retrieves relevant memories from Azure AI Foundry Memory.

This tool is designed to be used in conjunction with the
:class:`AzureAIMemoryMiddleware` to enable agents to store and retrieve
long-term memories in Azure AI Foundry.

**Example usage:**

```python
from langchain.agents import create_agent
from langchain.chat_models import init_chat_model
from langchain_azure_ai.agents.middleware import AzureAIMemoryMiddleware
from langchain_azure_ai.tools import AzureAIMemoryRetrieverTool

memory_middleware = AzureAIMemoryMiddleware(
    project_endpoint="https://resource...",
    store_name="agent-memories",
    scope="general",
    roles=["user"],
)

retriever_tool = memory_middleware.get_retriever_tool(k=1)

agent = create_agent(
    system_prompt=(
        "You are a helpful assistant that can remember information over time."
        "Use the provided tool to retrieve relevant memories when needed."
    ),
    tools=[retriever_tool],
    model=init_chat_model("azure_ai:gpt-4o"),
    middleware=[memory_middleware],
)
```

## Signature

```python
AzureAIMemoryRetrieverTool()
```

## Extends

- `BaseTool`

## Properties

- `name`
- `description`
- `args_schema`
- `store_name`
- `scope`
- `k`
- `project_endpoint`
- `credential`
- `model_config`

---

[View source on GitHub](https://github.com/langchain-ai/langchain-azure/blob/7a6a664d617264df8dcb12fcfb1bacc09f21d504/libs/azure-ai/langchain_azure_ai/tools/_azure_ai_memory.py#L31)