Python: support mixed workflow invocation kwargs - #7963
Python: support mixed workflow invocation kwargs#7963Dineshsuriya D (droideronline) wants to merge 2 commits into
Conversation
Luis Rodriguez (luisangelrod)
left a comment
There was a problem hiding this comment.
The merge precedence in AgentExecutor looks consistent, and I verified the two affected workflow test modules plus Ruff check and format locally.
Could you add regression coverage for the other two behaviors described by this PR?
- Mixed client_kwargs, including an executor-specific value overriding the same global key.
- Mixed kwargs crossing a WorkflowExecutor, with a global value reaching the inner agents and an inner executor-specific override still winning.
The current new test covers only direct function_invocation_kwargs, so the client and nested propagation paths can regress independently. The Workflow.run docstring also explains "global" for function_invocation_kwargs but not client_kwargs, even though both accept it.
Since #7962 is still labeled triage, maintainer confirmation of "global" as the public spelling also seems important before merge.
|
Addressed in cda37e4. Added mixed client_kwargs coverage, mixed nested WorkflowExecutor coverage, and documented the collision-free WorkflowInvocationKwargs wrapper for both function_invocation_kwargs and client_kwargs. The wrapper uses global_kwargs plus executor_kwargs with executor-specific values taking precedence. |
Luis Rodriguez (luisangelrod)
left a comment
There was a problem hiding this comment.
The follow-up addresses the compatibility, nested-routing, client-kwargs, and documentation concerns. The two targeted workflow test modules pass, and strict core Pyright passes locally.
Two repository requirements remain:
uv run poe syntax -P core -Creports and auto-fixes the__all__ordering inagent_framework/__init__.pyi;WorkflowInvocationKwargsshould sort beforeWorkflowMessage.- Because this adds a root-level public API, please update
python/packages/core/AGENTS.mdas required by the package instructions. Sinceagent-framework-coreis released, it would also be useful for a maintainer to confirm whether this wrapper is intended to be released immediately or explicitly staged.
After those are resolved, the implementation looks ready for another pass.
Motivation & Context
Workflow runs currently support either flat global
function_invocation_kwargsor executor-specific mappings. Workflows that need shared tool context, such as tenant or request metadata, plus agent-specific tool settings cannot express both through the public API. This extends the kwargs propagation completed in #2895 / #2894.Description & Review Guide
"__global__"mapping alongside executor-specific mappings infunction_invocation_kwargsandclient_kwargs.AgentExecutor, with specific values taking precedence.{"__global__": common_kwargs, "executor_id": specific_kwargs}."__global__"is the preferred public spelling and whether merge precedence is intuitive.client_kwargsas implemented here.Related Issue
Fixes #7962
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix) — a workflow keeps the label and title prefix in sync automatically.