chore: remove legacy validation that forbids co-exist of agent transfer and output_schema. Closes #3318

Remove validation for output_schema and agent transfer flags.

The check that prevented `output_schema` from co-existing with agent transfer capabilities (`disallow_transfer_to_parent` or `disallow_transfer_to_peers` being False) has been removed. The agent will no longer automatically set these transfer flags to True when `output_schema` is present.

Co-authored-by: Ieva Grublyte <ievagrublyte@google.com>
PiperOrigin-RevId: 825998224
This commit is contained in:
Ieva Grublyte
2025-10-30 06:06:26 -07:00
committed by Copybara-Service
parent ce8f674a28
commit c0892c725c
3 changed files with 31 additions and 51 deletions
@@ -72,6 +72,24 @@ async def test_output_schema_with_tools_validation_removed():
assert len(agent.tools) == 1
@pytest.mark.asyncio
async def test_output_schema_with_sub_agents():
"""Test that LlmAgent now allows output_schema with sub_agents."""
sub_agent = LlmAgent(
name='sub_agent',
model='gemini-1.5-flash',
)
agent = LlmAgent(
name='test_agent',
model='gemini-1.5-flash',
output_schema=PersonSchema,
sub_agents=[sub_agent],
)
assert agent.output_schema == PersonSchema
assert len(agent.sub_agents) == 1
@pytest.mark.asyncio
async def test_basic_processor_skips_output_schema_with_tools():
"""Test that basic processor doesn't set output_schema when tools are present."""