(
expected_path: list[str], *, agent_runner: TestRunner
)
| 55 | |
| 56 | |
| 57 | def assert_agent_transfer_path( |
| 58 | expected_path: list[str], *, agent_runner: TestRunner |
| 59 | ): |
| 60 | events = agent_runner.get_events() |
| 61 | idx_in_expected_path = len(expected_path) - 1 |
| 62 | # iterate events in reverse order |
| 63 | for event in reversed(events): |
| 64 | function_calls = event.get_function_calls() |
| 65 | if ( |
| 66 | len(function_calls) == 1 |
| 67 | and function_calls[0].name == 'transfer_to_agent' |
| 68 | ): |
| 69 | assert ( |
| 70 | function_calls[0].args['agent_name'] |
| 71 | == expected_path[idx_in_expected_path] |
| 72 | ) |
| 73 | idx_in_expected_path -= 1 |
| 74 | if idx_in_expected_path < 0: |
| 75 | return |
nothing calls this directly
no test coverage detected