Skip to content

Python: Deprecate the legacy memory APIs - #10273

Merged
Eduard van Valkenburg (eavanvalkenburg) merged 2 commits into
microsoft:mainfrom
westey-m:python-obsolete-memory
Nov 12, 2026
Merged

Eduard van Valkenburg (eavanvalkenburg) merged 2 commits into
microsoft:mainfrom
westey-m:python-obsolete-memory

Conversation

@westey-m

Copy link
Copy Markdown
Collaborator

Motivation & Context

The older memory classes overlap with the simpler FileMemoryProvider. This
change marks them as deprecated while keeping existing applications and their
saved memories working.

Description & Review Guide

  • What are the major changes? Mark MemoryContextProvider,
    MemoryFileStore, MemoryStore, MemoryIndexEntry, and MemoryTopicRecord
    as deprecated. Keep their experimental notices and exports, document
    DEFAULT_MEMORY_SOURCE_ID as legacy, and add compatibility tests.
  • What is the impact of these changes? Existing imports do not warn; using
    or subclassing the old classes produces a deprecation warning. The old
    provider keeps its automatic memory extraction, transcript history, and
    storage layout. The default harness provider remains FileMemoryProvider.
    The new provider lets the agent manage memory files, uses a different layout,
    and does not automatically extract memories or provide transcript history.
    Existing files are not moved automatically. The new provider uses a session
    scope by default; callers can supply a scope to share memory across sessions.
  • What do you want reviewers to focus on? Warning locations, custom
    MemoryStore subclasses, and compatibility with existing saved memories.

Before:

from agent_framework import MemoryContextProvider, MemoryFileStore

provider = MemoryContextProvider(
    store=MemoryFileStore("./legacy-memory", owner_state_key="user_id")
)

For new file-based memory:

from agent_framework import FileMemoryProvider, FileSystemAgentFileStore

provider = FileMemoryProvider(store=FileSystemAgentFileStore("./new-memory"))

These are not drop-in replacements: the old provider uses the owner in session
state, while the new example uses session-scoped memory. Its file format and
behavior differ as described above.

Checks from python/:

  • UV_NO_SYNC=1 UV_OFFLINE=1 uv run --no-sync pytest packages/core/tests/core/test_harness_memory.py packages/core/tests/core/test_harness_file_memory.py packages/core/tests/core/test_harness_agent.py::test_create_harness_agent_includes_all_default_providers packages/core/tests/core/test_root_exports.py packages/core/tests/core/test_feature_stage.py -q — passed (118 tests).
  • UV_NO_SYNC=1 UV_OFFLINE=1 uv run --no-sync pytest packages/core/tests/core/test_harness_memory.py::test_memory_store_warns_when_subclassed -q — passed after the final test edit.
  • UV_NO_SYNC=1 UV_OFFLINE=1 uv run --no-sync poe syntax -P core — passed.
  • UV_NO_SYNC=1 UV_OFFLINE=1 uv run --no-sync poe pyright -P core — passed.
  • UV_NO_SYNC=1 UV_OFFLINE=1 uv run --no-sync poe test-typing -P core — passed.

A full build and the complete unit test suite were not run.

Related Issue

None. The change follows the agreed direction to deprecate the older memory
classes; there is no linked issue.

AI Assistance

  • No material AI assistance was used.
  • This is an AI-assisted contribution. I reviewed, understood, and verified all submitted content and accept responsibility for it.

AI assistance details: implementation, tests, documentation, and PR description.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR links to an agreed issue with no competing open PR, or the Related Issue section documents a trivial-change or repository-automation exception.
  • This is not a breaking change. If it is a breaking change, add the breaking change label (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.

Copilot AI balanced review requested due to automatic review settings November 11, 2026 17:39
@agent-framework-automation agent-framework-automation Bot added documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs python Usage: [Issues, PRs], Target: Python labels Nov 11, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

There are no active review issues requiring resolution for the legacy memory API deprecation.

No open issues 🎉

What changed in this PR

Deprecates Python’s legacy memory APIs in favor of FileMemoryProvider for new applications, while retaining existing exports, storage formats, and legacy behavior.

Changes:

  • Adds deprecation metadata and warnings to five legacy memory classes while preserving experimental notices.
  • Adds tests for warning behavior, caller locations, warning-free imports, and the non-deprecated replacement.
  • Updates documentation to distinguish legacy memory from the newer session-scoped provider.
File Description
python/​packages/​core/​tests/​core/​test_root_exports.py Verifies legacy imports do not emit deprecation warnings.
python/​packages/​core/​tests/​core/​test_harness_memory.py Tests deprecation metadata and subclass warnings; adapts existing compatibility tests.
python/​packages/​core/​tests/​core/​test_harness_file_memory.py Verifies FileMemoryProvider emits no deprecation warning.
python/​packages/​core/​tests/​core/​test_feature_stage.py Checks experimental and deprecation warnings point to the caller.
python/​packages/​core/​AGENTS.md Updates the documented comparison with file memory.
python/​packages/​core/​agent_framework/​_harness/​_memory.py Deprecates legacy classes and documents migration differences without changing storage behavior.
python/​packages/​core/​agent_framework/​_harness/​_file_access.py Updates docstrings to compare file access with FileMemoryProvider.

Review effort: Balanced

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAF Automated Review — Iteration 1

Result: No findings
Scope: full PR (1 commit(s)): 3049099cad1e
Model: gpt-5.6-sol

Overview

The PR preserves the legacy memory APIs, exports, persistence layout, and behavior while adding use-time deprecation metadata and directing new applications to FileMemoryProvider. Import safety, warning locations for direct use and direct subclassing, replacement-provider behavior, and legacy compatibility all have focused coverage; the remaining diagnostic edge cases do not establish a Critical, High, or Medium runtime or contract failure.

Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
No publishable findings remained after source verification for this scope.

This branch was successfully deployed

1 active deployment
github-app-auth — 88332266 Deployed Nov 12, 2026 by westey-m via add_label #27677
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants