Choosing Memory, Tools and Knowledge for Agents
This lesson explains the options for what an agent remembers, what it can do and what it knows, and how scope, scale and risk decide the right choice in Foundry.
Learning outcomes
After completing this lesson, you will be able to:
- Distinguish conversation memory from long-term memory.
- Choose a tool category for an agent capability and assess its risk.
- Choose between file search, the Azure AI Search tool and other knowledge options.
Memory
A model does not remember anything between requests: each call sees only the input it is given. An agent's memory is therefore the information that the agent service or the application stores and supplies to the model again, so that the agent can follow a conversation and recognize a returning user. Memory is planned at two time scales: short-term memory within a single conversation, and long-term memory across conversations.
Short-term memory is the conversation itself. Foundry Agent Service stores conversations as durable objects containing messages, tool calls and tool results, so each request passes the conversation ID and only the new input. The service manages the context window as conversations grow. Alternatives are chaining responses by previous response ID or managing history in the application.
Long-term memory persists selected information across conversations: user preferences, profile facts and summaries of past interactions. Foundry Agent Service memory extracts memories from conversations and retrieves relevant ones in later conversations, scoped per user. Applications can also store memory themselves, for example in Azure Cosmos DB, when they need full control over what is kept. Memory must respect consent and retention rules; sensitive data should not be stored unless policy allows it.
In the Foundry portal, long-term memory is configured as a memory store (preview) on the project's Memory page. The following screenshot shows the Create memory store dialog. A memory store uses a chat model to extract memories and an embedding model to search them, and its advanced settings turn chat summaries, procedural memory and a user profile on or off. The user profile details state what the store should remember and what it must avoid.

Short-term or long-term memory?
Tools
Tools are what let an agent act rather than only talk. At the planning stage, the question for each capability the agent needs is which kind of tool provides it, and the answer depends mainly on what already exists. If the logic exists only inside the team's application, or must apply the signed-in user's context, a function tool fits, because the application itself executes the call. If the capability already exists as a REST API with an OpenAPI specification, an OpenAPI tool calls it without new code. If the organization publishes tools through a Model Context Protocol server so that several agents and frameworks can share them, an MCP tool connects to that server.
Other needs map to more specialized tools. Connections to business systems such as CRM or ticketing platforms often already exist as Logic Apps connectors, and custom serverless code fits Azure Functions. Calculations, data analysis and file conversion fit code interpreter, which runs Python in a sandbox. Web tasks that have no API can use browser automation, which carries more risk because the agent acts on live websites.
Risk is the second planning criterion. A tool that only reads data has limited impact if the agent misuses it, while a tool that changes data, spends money or contacts people needs the strongest controls: least-privilege identities, validation in code and an approval step. The following table summarizes the tool categories.
| Tool type | Fits when | Notes |
|---|---|---|
| Function tool | Custom logic in your application | Your code executes the call and returns output |
| OpenAPI tool | An existing REST API with an OpenAPI specification | Anonymous, connection key or managed identity authentication |
| MCP tool | Tools from an MCP server shared across agents and frameworks | Allowed tool lists and approval settings |
| Azure Functions / Logic Apps | Serverless code or connectors to business systems | Logic Apps connectors cover many SaaS systems |
| Code interpreter | Calculations, data analysis, file conversion | Runs Python in a sandbox |
| Browser automation, computer use | Web tasks without an API | Higher risk; restrict and review |
Choose the tool type
Knowledge
An agent's knowledge is the content it can look up to ground its answers, as distinct from what the model learned during training. Knowledge is provided through knowledge tools: when a question needs facts, the agent calls the tool, the tool retrieves relevant passages, and the agent answers from them. Foundry offers several knowledge tools, described in the following paragraphs.
File search indexes files uploaded to the agent or conversation in a managed vector store. It suits a small set of documents owned by the agent or attached by a user.
The Azure AI Search tool connects the agent to an existing Azure AI Search index, reusing the index's filters, query types and ingestion pipeline.
A Foundry IQ knowledge base combines several knowledge sources, such as indexes, Blob Storage, SharePoint, OneLake and the web, behind one agentic retrieval endpoint, with permission awareness for supported sources.
Grounding with Bing Search provides public web knowledge, and connectors for SharePoint and Microsoft Fabric bring in Microsoft 365 and analytics data.
The options differ in who owns the content and its ingestion. With file search, the agent service owns a copy: files are uploaded, chunked and embedded into a vector store attached to the agent or conversation, which is quick to set up but becomes stale when the source changes and carries none of the source system's permissions. With the Azure AI Search tool, the organization owns the index and its pipeline, so it controls chunking, metadata, filters, refresh schedules and security trimming, and the same index can serve several agents and applications. A Foundry IQ knowledge base adds a planning layer over one or more sources, so a single question can be split into subqueries and answered from several sources at once.
A practical rule follows from this. A handful of files that belong to one task, such as the documents a user attaches to ask about, suit file search. Content that many people rely on, that changes and that has access rules, such as policies or product documentation, belongs in an index or knowledge source connected to its system of record. Web grounding is reserved for information that genuinely lives outside the organization, because results come from public sources that the organization does not control.
The following diagram compares the three main knowledge options by who owns the content.

Designing an HR agent
An HR agent must answer questions about policies stored in SharePoint (respecting each employee's permissions), remember each employee's preferred language across sessions, and submit leave requests to the HR system, which has a REST API with an OpenAPI specification.
Policies with permission awareness: a Foundry IQ knowledge base with a SharePoint knowledge source (or the SharePoint tool), which respects the user's access. Preferred language across sessions: long-term memory scoped to the employee. Leave requests: an OpenAPI tool using managed identity or the user's delegated token, with a confirmation step before submission. File search would be a poor fit, because copying SharePoint files into the agent would lose permissions and become stale.
Why should permissioned documents not be copied into an agent's files?
Show answer
The copies lose the source's permissions, so every user of the agent could see them. Connecting to the source, for example through Azure AI Search with security trimming, keeps the permissions.
Exam Tips
Remember for the exam
- One conversation: conversation objects. Across conversations: long-term memory scoped per user.
- Existing REST API with a specification: OpenAPI tool. Shared tool catalogue: MCP server.
- Small set of agent files: file search. Governed enterprise content: Azure AI Search or Foundry IQ.
- Copying permissioned content into agent files loses its permissions; connect to the source instead.