Skip to content

fix(code_executors): send correct field names for sandbox input files#5958

Open
jordanchendev wants to merge 1 commit into
google:mainfrom
jordanchendev:fix/3690-sandbox-input-file-field-names
Open

fix(code_executors): send correct field names for sandbox input files#5958
jordanchendev wants to merge 1 commit into
google:mainfrom
jordanchendev:fix/3690-sandbox-input-file-field-names

Conversation

@jordanchendev
Copy link
Copy Markdown

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

  • New regression test added that asserts content and mime_type are used (was failing before the fix, passes after).
  • 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

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
@jordanchendev jordanchendev marked this pull request as ready for review June 3, 2026 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AgentEngineSandboxCodeExecutor uses wrong JSON field names for stdout/stderr

1 participant