Python: [BREAKING] Renamed next middleware parameter to call_next#3735
Python: [BREAKING] Renamed next middleware parameter to call_next#3735dmytrostruk merged 4 commits intomicrosoft:mainfrom
Conversation
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Pull request overview
This PR standardizes the Python middleware “next step” parameter name from next to call_next across the Agent Framework Python codebase, samples, and documentation to avoid shadowing Python’s built-in next().
Changes:
- Renamed middleware callback parameter
next→call_nextthroughout Python samples and docs. - Updated core middleware abstractions/docs and dependent package middleware implementations to use
call_next. - Updated unit tests to reflect the new middleware parameter name.
Reviewed changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| python/samples/getting_started/middleware/thread_behavior_middleware.py | Renames middleware parameter and doc text to call_next. |
| python/samples/getting_started/middleware/shared_state_middleware.py | Renames function middleware parameter to call_next. |
| python/samples/getting_started/middleware/runtime_context_delegation.py | Renames function middleware parameter to call_next across examples. |
| python/samples/getting_started/middleware/override_result_with_middleware.py | Renames chat/agent middleware parameter to call_next. |
| python/samples/getting_started/middleware/middleware_termination.py | Renames agent middleware parameter to call_next and updates explanatory text. |
| python/samples/getting_started/middleware/function_based_middleware.py | Renames agent/function middleware parameter to call_next and updates comments. |
| python/samples/getting_started/middleware/exception_handling_with_middleware.py | Renames function middleware parameter to call_next. |
| python/samples/getting_started/middleware/decorator_middleware.py | Renames decorator-based middleware parameter to call_next. |
| python/samples/getting_started/middleware/class_based_middleware.py | Renames class-based middleware parameter to call_next and updates comments. |
| python/samples/getting_started/middleware/chat_middleware.py | Renames chat middleware parameter to call_next. |
| python/samples/getting_started/middleware/agent_and_run_level_middleware.py | Renames agent/run/function middleware parameters to call_next and updates comments. |
| python/samples/getting_started/devui/weather_agent_azure/agent.py | Renames chat/function middleware parameters to call_next. |
| python/samples/getting_started/agents/openai/openai_responses_client_with_agent_as_tool.py | Renames function middleware parameter to call_next. |
| python/samples/getting_started/agents/openai/openai_responses_client_basic.py | Renames chat middleware parameter to call_next. |
| python/samples/getting_started/agents/azure_ai/azure_ai_with_agent_as_tool.py | Renames function middleware parameter to call_next. |
| python/samples/concepts/tools/README.md | Updates diagrams and narrative from next to call_next. |
| python/packages/purview/agent_framework_purview/_middleware.py | Renames overridden middleware method parameter to call_next. |
| python/packages/orchestrations/agent_framework_orchestrations/_handoff.py | Renames function middleware parameter to call_next. |
| python/packages/ollama/tests/test_ollama_chat_client.py | Updates test middleware function parameter to call_next. |
| python/packages/core/tests/core/test_middleware_with_chat.py | Updates chat middleware tests to use call_next. |
| python/packages/core/tests/core/test_middleware_with_agent.py | Updates agent/function/chat middleware tests to use call_next. |
| python/packages/core/tests/core/test_middleware_context_result.py | Updates context.result-related middleware tests to use call_next. |
| python/packages/core/tests/core/test_middleware.py | Updates pipeline tests to use call_next. |
| python/packages/core/tests/core/test_as_tool_kwargs_propagation.py | Updates agent middleware in kwargs propagation tests to use call_next. |
| python/packages/core/agent_framework/_middleware.py | Updates middleware docs/examples and core signatures to call_next; updates related error text. |
| python/packages/core/AGENTS.md | Updates middleware example parameter name to call_next (but example semantics need correction). |
Comments suppressed due to low confidence (1)
python/packages/core/tests/core/test_middleware_with_agent.py:1758
- This statement is unreachable.
await call_next(context)
moonbox3
left a comment
There was a problem hiding this comment.
LGTM. Small nit: can we adjust the PR description to show some motivation and context as to why we're renaming (we understand internally, but external readers may not).
Sorry, I overlooked that you linked to some context. Disregard if you want... |
Motivation and Context
Resolves: #3583
Contribution Checklist