Python: Add documentation for declaration-only tools and middleware ordering#3774
Merged
giles17 merged 3 commits intomicrosoft:mainfrom Feb 10, 2026
Merged
Python: Add documentation for declaration-only tools and middleware ordering#3774giles17 merged 3 commits intomicrosoft:mainfrom
giles17 merged 3 commits intomicrosoft:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds clarifying documentation in the Python Agent Framework for (1) declaration-only tools and (2) middleware execution ordering when mixing agent-level and run-level middleware.
Changes:
- Document
func=Nonebehavior for declaration-only tools inFunctionTooland@tooldecorator docs, including an example. - Add a detailed middleware execution ordering explanation to the agent/run-level middleware sample.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| python/samples/getting_started/middleware/agent_and_run_level_middleware.py | Expands sample documentation to explain agent-level vs run-level middleware ordering with an execution diagram. |
| python/packages/core/agent_framework/_tools.py | Documents func=None for declaration-only tools in FunctionTool and tool() docstrings and adds an example. |
python/samples/getting_started/middleware/agent_and_run_level_middleware.py
Outdated
Show resolved
Hide resolved
Member
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||
dmytrostruk
approved these changes
Feb 10, 2026
markwallace-microsoft
approved these changes
Feb 10, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Motivation and Context
Adds documentation for declaration-only tools and middleware execution ordering.
Changes
_tools.py: Documentfuncparameter in@tooldecorator andFunctionToolclass explaining declaration-only tool usage (func=None)agent_and_run_level_middleware.py: Add detailed middleware execution ordering documentationLinked Issues
Closes #3580
Closes #3582
Description
Contribution Checklist