Skip to content

aws/bedrock-agentcore-sdk-typescript

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