Skip to content

Commit 89a7f78

Browse files
committed
fix: Default to tool_call when interaction_type is not set
1 parent 6506924 commit 89a7f78

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

adk/agenticlayer/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def parse_sub_agents(sub_agents_config: str) -> list[SubAgent]:
4545
SubAgent(
4646
name=agent_name,
4747
url=config["url"],
48-
interaction_type=InteractionType(config.get("interaction_type")),
48+
interaction_type=InteractionType(config.get("interaction_type", "tool_call")),
4949
)
5050
for agent_name, config in agents_map.items()
5151
]

adk/tests/test_config.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,17 @@ def test_parse_sub_agents_with_different_interaction_types(self) -> None:
1616
"sub_agent_2": {
1717
"url": "http://sub-agent-2.local/.well-known/agent-card.json",
1818
"interaction_type": "tool_call"
19+
},
20+
"sub_agent_3": {
21+
"url": "http://sub-agent-3.local/.well-known/agent-card.json"
1922
}
2023
}"""
2124

2225
# When: Parsing the config
2326
sub_agents = parse_sub_agents(config)
2427

2528
# Then: Both sub-agents are parsed correctly
26-
assert len(sub_agents) == 2
29+
assert len(sub_agents) == 3
2730

2831
transfer_agent = next(a for a in sub_agents if a.name == "sub_agent_1")
2932
assert str(transfer_agent.url) == "http://sub-agent-1.local/.well-known/agent-card.json"
@@ -33,6 +36,10 @@ def test_parse_sub_agents_with_different_interaction_types(self) -> None:
3336
assert str(tool_call_agent.url) == "http://sub-agent-2.local/.well-known/agent-card.json"
3437
assert tool_call_agent.interaction_type == InteractionType.TOOL_CALL
3538

39+
tool_call_agent = next(a for a in sub_agents if a.name == "sub_agent_3")
40+
assert str(tool_call_agent.url) == "http://sub-agent-3.local/.well-known/agent-card.json"
41+
assert tool_call_agent.interaction_type == InteractionType.TOOL_CALL
42+
3643
def test_parse_sub_agents_empty_config(self) -> None:
3744
"""Test parsing empty sub-agents config."""
3845
assert parse_sub_agents("{}") == []

0 commit comments

Comments
 (0)