• Documentation
  • Pricing
© 2026 Serverless, Inc. All rights reserved.

Framework

  • Overview
  • Documentation
  • Plugins360
  • Pricing

Learn

  • Blog
  • GuidesUpdated
  • Examples240
  • Courses

Resources

  • Support
  • Security
  • Trust Center
  • Status

Community

  • Slack
  • GitHub47k
  • Forum
  • Meetups

Company

  • About
  • Careers
  • Contact
  • Partners

Legal

  • Terms of Service
  • Privacy Policy
  • Trademark
  • DMCA
Serverless, inc.

Bedrock AgentCore: LangGraph Basic Agent, Dockerfile Deploy (JavaScript)

by

Minimal LangGraph JS agent deployed to AWS Bedrock AgentCore via a custom Dockerfile build.

  1. Bedrock AgentCore: LangGraph Basic Agent, Dockerfile Deploy (JavaScript)

LangGraph JS Minimal Example

A minimal LangGraph JavaScript agent deployed to AWS Bedrock AgentCore using Serverless Framework.

Features

  • LangGraph JS: ReAct agent pattern with tool calling
  • Claude Sonnet 5: Powered by Amazon Bedrock
  • Simple Tools: Calculator operations and time queries
  • Docker Deployment: Auto-detected Dockerfile for easy deployment

Quick Start

Prerequisites

  • Node.js 20+
  • Docker (for local development)
  • AWS credentials configured
  • Serverless Framework CLI (npm install -g serverless)

Install Dependencies

npm install

Local Development

Start the agent locally with hot reload:

sls dev

This will:

  1. Build the Docker image
  2. Start the container with AWS credentials injected
  3. Open an interactive chat interface
  4. Watch for file changes and auto-rebuild

Try these prompts:

  • "What time is it?"
  • "What time is it in Tokyo?"
  • "Calculate 25 multiplied by 4"
  • "Add 100 and 250, then divide the result by 7"

Deploy to AWS

sls deploy

Invoke Deployed Agent

# Via Serverless Framework CLI
sls invoke --agent assistant --data '{"prompt":"Hello! What can you help me with?"}'

# Plain string is also supported:
# sls invoke --agent assistant -d "Hello! What can you help me with?"

# Or via curl (replace URL with your runtime URL from `sls info`)
curl -X POST https://your-runtime-url/invoke \
  -H "Content-Type: application/json" \
  -d '{"prompt":"Hello! What can you help me with?"}'

Remove

sls remove

Project Structure

langgraph-basic-dockerfile/
├── serverless.yml    # Serverless Framework configuration
├── agent.js          # LangGraph JS agent with tools
├── package.json      # npm dependencies
├── Dockerfile        # Container definition
└── README.md         # This file

How It Works

Agent Architecture

User Input
    │
    ▼
┌─────────────────┐
│  BedrockAgent   │
│    CoreApp      │◄─── HTTP Server (port 8080)
└────────┬────────┘
         │
         ▼
┌─────────────────┐
│   LangGraph     │
│  ReAct Agent    │◄─── Alternates between LLM and tools
└────────┬────────┘
         │
    ┌────┴────┐
    ▼         ▼
┌───────┐ ┌───────┐
│ Tools │ │ Claude│
│       │ │  LLM  │
└───────┘ └───────┘

Tools Available

ToolDescription
get_current_timeGet current date/time with optional timezone
addAdd two numbers
multiplyMultiply two numbers
divideDivide two numbers

Configuration

The serverless.yml is intentionally minimal:

service: langgraph-basic-dockerfile

provider:
  name: aws

ai:
  agents:
    assistant: {}

The Dockerfile is auto-detected, and default settings are applied:

  • Protocol: HTTP
  • Network: PUBLIC
  • Port: 8080

Customization

Adding New Tools

Edit agent.js to add new tools:

const myNewTool = tool(
  async ({ input }) => {
    // Tool implementation
    return `Result: ${input}`
  },
  {
    name: 'my_new_tool',
    description: 'Description for the LLM',
    schema: z.object({
      input: z.string().describe('Input parameter'),
    }),
  },
)

// Add to tools array
const tools = [getCurrentTime, add, multiply, divide, myNewTool]

Changing the Model

The default model is global.anthropic.claude-sonnet-5, read from the MODEL_ID environment variable in agent.js. Override it via the MODEL_ID env var, or edit the fallback in agent.js:

const MODEL_ID = process.env.MODEL_ID ?? 'global.anthropic.claude-sonnet-5'

const model = new ChatBedrockConverse({
  model: MODEL_ID,
  // Or use other models:
  // model: 'us.amazon.nova-2-lite-v1:0',
  // model: 'us.meta.llama3-70b-instruct-v1:0',
  region: process.env.AWS_REGION || 'us-east-1',
})

Related Examples

  • langgraph-basic-docker - Python version
  • langgraph-gateway - Lambda functions as tools

Contents

  • LangGraph JS Minimal Example
  • Features
  • Quick Start
  • Prerequisites
  • Install Dependencies
  • Local Development
  • Deploy to AWS
  • Invoke Deployed Agent
  • Remove
  • Project Structure
  • How It Works
  • Agent Architecture
  • Tools Available
  • Configuration
  • Customization
  • Adding New Tools
  • Changing the Model
  • Related Examples

Related

GuidesPluginsExamplesSlack CommunitySupport