Overview
Integration details
| Class | Package | Serializable | JS support | Version |
|---|---|---|---|---|
| CodeInterpreterToolkit | langchain-aws | ✅ | ❌ |
Tool features
| Returns artifact | Native async | Return data | Pricing |
|---|---|---|---|
| ✅ | ✅ | Text, Files, Images | Pay-per-use (AWS) |
Available tools
The toolkit provides multiple tools for code execution and file management:| Tool | Description |
|---|---|
execute_code | Run Python/JavaScript/TypeScript code with persistent state |
execute_command | Run shell commands in the environment |
read_files | Read content of files in the environment |
write_files | Create or update files |
list_files | List files in directories |
delete_files | Remove files from the environment |
upload_file | Upload files with semantic descriptions |
install_packages | Install Python packages |
start_command_execution | Start a long-running command asynchronously |
get_task | Check status of an async task by task_id |
stop_task | Stop a running async task by task_id |
Setup
The integration lives in thelangchain-aws package, which wraps the bedrock-agentcore SDK.
Credentials
You need AWS credentials configured with permissions for Bedrock AgentCore Code Interpreter. See the Amazon Bedrock AgentCore documentation for required IAM permissions. It’s also helpful (but not needed) to set up LangSmith for best-in-class observability:Instantiation
The toolkit is created using an async factory function:Invocation
Direct tool usage
Get specific tools and invoke them:Use within an agent
Thread-based session isolation
The toolkit supports multiple concurrent sessions viathread_id. Each thread maintains its own code interpreter session with isolated state:
Working with files
Write and read files
Upload files with descriptions
Installing packages
Async task management
For long-running commands, you can start them asynchronously and check their status:Session cleanup
Always clean up sessions when done to release resources:API reference
For detailed documentation of all features and configurations, see:Connect these docs to Claude, VSCode, and more via MCP for real-time answers.