-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Python: [BREAKING] PR2 — Wire context provider pipeline, remove old types, update all consumers #3850
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
eavanvalkenburg
merged 28 commits into
microsoft:main
from
eavanvalkenburg:edvan/pr2-context-provider-pipeline
Feb 12, 2026
Merged
Python: [BREAKING] PR2 — Wire context provider pipeline, remove old types, update all consumers #3850
eavanvalkenburg
merged 28 commits into
microsoft:main
from
eavanvalkenburg:edvan/pr2-context-provider-pipeline
Feb 12, 2026
+6,653
−11,407
Conversation
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
a25dbce to
5873923
Compare
Member
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
Contributor
|
Is this a breaking change? |
e231231 to
075d52b
Compare
dmytrostruk
reviewed
Feb 11, 2026
python/packages/orchestrations/agent_framework_orchestrations/_handoff.py
Outdated
Show resolved
Hide resolved
e861cde to
9b180b0
Compare
- Replace AgentThread with AgentSession across all packages - Replace ContextProvider with BaseContextProvider across all packages - Replace context_provider param with context_providers (Sequence) - Replace thread= with session= in run() signatures - Replace get_new_thread() with create_session() - Add get_session(service_session_id) to agent interface - DurableAgentThread -> DurableAgentSession - Remove _notify_thread_of_new_messages from WorkflowAgent - Wire before_run/after_run context provider pipeline in RawAgent - Auto-inject InMemoryHistoryProvider when no providers configured
…, remove old test files
…tThread→AgentSession, ContextProvider→BaseContextProvider)
…ion with session_id
…rate devui to use plain message lists
…ryProvider(InMemoryHistoryProvider)
…g into provider internals
…or new provider types
…session_id.key references in samples
…ssions, remove aggregate_context_provider
Pydantic models stored in session.state are now automatically serialized via model_dump() and restored via model_validate() during to_dict()/from_dict() round-trips. Models are auto-registered on first serialization; use register_state_type() for cold-start deserialization. Also export register_state_type as a public API.
- Replace 'thread' with 'session' in sample descriptions across all READMEs - Update file links for renamed samples (mem0_sessions, redis_sessions, etc.) - Fix Threads section → Sessions section in main samples/README.md - Update tools, middleware, workflows, durabletask, azure_functions READMEs - Update architecture diagrams in concepts/tools/README.md - Update migration guides (autogen, semantic-kernel)
AsyncMemory (OSS) expects user_id/agent_id/run_id as direct kwargs, while AsyncMemoryClient (Platform) expects them in a filters dict. Adds tests for both client types. Port of fix from microsoft#3844 to new Mem0ContextProvider.
…int decode logic - Add back _conversation_state.py (encode/decode_chat_messages) lost in rebase - Fix on_checkpoint_restore to decode cache/conversation with decode_chat_messages - Fix on_checkpoint_restore to use decode_checkpoint_value for pending requests - Add tests/workflow/__init__.py for relative import support - Fix test_agent_executor checkpoint selection (checkpoints[1] not superstep)
…der injection Chat clients that store history server-side by default (OpenAI Responses API, Azure AI Agent) now declare STORES_BY_DEFAULT = True. The agent checks this during auto-injection and skips InMemoryHistoryProvider unless the user explicitly sets store=False.
46397c5 to
c983448
Compare
TaoChenOSU
reviewed
Feb 12, 2026
TaoChenOSU
reviewed
Feb 12, 2026
python/packages/core/agent_framework/_workflows/_conversation_state.py
Outdated
Show resolved
Hide resolved
TaoChenOSU
reviewed
Feb 12, 2026
python/packages/core/agent_framework/_workflows/_agent_executor.py
Outdated
Show resolved
Hide resolved
TaoChenOSU
reviewed
Feb 12, 2026
TaoChenOSU
approved these changes
Feb 12, 2026
… remove stale AGUIThread - Fix: Propagate conversation_id from ChatResponse back to session.service_session_id in both streaming and non-streaming paths in _agents.py - Rename AgentThreadException → AgentSessionException - Remove stale AGUIThread from ag_ui lazy-loader - Rename use_service_thread → use_service_session in ag-ui package - Rename test functions from *_thread_* to *_session_* - Rename sample files from *_thread* to *_session* - Update docstrings and comments: thread → session - Update _mcp.py kwargs filter: add 'session' alongside 'thread' - Fix ContinuationToken docstring example: thread=thread → session=session - Fix _clients.py docstring: 'Agent threads' → 'Agent sessions'
giles17
approved these changes
Feb 12, 2026
giles17
approved these changes
Feb 12, 2026
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
breaking change
Introduces changes that are not backward compatible and may require updates to dependent code.
documentation
Improvements or additions to documentation
lab
Agent Framework Lab
python
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.
Summary
Completes the context provider migration from ADR 0016. PR1 (#3763) added the new types side-by-side; this PR wires them into the agent execution flow, removes all old types, and updates every consumer.
What changed
Core agent wiring (
_agents.py)run()now acceptssession: AgentSession | Noneinstead ofthread: AgentThread | None_prepare_session_and_messages()runsbefore_runon all context providers (forward order), assembles messages fromSessionContext_finalize_response()/_run_after_providers()runsafter_runon all providers (reverse order)InMemoryHistoryProvider(source_id="memory")when: session is passed, no context providers on agent, noservice_session_id, noresponse_id,storenot Truecreate_session()andget_session(*, service_session_id=)(keyword-only) onSupportsAgentRunprotocol_RunContextusessession_messages(renamed fromthread_messages)Old types removed
_threads.py(AgentThread),_memory.py(ContextProvider,ChatMessageStore,Context)_provider.pyin redis/mem0,_search_provider.pyin azure-ai-search,_chat_message_store.pyin redis)External providers renamed
_RedisContextProvider→RedisContextProvider,_RedisHistoryProvider→RedisHistoryProvider_Mem0ContextProvider→Mem0ContextProvider_AzureAISearchContextProvider→AzureAISearchContextProviderLazy-loader stubs updated
redis/__init__.pyi:RedisChatMessageStore/RedisProvider→RedisContextProvider/RedisHistoryProvidermem0/__init__.pyi:Mem0Provider→Mem0ContextProviderredis/__init__.py_IMPORTSlist updatedSession state serialization
BaseModelsupport: models stored insession.stateare auto-serialized viamodel_dump()and restored viamodel_validate()duringto_dict()/from_dict()round-tripsregister_state_type()for pre-registering types for cold-start deserializationLab/tau2
SlidingWindowChatMessageStore→SlidingWindowHistoryProvider(InMemoryHistoryProvider)with token-based truncationrunner.pyreads full history fromsession.state["memory"]["messages"]instead of reaching into provider internalsDevUI
AgentThreadto plainlist[Message]for internal message storageSamples
context_providers/andsessions/(néethreads/) into singlesessions/folderaggregate_context_provider.pyAgentThread→AgentSession,get_new_thread()→create_session(),context_provider=→context_providers=[...], etc.message_store,_notify_thread_of_new_messages,session_id.keyreferencesUserInfoMemorysample refactored to usesession.stateinstead of instance attributesTests
Fixes
Fixes #3587 — Rename AgentThread to AgentSession
Fixes #3588 — Add session management methods (
create_session,get_session)Fixes #3589 — Move serialize into the agent (
AgentSession.to_dict()/from_dict())Fixes #3590 — Orthogonal ChatMessageStore for service vs local (
BaseHistoryProviderwithload_messages/store_*flags)Fixes #3601 — Rename ChatMessageStore to ChatHistoryProvider (
BaseHistoryProvider)Breaking changes
AgentThreadremoved — useAgentSessionContextProvider/ChatMessageStore/Contextremoved — useBaseContextProvider/BaseHistoryProvideragent.get_new_thread()→agent.create_session()agent.get_new_thread(service_thread_id=X)→agent.get_session(service_session_id=X)context_provider=(singular) →context_providers=(list)chat_message_store_factory=→context_providers=[...]Related