fix: Fall back to code_execution_result.output when merged_text is empty#5551
fix: Fall back to code_execution_result.output when merged_text is empty#5551AmSach wants to merge 2 commits into
Conversation
When an inner code-executor agent returns only executable_code and code_execution_result (no text part), AgentTool.run_async was returning empty string because merged_text only extracts p.text. Now we check for code_execution_result.output as a fallback when merged_text is empty or whitespace, preserving computational output from inner agents that would otherwise be silently lost. Fixes google#5481
|
Response from ADK Triaging Agent Hello @AmSach, thank you for creating this PR! Could you please add a In addition, since this is a bug fix, could you please provide logs or a screenshot after the fix is applied to help reviewers better understand the fix? This information will help reviewers to review your PR more efficiently. Thanks! |
|
Thanks for the review! Here's the testing plan: Testing PlanManual Test:
Automated Test:
Behavior Before vs AfterBefore: Inner code-executor agent returns only After: When Fixes #5481 |
|
Hi @AmSach , Thank you for your contribution! We appreciate you taking the time to submit this pull request. Your PR has been received by the team and is currently under review. We will provide feedback as soon as we have an update to share. |
|
Hi @Jacksunwei , can you please review this. |
Fixed the bug described in issue #5481. When AgentTool.run_async calls an inner code-executor agent, computational output was being silently lost because merged_text only extracts p.text. Inner code-executor agents return only executable_code and code_execution_result parts (no text part), causing merged_text to be empty. Added fallback logic to check for code_execution_result.output when merged_text is empty. Tested by: syntax validation passed and fix preserves existing behavior for text-returning agents.