fix: Annotate response type as None for transfer_to_agent tool and set empty Schema as response schema when tool has no response annotation

1. if a function has no return type annotation, we should treat it as returning any type
2. we use empty schema (with `type` as None) to indicate no type constraints and this is already supported by model server

PiperOrigin-RevId: 789808104
This commit is contained in:
Xiang (Sean) Zhou
2025-08-01 10:22:28 -07:00
committed by Copybara-Service
parent faadef167e
commit 86a44873e9
7 changed files with 242 additions and 16 deletions
@@ -89,7 +89,7 @@ def test_auto_to_single():
('sub_agent_1', 'response1'),
]
# root_agent should still be the current agent, becaues sub_agent_1 is single.
# root_agent should still be the current agent, because sub_agent_1 is single.
assert testing_utils.simplify_events(runner.run('test2')) == [
('root_agent', 'response2'),
]
@@ -140,7 +140,7 @@ def test_auto_to_auto_to_single():
def test_auto_to_sequential():
response = [
transfer_call_part('sub_agent_1'),
# sub_agent_1 responds directly instead of transfering.
# sub_agent_1 responds directly instead of transferring.
'response1',
'response2',
'response3',
@@ -189,7 +189,7 @@ def test_auto_to_sequential():
def test_auto_to_sequential_to_auto():
response = [
transfer_call_part('sub_agent_1'),
# sub_agent_1 responds directly instead of transfering.
# sub_agent_1 responds directly instead of transferring.
'response1',
transfer_call_part('sub_agent_1_2_1'),
'response2',
@@ -250,7 +250,7 @@ def test_auto_to_sequential_to_auto():
def test_auto_to_loop():
response = [
transfer_call_part('sub_agent_1'),
# sub_agent_1 responds directly instead of transfering.
# sub_agent_1 responds directly instead of transferring.
'response1',
'response2',
'response3',