Commit c31f7ef
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 e6df097 commit c31f7ef
2 files changed
Lines changed: 17 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
180 | | - | |
| 180 | + | |
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1409 | 1409 | | |
1410 | 1410 | | |
1411 | 1411 | | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
1412 | 1428 | | |
1413 | 1429 | | |
1414 | 1430 | | |
| |||
0 commit comments