generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 219
feat: add Bedrock AgentCore Code Interpreter tool #148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
dbschmigelski
merged 1 commit into
strands-agents:main
from
dbschmigelski:agent-core-code-interpreter
Jul 16, 2025
Merged
feat: add Bedrock AgentCore Code Interpreter tool #148
dbschmigelski
merged 1 commit into
strands-agents:main
from
dbschmigelski:agent-core-code-interpreter
Jul 16, 2025
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
mehtarac
approved these changes
Jul 16, 2025
poshinchen
approved these changes
Jul 16, 2025
jer96
approved these changes
Jul 16, 2025
8 tasks
cagataycali
added a commit
that referenced
this pull request
Jul 21, 2025
* test(load_tool): add e2e test for load tool * test(load_tool): update providing tool path * Update calculator tests to not use .invoke as 0.3.0 removed it (#132) Co-authored-by: Mackenzie Zastrow <zastrowm@users.noreply.github.com> * fix(a2a): prefix tools and updated default timeout (#134) Co-authored-by: jer <jerebill@amazon.com> * feat: add HTML to markdown conversion for http_request tool (#63) * feat: add HTML to markdown conversion for http_request tool - Add markdownify and readabilipy dependencies - Add convert_to_markdown parameter to http_request tool - Automatically detect and convert HTML responses to markdown - Add tests and documentation with usage examples --------- Co-authored-by: Murat Kaan Meral <murmeral@amazon.nl> * feat: Add handoff to user tool (#142) * remove references to max_parallel_tools (#144) * Chore: Remove Preview (#141) Chore: update contributions doc to reflect community driven status * Chore: bump to require v1.0.0 (#145) * feat: migrate multi-agent tools to sdk native patterns and model support (#143) * feat: Major refactor - Migrate to Strands SDK native patterns & add comprehensive model support 🚀 Overview: - Migrate custom implementations to native Strands SDK patterns - Add comprehensive model provider support (9+ providers) - Enhance reliability, performance, and user experience - Maintain backward compatibility 🔄 Key Changes: - agent_graph.py → graph.py (SDK GraphBuilder integration) - use_llm.py → use_agent.py (enhanced nested agent creation) - Complete swarm tool architecture overhaul - Enhanced think tool with model switching - Production-ready workflow orchestration - New model utilities system in src/strands_tools/models/ 📊 Impact: - Files Changed: 25+ files - Lines Added: ~2,000 lines - Lines Removed: ~1,100 lines - New model providers: Bedrock, Anthropic, LiteLLM, LlamaAPI, Ollama, OpenAI, Writer, Cohere, GitHub - 700+ test cases covering new functionality ✅ Backward compatibility maintained with gradual migration path * fix(deps): convert SSH git URLs to HTTPS for GitHub runner compatibility - Changed git+ssh://git@github.com URLs to git+https://github.com URLs - Fixes git clone failures in CI/CD environments that lack SSH key access - Updated both main dependencies and hatch-static-analysis dependencies * feat: restore deprecated tools for backward compatibility and update deps - Add use_llm and agent_graph tools back with deprecation warnings - These tools will be removed in next major release - Move Stability AI documentation to docs/stability_ai_tool.md - Update pyproject.toml dependencies to use proper version ranges - Add comprehensive test suites for both deprecated tools - Maintain backward compatibility while guiding users to new APIs * build: replace git dependency with version constraint for strands-agents * refactor(models): move models to utils/models directory - Move all model files from strands_tools/models/ to strands_tools/utils/models/ - Update import statements in graph.py, think.py, use_agent.py, and workflow.py - Reorganize codebase structure for better organization * fix(deps): remove duplicate strands-agents dependency - Removed duplicate strands-agents[a2a] dependency from pyproject.toml - Keeps only the base strands-agents dependency --------- Co-authored-by: Arron <139703460+awsarron@users.noreply.github.com> * build(pyproject): update development status classifier (#146) * Add AgentCoreMemoryToolProvider for AgentCore Memory Service Integration (#147) * feat: add Bedrock AgentCore Code Interpreter tool (#148) * feat: add Bedrock AgentCore Browser Tool (#149) * Add community-driven call out to the top of the file (#151) We do the same further down, but you have to jump past the list of tools + environment variables to see it, so making it more prominent towards the top of the readme. Co-authored-by: Mackenzie Zastrow <zastrowm@users.noreply.github.com> * test(load_tool): add e2e test for load tool * test(load_tool): update providing tool path * test(load_tool): fix naming consistency --------- Co-authored-by: Jack Yuan <jackypc@amazon.com> Co-authored-by: Mackenzie Zastrow <3211021+zastrowm@users.noreply.github.com> Co-authored-by: Mackenzie Zastrow <zastrowm@users.noreply.github.com> Co-authored-by: Jeremiah <jbill7696@gmail.com> Co-authored-by: jer <jerebill@amazon.com> Co-authored-by: Murat Kaan Meral <muratkaanmeral@gmail.com> Co-authored-by: Murat Kaan Meral <murmeral@amazon.nl> Co-authored-by: Patrick Gray <pgrayy@amazon.com> Co-authored-by: Jonathan Segev <jsegev01@gmail.com> Co-authored-by: ./c² <cagataycali@icloud.com> Co-authored-by: Arron <139703460+awsarron@users.noreply.github.com> Co-authored-by: mehtarac <mehtarac@amazon.com> Co-authored-by: Dean Schmigelski <dbschmigelski+github@gmail.com>
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.
Description
This pull request introduces a Code Interpreter tool that provides secure, isolated sandbox environments for executing code in multiple programming languages
including Python, JavaScript, and TypeScript. The implementation follows a modular architecture with clear separation of concerns between the tool interface, platform abstraction, and underlying execution engines.
The core design centers around a wrapper class pattern that encapsulates platform lifecycle management while exposing a clean tool interface through the Strands @tool decorator. This wrapper approach was chosen to provide stateful tool functionality, allowing the tool to maintain persistent sessions and manage platform resources
automatically:
The CodeInterpreter class handles initialization, cleanup, and auto-start functionality, ensuring that users don't need to manually manage platform lifecycle while still providing explicit control when needed.
The implementation leverages Pydantic models extensively for input validation and type safety. Rather than using a single schema with numerous optional fields that would require complex runtime validation logic, we opted for discriminated unions with specific action models:
Instead of this complex approach with runtime validation:
We use discriminated unions with specific models:
This approach provides several key benefits: type checking ensures correctness, each action type has clearly defined required and optional fields, validation errors are specific and actionable, and the code is self-documenting through the type system. The Pydantic approach eliminates the need for manual validation code that would be error-prone and difficult to maintain.
Platform abstraction is achieved through the CodeInterpreter base class, which defines a consistent interface that any execution backend must implement. This modular design enables seamless integration of different execution environments. The current implementation include an AgentCoreCodeInterpreter for AWS-based sandbox execution, but the architecture readily supports additional platforms. A local platform could be implemented using Docker containers or virtual environments, while third-party platforms like CodeSandbox.io or custom Kubernetes-based solutions could be integrated by simply implementing the platform protocol.
Related Issues
[Link to related issues using #issue-number format]
Documentation PR
[Link to related associated PR in the agent-docs repo]
Type of Change
Testing
[How have you tested the change?]
hatch fmt --linterhatch fmt --formatterhatch test --allChecklist
I have read the CONTRIBUTING document
I have added tests that prove my fix is effective or my feature works
I have updated the documentation accordingly
I have added an appropriate example to the documentation to outline the feature
My changes generate no new warnings
Any dependent changes have been merged and published
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.