Repository navigation
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The narrowly scoped implementation preserves compatibility direction and recursive validation, with focused regression coverage and no blocking issues identified.
No open issues 🎉
What changed in this PR
This PR fixes workflow type validation for parameterized collection interfaces, addressing #9449 and allowing Sequence[Message] start handlers through Workflow.as_agent().
Changes:
- Accepts compatible collection interfaces for
list,set,frozenset, anddict, recursively checking type arguments. - Uses dictionary key types for single-argument interfaces while preserving existing bare-container behavior and excluding tuples.
- Adds compatibility tests and end-to-end workflow regressions.
| File | Description |
|---|---|
python/packages/core/tests/workflow/test_workflow_builder.py |
Adds workflow execution and agent regressions for sequence handlers. |
python/packages/core/tests/workflow/test_typing_utils.py |
Tests compatible and incompatible parameterized collection types. |
python/packages/core/agent_framework/_workflows/_typing_utils.py |
Adds bounded collection-interface compatibility checks. |
Review effort: Balanced
|
M-Hietala Runtime compatibility now accepts parameterized collection interfaces, but handler dispatch still matches only the collection origin. If a destination has |
Motivation & Context
Workflow validation rejects valid connections such as list[str] -> Sequence[str] because the parameterized container types have different origins. This also prevents Workflow.as_agent() from accepting a start handler typed as Sequence[Message], even though the supplied message list satisfies that interface.
Description & Review Guide
Related Issue
Fixes #9449
AI Assistance
AI assistance details: Copilot assisted with implementation, focused validation, and this PR description.
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.