fix(code_executors): send correct field names for sandbox input files#5958
fix(code_executors): send correct field names for sandbox input files#5958jordanchendev wants to merge 2 commits into
Conversation
|
/adk-pr-analyze |
|
I will read the instructions for the You can also view the persistent artifact report directly at pr_5958_analysis.md. 🔍 ADK Pull Request Analysis: PR #5958Title: Executive Summary
Detailed Findings & Analysis1. Objectives & Impact ("What does it do?")
2. Justification & Value ("Is it a valid and useful change?")
3. Principle & Style Alignment Checklist ("Does it follow rules?")
Conclusion & RecommendationThe pull request is clean, correctly targeted, highly necessary, and fully compliant with ADK architectural guidelines. I recommend approving this PR directly. |
|
Hi @jordanchendev, 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 @GWeale , can you please review this. |
b1e0132 to
4a4a09e
Compare
AgentEngineSandboxCodeExecutor was sending 'contents' and 'mimeType' when the Agent Engine Sandbox API expects 'content' and 'mime_type'. This caused input files to be silently unreadable inside the sandbox, producing errors such as pandas.errors.EmptyDataError. Fixes google#3690 Change-Id: Iff6b79d03c0f4ed6cc50a73913454084e5f45082
4a4a09e to
20b6918
Compare
Merge #5958 ## Problem `AgentEngineSandboxCodeExecutor` was building the input-file payload with incorrect JSON field names: | Code sent | API expects | |------------|-------------| | `contents` | `content` | | `mimeType` | `mime_type` | This caused all input files to be silently unreadable inside the sandbox, producing errors such as: ``` pandas.errors.EmptyDataError: No columns to parse from file ``` Fixes #3690 ## Changes - `src/google/adk/code_executors/agent_engine_sandbox_code_executor.py` — rename the two dict keys in the `input_data['files']` list comprehension. - `tests/unittests/code_executors/test_agent_engine_sandbox_code_executor.py` — add regression test `test_execute_code_sends_correct_field_names_for_input_files` that verifies the correct keys are sent to the API. ## Testing plan - [x] New regression test added that asserts `content` and `mime_type` are used (was failing before the fix, passes after). - [x] All existing tests in the file still pass. ### pytest output ``` uv run --extra test python -m pytest tests/unittests/code_executors/test_agent_engine_sandbox_code_executor.py -v ======================== 11 passed, 5 warnings in 2.04s ======================== ``` ### pre-commit ``` pre-commit run --files src/google/adk/code_executors/agent_engine_sandbox_code_executor.py \ tests/unittests/code_executors/test_agent_engine_sandbox_code_executor.py isort....................................................................Passed pyink....................................................................Passed addlicense...............................................................Passed ``` Co-authored-by: Kathy Wu <wukathy@google.com> COPYBARA_INTEGRATE_REVIEW=#5958 from jordanchendev:fix/3690-sandbox-input-file-field-names eefe911 PiperOrigin-RevId: 933868136
|
Thank you @jordanchendev for your contribution! 🎉 Your changes have been successfully imported and merged via Copybara in commit 2b7e08a. Closing this PR as the changes are now in the main branch. |
Problem
AgentEngineSandboxCodeExecutorwas building the input-file payload withincorrect JSON field names:
contentscontentmimeTypemime_typeThis caused all input files to be silently unreadable inside the sandbox,
producing errors such as:
Fixes #3690
Changes
src/google/adk/code_executors/agent_engine_sandbox_code_executor.py— rename the two dict keys in theinput_data['files']list comprehension.tests/unittests/code_executors/test_agent_engine_sandbox_code_executor.py— add regression testtest_execute_code_sends_correct_field_names_for_input_filesthat verifies the correct keys are sent to the API.Testing plan
contentandmime_typeare used (was failing before the fix, passes after).pytest output
pre-commit