fix(code-interpreter): add blob support to write_files for binary file uploads#462
Open
rogep wants to merge 2 commits intostrands-agents:mainfrom
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix(code-interpreter): add blob support to write_files for binary file uploads
Description
write_filescurrently only passestextto the BedrockAgentCore SDK,silently dropping any
blobfield. This means binary files (images,compiled artifacts, etc.) cannot be written to the sandbox, but the SDK
supports
blobonwriteFilesbut the tool never forwarded it.Changes:
blob: Optional[str]field toFileContentmodel with amodel_validatorenforcing that exactly one oftextorblobis setwrite_filesinAgentCoreCodeInterpreterto forwardblobto the SDK when present, falling back to
textDiscovered this gap while using the tool in production to write binary
files to a sandbox session. The BedrockAgentCore SDK already supports
blobonwriteFiles(see SDK source), but the strands tool justwasn't surfacing it.
Related Issues
Fixes #304
Documentation PR
N/A
Type of Change
Bug fix
Testing
Added a test covering a mixed
contentlist with bothtextandblobentries flowing through the tool dispatch.
Verified that the BedrockAgentCore SDK already supports
blobonwriteFiles: https://github.com/aws/bedrock-agentcore-sdk-python/blob/main/src/bedrock_agentcore/tools/code_interpreter_client.py#L516hatch run prepareChecklist
By submitting this pull request, I confirm that you can use, modify, copy,
and redistribute this contribution, under the terms of your choice.