Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/google/adk/tools/agent_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,12 @@ async def run_async(
# to avoid "Attempted to exit cancel scope in a different task" errors
await runner.close()

if not last_content:
if not last_content or not last_content.parts:
return ''
merged_text = '\n'.join(p.text for p in last_content.parts if p.text)
# no text present -> no json, return empty string
if not merged_text:
return ''
if isinstance(self.agent, LlmAgent) and self.agent.output_schema:
tool_result = self.agent.output_schema.model_validate_json(
merged_text
Expand Down