Skip to content

Python: Add default InMemoryHistoryProvider when workflow context providers are unset#3918

Merged
eavanvalkenburg merged 1 commit intomicrosoft:mainfrom
eavanvalkenburg:fix-workflow-as-agent-default-history
Feb 13, 2026
Merged

Python: Add default InMemoryHistoryProvider when workflow context providers are unset#3918
eavanvalkenburg merged 1 commit intomicrosoft:mainfrom
eavanvalkenburg:fix-workflow-as-agent-default-history

Conversation

@eavanvalkenburg
Copy link
Member

@eavanvalkenburg eavanvalkenburg commented Feb 13, 2026

Summary

  • default WorkflowAgent to an InMemoryHistoryProvider("memory") when no context providers are configured
  • preserve explicitly provided context providers without adding defaults
  • add workflow agent tests in existing suite to cover default injection and explicit-provider behavior

Validation

  • uv run ruff format packages/core/agent_framework/_workflows/_agent.py packages/core/tests/workflow/test_workflow_agent.py
  • uv run ruff check packages/core/agent_framework/_workflows/_agent.py packages/core/tests/workflow/test_workflow_agent.py
  • uv run --directory packages/core pytest tests/workflow/test_workflow_agent.py -k 'default_history_provider or explicit_context_providers or session_conversation_history_included_in_workflow_run or session_conversation_history_included_in_workflow_stream' -q

Copilot AI review requested due to automatic review settings February 13, 2026 11:47
@github-actions github-actions bot changed the title Add default InMemoryHistoryProvider when workflow context providers are unset Python: Add default InMemoryHistoryProvider when workflow context providers are unset Feb 13, 2026
@markwallace-microsoft
Copy link
Member

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/core/agent_framework/_workflows
   _agent.py3466880%65, 73–79, 115–116, 206, 250, 306, 352–353, 359–360, 366, 368, 373, 433–434, 443, 450, 476, 509–511, 513, 515, 517, 522, 527, 574, 604, 621, 660–663, 669, 675, 679–680, 683–689, 693–694, 700, 761, 768, 774–775, 786, 818, 825, 846, 855, 859, 861–863, 870
TOTAL20475324384% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
3920 225 💤 0 ❌ 0 🔥 1m 11s ⏱️

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request adds automatic injection of a default InMemoryHistoryProvider to WorkflowAgent when no context providers are configured, ensuring conversation history is maintained by default without requiring explicit provider configuration.

Changes:

  • Add eager default provider injection in WorkflowAgent.__init__() when context_providers is None or empty
  • Add comprehensive test coverage for default injection behavior and explicit provider preservation

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
python/packages/core/agent_framework/_workflows/_agent.py Adds default InMemoryHistoryProvider("memory") injection in constructor when no context providers are configured, using eager injection pattern
python/packages/core/tests/workflow/test_workflow_agent.py Adds two tests: one verifying default history provider injection and conversation history preservation, another verifying explicit providers are not modified

@eavanvalkenburg eavanvalkenburg added this pull request to the merge queue Feb 13, 2026
Merged via the queue into microsoft:main with commit f3ea872 Feb 13, 2026
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants