[BREAKING] Python: Refactor workflows kwargs#5010
Merged
TaoChenOSU merged 10 commits intoApr 2, 2026
Merged
Conversation
Contributor
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors Python workflow run() kwarg handling by introducing explicit function_invocation_kwargs / client_invocation_kwargs routing (including per-executor targeting) and updating samples/tests to reflect the new model, as part of removing legacy workflow-kwargs compatibility paths (Issue #4850).
Changes:
- Add per-executor/global resolution for
function_invocation_kwargsandclient_invocation_kwargsand plumb them through workflow state → executors → agents. - Update workflow state-management samples to demonstrate global vs per-agent targeting.
- Adjust workflow/executor tests to validate new routing behavior and logging.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| python/samples/03-workflows/state-management/workflow_kwargs.py | Removes old sample demonstrating legacy kwargs flow. |
| python/samples/03-workflows/state-management/workflow_kwargs_per_agent.py | New sample showing per-agent (per-executor-id) function_invocation_kwargs. |
| python/samples/03-workflows/state-management/workflow_kwargs_global.py | New sample showing global function_invocation_kwargs delivery to all agents. |
| python/packages/core/tests/workflow/test_workflow_kwargs.py | Updates/extends tests for new invocation kwargs behavior, removes options-merging coverage. |
| python/packages/core/tests/workflow/test_agent_executor.py | Updates _prepare_agent_run_args tests and adds executor-kwargs resolution tests. |
| python/packages/core/agent_framework/_workflows/_workflow.py | Adds new invocation kwargs params, state persistence, and resolution logic. |
| python/packages/core/agent_framework/_workflows/_const.py | Introduces GLOBAL_KWARGS_KEY="__global__" sentinel. |
| python/packages/core/agent_framework/_workflows/_agent_executor.py | Extracts invocation kwargs from workflow state and routes per-executor/global into agent.run(). |
| python/packages/core/agent_framework/_evaluation.py | Minor formatting-only changes. |
Member
eavanvalkenburg
left a comment
There was a problem hiding this comment.
Looks good overall, couple of comments
TaoChenOSU
commented
Apr 1, 2026
TaoChenOSU
commented
Apr 1, 2026
TaoChenOSU
commented
Apr 1, 2026
eavanvalkenburg
approved these changes
Apr 2, 2026
westey-m
approved these changes
Apr 2, 2026
alliscode
pushed a commit
to alliscode/agent-framework
that referenced
this pull request
Apr 3, 2026
* Refactor workflows kwargs usage * Update sample * Add tests * Update samples * Fix formatting * Comments * Comments 2 * Comments 3 * Fix test and typing
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
Closes #4850
Description
This is considered breaking even with backward compatibility because it no longer supports passing runtime options to the agents.
Contribution Checklist