Commit 47f43dd
committed
fix(runners): widen Runner.__init__ agent param to accept BaseNode
The `Runner.agent` class field is typed `Optional[BaseAgent | 'BaseNode']`
and the runtime explicitly branches on `isinstance(self.agent, BaseNode)`
in both `run_async` and `run_live`, so a `BaseNode` root (e.g. a
`Workflow`) works at runtime. However, the `__init__` `agent` parameter
was still typed `Optional[BaseAgent]`, so type checkers reject
`Runner(agent=my_workflow)`.
Widen the `__init__` `agent` annotation to `Optional[BaseAgent | 'BaseNode']`
to match the class field, mirroring the existing forward-reference style
used for the field and the `run_live` `node` parameter. This is a
type-only change with no runtime behavior change.
Fixes #62701 parent 2e878ed commit 47f43dd
2 files changed
Lines changed: 18 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
239 | 239 | | |
240 | 240 | | |
241 | 241 | | |
242 | | - | |
| 242 | + | |
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
| |||
320 | 320 | | |
321 | 321 | | |
322 | 322 | | |
323 | | - | |
| 323 | + | |
324 | 324 | | |
325 | 325 | | |
326 | 326 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1777 | 1777 | | |
1778 | 1778 | | |
1779 | 1779 | | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
| 1789 | + | |
| 1790 | + | |
| 1791 | + | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
1780 | 1796 | | |
1781 | 1797 | | |
1782 | 1798 | | |
| |||
0 commit comments