Commit 2b7e08a
fix: send correct field names for sandbox input files
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: 9338681361 parent 0cb4c81 commit 2b7e08a
2 files changed
Lines changed: 50 additions & 2 deletions
File tree
- src/google/adk/code_executors
- tests/unittests/code_executors
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
184 | | - | |
| 184 | + | |
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
| |||
Lines changed: 49 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
160 | | - | |
| 160 | + | |
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
| |||
355 | 355 | | |
356 | 356 | | |
357 | 357 | | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
358 | 406 | | |
359 | 407 | | |
360 | 408 | | |
| |||
0 commit comments