Uh oh!
There was an error while loading. Please reload this page.
.NET: Add a file memory provider - #5315
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new .NET “file-based memory” harness provider that exposes tools for saving/reading/listing/deleting/searching memory files via an AgentFileStore abstraction (with an in-memory implementation), and wires it into the harness sample plus JSON source-gen and tests.
Changes:
- Introduces
FileMemoryProviderand supporting DTOs/state, backed by an abstractAgentFileStore. - Adds
InMemoryAgentFileStoreimplementation and unit tests for both store and provider behavior. - Updates JSON source generation, sample harness registration, tool-call formatting, and adds globbing dependency.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| dotnet/src/Microsoft.Agents.AI/Harness/FileMemory/AgentFileStore.cs | New abstraction for file operations + glob matching helper. |
| dotnet/src/Microsoft.Agents.AI/Harness/FileMemory/InMemoryAgentFileStore.cs | In-memory implementation including list/search/path normalization logic. |
| dotnet/src/Microsoft.Agents.AI/Harness/FileMemory/FileMemoryProvider.cs | New AI context provider exposing FileMemory_* tools and instructions. |
| dotnet/src/Microsoft.Agents.AI/Harness/FileMemory/FileMemoryState.cs | Provider session state (working folder). |
| dotnet/src/Microsoft.Agents.AI/Harness/FileMemory/FileListEntry.cs | List-files tool response model (name + optional description). |
| dotnet/src/Microsoft.Agents.AI/Harness/FileMemory/FileSearchResult.cs | Search tool response model (file + snippet + matching lines). |
| dotnet/src/Microsoft.Agents.AI/Harness/FileMemory/FileSearchMatch.cs | Search match model (line number + line text). |
| dotnet/src/Microsoft.Agents.AI/Microsoft.Agents.AI.csproj | Adds FileSystemGlobbing package reference. |
| dotnet/Directory.Packages.props | Pins FileSystemGlobbing package version. |
| dotnet/src/Microsoft.Agents.AI/AgentJsonUtilities.cs | Adds JSON source-gen entries for new FileMemory models. |
| dotnet/tests/Microsoft.Agents.AI.UnitTests/Harness/FileMemory/InMemoryAgentFileStoreTests.cs | New unit tests for the in-memory file store. |
| dotnet/tests/Microsoft.Agents.AI.UnitTests/Harness/FileMemory/FileMemoryProviderTests.cs | New unit tests for FileMemoryProvider tool behaviors/state. |
| dotnet/samples/02-agents/Harness/Harness_Step01_Research/Program.cs | Registers FileMemoryProvider in the research harness sample. |
| dotnet/samples/02-agents/Harness/Harness_Shared_Console/ToolCallFormatter.cs | Adds formatter support for FileMemory_* tool calls. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
* .NET: Add a TODO AIContextProvider (microsoft#5233) * Add a TODO AIContextProvider * Add unit tests * Address PR comments * Address PR comments * Fix test after removing one tool * .NET: Add a ModeProvider for managing agent modes (microsoft#5247) * Add a ModeProvider for managing agent modes * Fix typo * Fix typo * Fix typo * Address PR comments * .NET: Add sample to show how to build a harness (microsoft#5268) * Add sample to show how to build a harness * Improve sample * Sample max output tokens and model * Fix encoding * Fix model name in readme * Address PR comments * .NET: Add context window size compaction strategy for harness (microsoft#5304) * Add context window size compaction strategy for harness * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Address PR comments --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * .NET: Add a file memory provider (microsoft#5315) * Add a file memory provider * Address PR comments * Fix review comments. * Add additional unit tests * Addressing PR comments. * .NET: Harness: Improve prompts and add FileSystem store (microsoft#5365) * Harness: Improve prompts and add FileSystem store * Address PR comments * .NET: Harness: Improve path validation (microsoft#5404) * Harness: Improve path validation * Address PR comments * .NET: Add always approve helpers, improve sample and fix bug (microsoft#5451) * Add always approve helpers, improve sample and fix bug * Address PR comments * .NET: Make Todo, Mode and FileMemory providers more configurable (microsoft#5477) * Make Todo, Mode and FileMemory providers more configurable * Address PR comments. * .NET: Add subagents provider and sample (microsoft#5518) * Add subagents provider and sample * Addressing PR comments. * .NET: Harness filememory index plus instructions consistency (microsoft#5540) * Add FileMemoryProvider index and improve instruction consistency * Address PR comments. * Address PR comments * Address PR comments. * Apply suggestion from @rogerbarreto Co-authored-by: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com> --------- Co-authored-by: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com> * .NET: Refactor harness console to be more extensible and easy to understand with better UX (microsoft#5573) * Refactor harness console to be more extensible and easy to understand with better UX. * Fix formatting issues. * Allow multiple clarifications in one response * Address PR comments * .NET: Add FileAccessProvdider and concurrency fix for FileMemoryProvider (microsoft#5583) * Add FileAccessProvdider and concurrency fix for FileMemoryProvider * Address PR comments --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com>
Motivation and Context
It's important to be able to save memories. Adding a file memory provider.
Description
Contribution Checklist