test(agent_transfer): add regression tests for non-LlmAgent peer transfers#6210
Open
AliMuhammadAslam wants to merge 1 commit into
Open
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.