Skip to content

Python: [BREAKING] Renamed AgentRunContext to AgentContext - #3714

Merged
Eduard van Valkenburg (eavanvalkenburg) merged 2 commits into
microsoft:mainfrom
dmytrostruk:agent-context-rename
Feb 6, 2026
Merged

Python: [BREAKING] Renamed AgentRunContext to AgentContext#3714
Eduard van Valkenburg (eavanvalkenburg) merged 2 commits into
microsoft:mainfrom
dmytrostruk:agent-context-rename

Conversation

@dmytrostruk

Copy link
Copy Markdown
Member

Motivation and Context

Resolves: #3676

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

@dmytrostruk Dmytro Struk (dmytrostruk) added the python Usage: [Issues, PRs], Target: Python label Feb 6, 2026
Copilot AI review requested due to automatic review settings February 6, 2026 00:18
@markwallace-microsoft Mark Wallace (markwallace-microsoft) added the documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs label Feb 6, 2026
@markwallace-microsoft

Mark Wallace (markwallace-microsoft) commented Feb 6, 2026

Copy link
Copy Markdown
Contributor

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/core/agent_framework
   _middleware.py3291695%80, 83, 88, 797, 799, 801, 922, 949, 951, 976, 1057, 1061, 1185, 1189, 1250, 1324
   _serialization.py105496%516, 532, 542, 610
packages/purview/agent_framework_purview
   _middleware.py950100% 
TOTAL16515200887% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
3911 225 💤 0 ❌ 0 🔥 1m 5s ⏱️

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.

Pull request overview

This pull request implements a breaking change that renames AgentRunContext to AgentContext across the Python implementation of the Agent Framework. This change resolves issue #3676 and simplifies the naming convention for the agent middleware context object.

Changes:

  • Renamed the AgentRunContext class to AgentContext in the core middleware module
  • Updated all imports, type hints, and references across test files, samples, and documentation
  • Updated serialization documentation examples to reflect the new naming

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
python/packages/core/agent_framework/_middleware.py Core class rename from AgentRunContext to AgentContext, including class definition, docstrings, type aliases, and __all__ exports
python/packages/core/agent_framework/_serialization.py Updated serialization documentation examples to use AgentContext and agent_context type identifier
python/packages/core/AGENTS.md Updated architecture documentation and code examples to reference AgentContext
python/packages/core/tests/core/test_middleware.py Updated test class name from TestAgentRunContext to TestAgentContext and all type hints
python/packages/core/tests/core/test_middleware_with_agent.py Updated all middleware type hints and docstrings to use AgentContext
python/packages/core/tests/core/test_middleware_context_result.py Updated all imports and type hints to use AgentContext
python/packages/core/tests/core/test_as_tool_kwargs_propagation.py Updated imports and middleware type hints
python/packages/purview/agent_framework_purview/_middleware.py Updated middleware implementation to use AgentContext
python/packages/purview/tests/test_middleware.py Updated all test fixtures and type hints
python/samples/getting_started/middleware/*.py Updated all middleware sample files to use AgentContext in imports, type hints, and comments
python/samples/getting_started/middleware/README.md Updated documentation to reference AgentContext
python/samples/concepts/tools/README.md Updated sequence diagram documentation to use AgentContext

Comment thread python/packages/core/AGENTS.md Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Merged via the queue into microsoft:main with commit 09f59b2 Feb 6, 2026
24 checks passed
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.

Python: RenameAgentRunContext to just AgentContext.

5 participants