Python: Add FileMemoryProvider context provider sample - #7428
Merged
eavanvalkenburg merged 2 commits intoJul 30, 2026
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a focused Python sample demonstrating FileMemoryProvider + FileSystemAgentFileStore to persist “memory files” on disk and recall them across independent AgentSessions using a stable per-user scope, and documents it alongside the other context-provider samples.
Changes:
- Add a new Foundry-backed sample (
file_memory_provider.py) showing file-based memory persistence across two separate sessions via an explicitscope. - Update the context-provider samples README to include the new sample and list its prerequisites.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| python/samples/02-agents/context_providers/README.md | Registers the new sample in the samples list and documents required env vars/auth. |
| python/samples/02-agents/context_providers/file_memory_provider.py | New end-to-end sample wiring FileMemoryProvider over FileSystemAgentFileStore and demonstrating cross-session recall via stable scope. |
westey-m
marked this pull request as ready for review
July 30, 2026 09:55
eavanvalkenburg
approved these changes
Jul 30, 2026
moonbox3
approved these changes
Jul 30, 2026
eavanvalkenburg
enabled auto-merge
July 30, 2026 10:10
eavanvalkenburg
approved these changes
Jul 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation & Context
FileMemoryProvidergives an agent file-based memory through thefile_memory_*tools, with each memory stored in anAgentFileStore.Until now, Python did not have a focused sample showing how to attach the provider directly to an
Agent, persist memories on disk, or configure a stable scope so memories can be recalled across independent sessions.This adds the Python counterpart to the .NET sample in #7401, alongside the other context-provider samples.
Description & Review Guide
file_memory_provider.py, a Foundry-backed travel assistant usingFileMemoryProvideroverFileSystemAgentFileStore.scope, one session that stores user preferences, the resulting files on disk, and a new session that recalls those preferences without shared chat history.Related Issue
Related to #6448.
Issue #6448 tracks several additional harness samples, so this PR contributes the Python
FileMemoryProvidersample without closing the broader issue. PR #7401 is the complementary .NET sample; this PR adds the Python implementation under02-agents/context_providersand demonstrates Python'sscopeAPI.Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after a language prefix) — a workflow keeps the label and title prefix in sync automatically.