Description
Workflow.run(function_invocation_kwargs=...) supports either a flat mapping applied to every agent executor or a mapping keyed by executor ID. It does not currently provide a public way to combine shared tool invocation kwargs with executor-specific overrides.
For example, this currently cannot be expressed through the public API:
function_invocation_kwargs = {
"__global__": {"tenant_id": tenant_id},
"researcher": {"search_region": "global"},
}
The __global__ sentinel already exists internally, but Workflow._resolve_invocation_kwargs treats a mapping containing executor IDs as entirely per-executor, and AgentExecutor does not merge the two mappings.
Proposed behavior
- Accept an explicit
__global__ mapping alongside executor-specific mappings.
- Apply global kwargs to every agent executor.
- Merge executor-specific kwargs on top of global kwargs, with executor-specific values taking precedence on collisions.
- Preserve propagation through nested workflows.
- Keep existing flat-global and per-executor forms backward compatible.
This follows the kwargs propagation work completed in #2895 / #2894 and addresses the remaining ergonomics gap for workflows with shared tool context plus agent-specific tool settings.
Description
Workflow.run(function_invocation_kwargs=...)supports either a flat mapping applied to every agent executor or a mapping keyed by executor ID. It does not currently provide a public way to combine shared tool invocation kwargs with executor-specific overrides.For example, this currently cannot be expressed through the public API:
The
__global__sentinel already exists internally, butWorkflow._resolve_invocation_kwargstreats a mapping containing executor IDs as entirely per-executor, andAgentExecutordoes not merge the two mappings.Proposed behavior
__global__mapping alongside executor-specific mappings.This follows the kwargs propagation work completed in #2895 / #2894 and addresses the remaining ergonomics gap for workflows with shared tool context plus agent-specific tool settings.