Skip to content

Python: Support global and executor-specific workflow invocation kwargs together #7962

Description

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

pythonUsage: [Issues, PRs], Target: PythonworkflowsUsage: [Issues, PRs], Target: Workflows

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions