Skip to content

Python: middleware: Rename 'next' parameter to avoid shadowing built-in #3583

Closed

Description

The next parameter in middleware functions shadows Python's built-in next() function.

File: python/samples/getting_started/middleware/agent_and_run_level_middleware.py
Location: Line ~179

\\python
async def function_logging_middleware(
context: FunctionInvocationContext,
next: Callable[ # <- rename 'next' because it's a built-in
[FunctionInvocationContext], Awaitable[None]
],
) -> None:
\\

Action: Consider renaming the next parameter to avoid shadowing the built-in.

Parent issue: #3575

Activity

  1. changed the title [-][Python] Rename 'next' parameter in middleware to avoid shadowing built-in[/-] [+]Python: [Python] Rename 'next' parameter in middleware to avoid shadowing built-in[/+] on Feb 2, 2026
  2. changed the title [-]Python: [Python] Rename 'next' parameter in middleware to avoid shadowing built-in[/-] [+]Python: Rename 'next' parameter in middleware to avoid shadowing built-in[/+] on Feb 2, 2026
  3. changed the title [-]Python: Rename 'next' parameter in middleware to avoid shadowing built-in[/-] [+]Python: middleware: Rename 'next' parameter to avoid shadowing built-in[/+] on Feb 2, 2026
  4. moved this from In Progress to Done in Agent Frameworkon Feb 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

pythonUsage: [Issues, PRs], Target: Python

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions