Home/Tools/bedrock-agentcore

CodeInterpreterTools

bedrock-agentcore

Isolated sandbox for executing Python, JavaScript, and TypeScript code to solve complex tasks. Fully managed by Amazon Bedrock.

by Amazon Web Services

integration
v0.1.1
Apache-2.0
⚠️

This tool is currently broken

Import Failed
Cannot load from Railway service
Module not found "https://esm.sh/bedrock-agentcore@0.1.1".

Last checked: 12/29/2025, 3:52:29 AM

Interactive Playground

Test bedrock-agentcore (CodeInterpreterTools) with AI-powered execution

0/2000 characters

Installation & Usage

Install this tool and use it with the AI SDK

1. Install the package

npm install bedrock-agentcore
pnpm add bedrock-agentcore

2. Import the tool

import { CodeInterpreterTools } from 'bedrock-agentcore';

3. Use with AI SDK

import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { CodeInterpreterTools } from 'bedrock-agentcore';

const result = await generateText({
  model: openai('gpt-4o'),
  tools: { CodeInterpreterTools },
  prompt: 'Your prompt here...',
});

console.log(result.text);

AI Agent Integration

How AI agents can use this tool

Use Case

Use for secure code execution in AWS-managed sandbox

Limitations

Requires AWS credentials and Bedrock access

Examples

  • Execute Python data analysis
  • Run JavaScript computations
  • TypeScript code execution

Parameters

Available configuration options

No schema

No schema available for this tool.

README

Bedrock AgentCore SDK

Deploy your local AI agent to Bedrock AgentCore with zero infrastructure

GitHub commit activity GitHub open issues GitHub open pull requests License npm version Node.js versions

DocumentationSamplesDiscordAWS Boto3 SDKPython SDKTypeScript SDKStarter Toolkit

Overview

Amazon Bedrock AgentCore enables you to deploy and operate highly effective agents securely, at scale using any framework and model. With Amazon Bedrock AgentCore, developers can accelerate AI agents into production with the scale, reliability, and security, critical to real-world deployment. AgentCore provides tools and capabilities to make agents more effective and capable, purpose-built infrastructure to securely scale agents, and controls to operate trustworthy agents. Amazon Bedrock AgentCore services are composable and work with popular open-source frameworks and any model, so you don’t have to choose between open-source flexibility and enterprise-grade security and reliability.

What you get with Bedrock AgentCore:

  • Keep your agent logic - Works with Strands, LangGraph, CrewAI, Autogen, custom frameworks
  • Zero infrastructure management - No servers, containers, or scaling concerns
  • Enterprise-grade platform - Built-in auth, memory, observability, security
  • Production-ready deployment - Reliable, scalable, compliant hosting

Amazon Bedrock AgentCore services

⚠️ TypeScript SDK Scope

This SDK currently provides Code Interpreter and Browser tools. Additional service integrations are on the roadmap.

AgentCore Tools

💻 Code Interpreter

Execute Python, JavaScript, or TypeScript in a secure AWS-managed sandbox:

// Core client (framework-agnostic)
import { CodeInterpreterClient } from 'bedrock-agentcore/code-interpreter'
// Methods: startSession, stopSession, executeCode, writeFiles, readFiles, 
// listFiles, deleteFiles, executeCommand

🌐 Browser

Automate web browsing with cloud-based browser automation (compatible with Playwright, Puppeteer, and other browser automation SDKs):

// Playwright client (framework-agnostic)
import { PlaywrightBrowser } from 'bedrock-agentcore/browser/playwright'
// Methods: startSession, stopSession, navigate, click, fill, type, getText, 
// getHtml, screenshot, evaluate, waitForSelector, back, forward

AgentCore Tools with Vercel AI SDK

Integrate Code Interpreter and Browser capabilities into your AI agents using the Vercel AI SDK.

Installation

# Install the SDK
npm install bedrock-agentcore

# Install AI SDK v6 (required), use any model provider
npm install ai@beta @ai-sdk/amazon-bedrock@beta

# Install Playwright (optional, only for Browser tools)
npm install playwright

Prerequisites:

  • Node.js >= 20.0.0
  • AWS credentials with Bedrock AgentCore access
  • Access to any large language model like models available in AWS Bedrock

Integration

import { bedrock } from '@ai-sdk/amazon-bedrock'
import { ToolLoopAgent } from 'ai'
import { CodeInterpreterTools } from 'bedrock-agentcore/code-interpreter/vercel-ai'
import { BrowserTools } from 'bedrock-agentcore/browser/vercel-ai'

const codeInterpreter = new CodeInterpreterTools()
const browser = new BrowserTools()

const agent = new ToolLoopAgent({
  model: bedrock('global.anthropic.claude-sonnet-4-20250514-v1:0'),
  tools: {
    ...codeInterpreter.tools,
    ...browser.tools,
  },
})

// Invoke the agent with any prompt
const result = await agent.run({
  prompt: 'Visit news.ycombinator.com, scrape the top 5 stories, and analyze sentiment',
})

console.log(result.text)

Note: If deploying to Vercel, use Vercel OIDC for secure AWS credentials.

Try Examples

Run the standalone example:

npx tsx examples/agent-with-code-interpreter.ts

Or try the Next.js app with streaming UI:

cd examples/deep-research-ui && npm install && npm run dev

🏗️ Deployment

See AWS setup guide for getting started with agentcore.

Production: AWS CDK.

📝 License & Contributing

Statistics

Downloads/month

651

GitHub Stars

0

Quality Score

82%

NPM Keywords

aws
bedrock
agentcore
agents
ai
typescript
sdk

Maintainers

rsundaraws(sdraghav@amazon.com)
siwachabhi(siwachabhi@gmail.com)

Frameworks

vercel-ai