Repository navigation
Python: fix(declarative): keep internal workflow-routing kwargs out of the Agent.run splat - #8435
Merged
Evan Mattson (moonbox3) merged 1 commit intoSep 17, 2026
Conversation
…f the Agent.run splat The workflow state bag carries internal underscore-keyed copies for nested executor routing; the declarative agent step splatted the whole bag into Agent.run, which takes no **kwargs, so _raw_function_invocation_kwargs raised TypeError on the first agent step under AG-UI (microsoft#8413). The splat now forwards public parameters only, while additional_function_arguments still carries the full bag for nested routing.
Yufeng He (he-yufeng)
deployed
to
github-app-auth
September 16, 2026 16:11 — with
GitHub Actions
Active
Yufeng He (he-yufeng)
deployed
to
github-app-auth
September 16, 2026 16:11 — with
GitHub Actions
Active
Yufeng He (he-yufeng)
deployed
to
github-app-auth
September 16, 2026 16:11 — with
GitHub Actions
Active
Yufeng He (he-yufeng)
deployed
to
github-app-auth
September 16, 2026 16:11 — with
GitHub Actions
Active
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No unresolved review issues remain, and regression coverage is included.
Pull request overview
Fixes declarative workflow failures by preventing internal routing kwargs from being passed to Agent.run.
Changes:
- Filters underscore-prefixed internal kwargs before agent invocation.
- Preserves the full kwargs bag for tool forwarding.
- Adds regression and checkpoint coverage.
File summaries
| File | Description |
|---|---|
python/packages/declarative/tests/test_graph_executors.py |
Adds regression coverage and updates checkpoint expectations. |
python/packages/declarative/agent_framework_declarative/_workflows/_executors_agents.py |
Filters internal kwargs before invoking agents. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite (auto)
Note
Copilot is running an experiment and ran this review at Lite.
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Evan Mattson (moonbox3)
marked this pull request as ready for review
September 17, 2026 01:17
Evan Mattson (moonbox3)
approved these changes
Sep 17, 2026
Evan Mattson (moonbox3)
deployed
to
github-app-auth
September 17, 2026 01:18 — with
GitHub Actions
Active
This branch was successfully deployed
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 & Context
Running a declarative workflow through AG-UI fails on the first
InvokeAzureAgentstep withTypeError: Agent.run() got an unexpected keyword argument '_raw_function_invocation_kwargs'. The workflow state bag (WORKFLOW_RUN_KWARGS_KEY) carries internal routing copies (_raw_function_invocation_kwargs,_raw_client_kwargs) next to the public kwargs, and the declarative agent step splatted the whole bag intoAgent.run, which accepts only public parameters. The coreAgentExecutoralready filters through_prepare_agent_run_args; this path never did.Description & Review Guide
_executors_agents.py, the splat intoagent.run(..., **run_kwargs)now drops underscore-prefixed internal keys (in addition to the already-excludedoptions). The full bag still reachesoptions["additional_function_arguments"], so nested-workflow remapping that reads the raw copies keeps working unchanged.test_workflow_run_kwargs_survive_file_checkpoint_restorechanged: it previously pinned the raw key being forwarded toagent.run, which is exactly the behavior that TypeErrors against the realAgent.runsignature (the pinned mock accepted anything). It now asserts the raw key stays out of the call while remaining inadditional_function_arguments.The regression test drives the executor with a strict-signature stub agent (no
**kwargs): on the old code it raises the reported TypeError, on the new code the run completes and the full bag still reaches tool forwarding. Verified:test_graph_executors.py104 passed / 10 skipped (existing environment skips) on Python 3.13, ruff check and format per repo config.Related Issue
Fixes #8413
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.