Repository navigation
test(agent_transfer): add regression tests for non-LlmAgent peer transfers - #6210
AliMuhammadAslam wants to merge 2 commits into
Conversation
…sfers Regression tests for google#5863. Before the hasattr guard was added to _get_transfer_targets, placing any agent without a 'mode' attribute (LoopAgent, SequentialAgent, ParallelAgent) alongside an LlmAgent in a parent's sub_agents raised: AttributeError: '<AgentType>' object has no attribute 'mode' Five tests are added: - LoopAgent as a peer agent does not raise - LoopAgent as a sub-agent does not raise - SequentialAgent as a peer agent does not raise - ParallelAgent as a peer agent does not raise - LlmAgent with mode='single_turn' is correctly excluded from targets
|
Hi @AliMuhammadAslam , Thank you for your contribution! We appreciate you taking the time to submit this pull request. Your PR has been received by the team and is currently under review. We will provide feedback as soon as we have an update to share. |
|
Hi @xuanyang15 , can you please review this. |
|
Hi @xuanyang15, just checking in on this — it's been a couple weeks since rohityan flagged it for your review. It's a small, test-only PR (the regression tests requested when #5910 was closed), and all checks are passing. Let me know if anything needs changing. |
Merge #6210 --- Adds regression tests for the `AttributeError` that occurred when `_get_transfer_targets` iterated over peer agents without a `mode` attribute (e.g. `LoopAgent`, `SequentialAgent`, `ParallelAgent`). The core fix — the `hasattr` guard in `_get_transfer_targets` — is already in `main`. These tests ensure the behaviour does not regress. As noted in #5910, the tests were not yet in `main`, so this is a test-only PR with no production code changes. **Five tests added to `test_get_transfer_targets.py`:** - `LoopAgent` as a peer agent does not raise `AttributeError` - `LoopAgent` as a sub-agent does not raise `AttributeError` - `SequentialAgent` as a peer agent does not raise `AttributeError` - `ParallelAgent` as a peer agent does not raise `AttributeError` - `LlmAgent` with `mode='single_turn'` is correctly excluded from transfer targets (verifies the filtering logic, not just the guard) All five use `MockModel` and real ADK agent objects — no external dependencies or mocking of internals. Co-authored-by: Xuan Yang <xygoogle@google.com> COPYBARA_INTEGRATE_REVIEW=#6210 from AliMuhammadAslam:test/loop-agent-peer-transfer-regression 7d6ada7 PiperOrigin-RevId: 948623403
|
Thank you @AliMuhammadAslam for your contribution! 🎉 Your changes have been successfully imported and merged via Copybara in commit 58a14e1. Closing this PR as the changes are now in the main branch. |
Merge google#6210 --- Adds regression tests for the `AttributeError` that occurred when `_get_transfer_targets` iterated over peer agents without a `mode` attribute (e.g. `LoopAgent`, `SequentialAgent`, `ParallelAgent`). The core fix — the `hasattr` guard in `_get_transfer_targets` — is already in `main`. These tests ensure the behaviour does not regress. As noted in google#5910, the tests were not yet in `main`, so this is a test-only PR with no production code changes. **Five tests added to `test_get_transfer_targets.py`:** - `LoopAgent` as a peer agent does not raise `AttributeError` - `LoopAgent` as a sub-agent does not raise `AttributeError` - `SequentialAgent` as a peer agent does not raise `AttributeError` - `ParallelAgent` as a peer agent does not raise `AttributeError` - `LlmAgent` with `mode='single_turn'` is correctly excluded from transfer targets (verifies the filtering logic, not just the guard) All five use `MockModel` and real ADK agent objects — no external dependencies or mocking of internals. Co-authored-by: Xuan Yang <xygoogle@google.com> COPYBARA_INTEGRATE_REVIEW=google#6210 from AliMuhammadAslam:test/loop-agent-peer-transfer-regression 7d6ada7 PiperOrigin-RevId: 948623403
Closes #5863
Adds regression tests for the
AttributeErrorthat occurred when_get_transfer_targetsiterated over peer agents without amodeattribute (e.g.LoopAgent,SequentialAgent,ParallelAgent).The core fix — the
hasattrguard in_get_transfer_targets— is already inmain. These tests ensure the behaviour does not regress. As noted in #5910, the tests were not yet inmain, so this is a test-only PR with no production code changes.Five tests added to
test_get_transfer_targets.py:LoopAgentas a peer agent does not raiseAttributeErrorLoopAgentas a sub-agent does not raiseAttributeErrorSequentialAgentas a peer agent does not raiseAttributeErrorParallelAgentas a peer agent does not raiseAttributeErrorLlmAgentwithmode='single_turn'is correctly excluded from transfer targets (verifies the filtering logic, not just the guard)All five use
MockModeland real ADK agent objects — no external dependencies or mocking of internals.