Bedrock Agentcore Samples Typescript banner
awslabs awslabs

Bedrock Agentcore Samples Typescript

AI community

Description

TypeScript samples for building AI agents with Amazon Bedrock AgentCore.

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

Amazon Bedrock AgentCore TypeScript Samples

TypeScript samples for building AI agents with Amazon Bedrock AgentCore.

What is Amazon Bedrock AgentCore?

Amazon Bedrock AgentCore is a fully managed service for deploying and running AI agents in production. It provides:

  • Runtime — Managed infrastructure for hosting agents and MCP servers
  • Identity — Secure credential management for both accessing agents and agents accessing external services
  • Memory — Persistent conversation and context storage
  • Gateway — Unified MCP layer for agents accessing REST APIs, Lambda functions, and more
  • Tools — Built-in Code Interpreter and Browser capabilities

The TypeScript SDK

The `bedrock-agentcore` SDK provides the building blocks for TypeScript agents.

Runtime

`BedrockAgentCoreApp` wraps any agent framework in an HTTP server that follows the AgentCore Runtime protocol—handling request parsing, streaming responses, and session management for seamless deployment:

import { BedrockAgentCoreApp } from 'bedrock-agentcore/runtime'

const app = new BedrockAgentCoreApp({
  invocationHandler: {
    process: async function* (request, context) {
      // Your agent logic here
      yield { event: 'message', data: { text: 'Hello!' } }
    },
  },
})

app.run() // Starts HTTP server on :8080

With a full agent framework:

import { Agent, BedrockModel, tool } from '@strands-agents/sdk'
import { BedrockAgentCoreApp } from 'bedrock-agentcore/runtime'
import { z } from 'zod'

const getWeather = tool({
  name: 'getWeather',
  description: 'Gets weather for a city',
  inputSchema: z.object({ city: z.string() }),
  callback: ({ city }) => `72°F and sunny in ${city}`,
})

const agent = new Agent({
  model: new BedrockModel({ modelId: 'global.amazon.nova-2-lite-v1:0', region: 'us-east-1' }),
  tools: [getWeather],
})

const app = new BedrockAgentCoreApp({
  invocationHandler: {
    requestSchema: z.object({ prompt: z.string() }),