Python: Move SessionStore to core and persist Foundry Responses sessions#7306
Draft
eavanvalkenburg wants to merge 1 commit into
Draft
Python: Move SessionStore to core and persist Foundry Responses sessions#7306eavanvalkenburg wants to merge 1 commit into
eavanvalkenburg wants to merge 1 commit into
Conversation
Move SessionStore and durable msgspec-backed storage into core, restore sessions in Foundry Responses hosting with per-user isolation, and document the serialization design. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 3e5c81ad-75e8-4e92-a883-8bbd676c6c8c
eavanvalkenburg
temporarily deployed
to
github-app-auth
July 24, 2026 14:31 — with
GitHub Actions
Inactive
eavanvalkenburg
temporarily deployed
to
github-app-auth
July 24, 2026 14:31 — with
GitHub Actions
Inactive
eavanvalkenburg
temporarily deployed
to
github-app-auth
July 24, 2026 14:31 — with
GitHub Actions
Inactive
eavanvalkenburg
temporarily deployed
to
github-app-auth
July 24, 2026 14:34 — with
GitHub Actions
Inactive
Contributor
Contributor
There was a problem hiding this comment.
Pull request overview
Moves Python session persistence primitives into agent-framework-core and updates Foundry Responses hosting to persist/restore full AgentSession state (not just transcript history), including a new msgspec-backed file store and explicit per-user storage isolation for hosted scenarios.
Changes:
- Introduces experimental
SessionStore(in-memory) andFileSessionStore(JSON/MessagePack, atomic replace) in core, plus a stricter session-state type registry viaregister_state_type. - Switches
FileHistoryProviderdefault JSON codec to msgspec (and adds optional MessagePack), deprecating custom JSONdumps/loadshooks. - Updates Foundry Responses hosting to persist sessions across calls, partition durable storage by resolved authenticated identity, and harden isolation/scoping across sessions, checkpoints, and approvals.
Reviewed changes
Copilot reviewed 34 out of 35 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| python/uv.lock | Adds msgspec to the locked dependency set. |
| python/samples/04-hosting/af-hosting/README.md | Updates sample documentation to reflect core-owned SessionStore. |
| python/samples/04-hosting/af-hosting/local_telegram/README.md | Updates Telegram session-id format description (no :). |
| python/samples/04-hosting/af-hosting/local_responses/README.md | Documents use of core FileSessionStore for session snapshots. |
| python/samples/04-hosting/af-hosting/local_responses/app.py | Wires AgentState to a FileSessionStore for local persistence. |
| python/samples/02-agents/conversations/file_history_provider.py | Removes optional orjson path; documents msgspec default. |
| python/samples/02-agents/conversations/file_history_provider_conversation_persistence.py | Removes optional orjson path; documents msgspec default. |
| python/samples/02-agents/context_providers/simple_context_provider.py | Demonstrates explicit register_state_type for persisted custom state. |
| python/packages/hosting/tests/hosting/test_state.py | Updates hosting tests for core-owned SessionStore and new ID validation. |
| python/packages/hosting/README.md | Documents new core session store APIs and ID restrictions. |
| python/packages/hosting/agent_framework_hosting/_state.py | Removes hosting-owned store implementation; uses core SessionStore and validation. |
| python/packages/hosting/agent_framework_hosting/init.py | Stops re-exporting SessionStore. |
| python/packages/hosting-telegram/tests/hosting_telegram/test_parsing.py | Updates tests for new Telegram session-id format. |
| python/packages/hosting-telegram/README.md | Updates docs to refer to core session stores and new ID format. |
| python/packages/hosting-telegram/agent_framework_hosting_telegram/_parsing.py | Changes telegram_session_id output to use underscore-delimited IDs. |
| python/packages/hosting-responses/README.md | Documents session store location in core. |
| python/packages/foundry_hosting/tests/test_responses.py | Adds/updates tests for session persistence and isolation behavior. |
| python/packages/foundry_hosting/README.md | Documents hosted persistence behavior, default storage layout, and isolation resolver. |
| python/packages/foundry_hosting/agent_framework_foundry_hosting/_session_isolation.py | Adds isolation resolver and scoped file session store wrapper. |
| python/packages/foundry_hosting/agent_framework_foundry_hosting/_responses.py | Implements session persistence + isolation scoping across Responses lifecycle. |
| python/packages/foundry_hosting/agent_framework_foundry_hosting/init.py | Exposes new isolation-related public types. |
| python/packages/core/tests/core/test_sessions.py | Adds comprehensive tests for state registry + session/file stores + msgspec history changes. |
| python/packages/core/tests/core/test_harness_memory.py | Removes custom JSON codec plumbing now that msgspec is default. |
| python/packages/core/tests/core/test_feature_stage.py | Adds test ensuring internal subclasses don’t warn under experimental features. |
| python/packages/core/pyproject.toml | Adds msgspec runtime dependency. |
| python/packages/core/AGENTS.md | Updates package map docs for new session persistence APIs. |
| python/packages/core/agent_framework/_sessions.py | Adds session stores + registry hardening + msgspec-based history/session serialization. |
| python/packages/core/agent_framework/_harness/_memory.py | Marks history codec overrides as deprecated. |
| python/packages/core/agent_framework/_feature_stage.py | Avoids experimental warnings for internal framework subclasses. |
| python/packages/core/agent_framework/init.pyi | Exports SessionStore/FileSessionStore typing surface. |
| python/packages/core/agent_framework/init.py | Exports SessionStore/FileSessionStore runtime surface. |
| python/PACKAGE_STATUS.md | Adds SESSION_STORE feature-stage entry and updates staged-API listing. |
| python/AGENTS.md | Adds “Changelog Ownership” guidance for Python PRs. |
| python/.github/skills/agent-framework-py-release/SKILL.md | Documents that release workflow owns python/CHANGELOG.md. |
| docs/decisions/0033-python-session-store-serialization.md | Adds ADR for session store ownership + msgspec serialization strategy. |
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
Core agents need a reusable way to persist complete
AgentSessionstate, while Foundry Responses hosting currently restores transcript history without restoring middleware state, provider state, or service continuation handles. This change moves session storage into core and uses it in Foundry hosting so state survives Responses API calls with explicit per-user isolation.Description & Review Guide
SessionStoreinto core; add an experimental msgspec-backedFileSessionStorewith JSON and MessagePack formats, atomic replacement, restricted storage keys, and explicit custom-state registration; make msgspec theFileHistoryProviderdefault while deprecating customdumps/loads; and restore/save sessions throughout the Foundry Responses lifecycle using a request identity resolver and scoped file storage. The change also updates hosting imports, samples, package metadata, tests, and ADR-0033.SessionStorefromagent_framework, and core gains amsgspecruntime dependency.Related Issue
No issue is linked for this draft, as requested.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.