A Bedrock Agent Core service built with TypeScript and Express.
- Node.js 18+
- npm
- Docker
- AWS CLI configured with appropriate permissions
- The
bedrock-agentcore-0.1.1.tgzfile in the project root directory
- Clone this repository
- Ensure
bedrock-agentcore-0.1.1.tgzis in the project root directory - Install dependencies:
npm install
- Build the project:
npm run build
# Build and run the service
npm start
# Or for development with auto-rebuild
npm run devThe service will be available at http://localhost:8080
# Build and run with Docker
docker build -t my-agent-service .
docker run -p 8080:8080 my-agent-service
# Or use the build script
bash build-docker.sh
docker run -p 8080:8080 my-agent-serviceTest your local service:
npm run invoke-
AWS CLI configured with permissions for:
- ECR (Elastic Container Registry)
- Bedrock Agent Core
- IAM (to get role ARN)
- STS (to get account ID)
-
The IAM role will be created automatically by the scripts
To create a new agent runtime for the first time:
# Initialize with default name "my-agent-service"
npm run initialize
# Or specify a custom name
npm run initialize -- my-custom-name
# Example
npm run initialize -- tjariy_bug_bashThe initialization process will:
- Build TypeScript
- Create IAM role (if needed)
- Create ECR repository
- Build and push Docker image
- Create a new Bedrock Agent Runtime
- Display the generated Runtime ID (save this for updates!)
Important: Save the Runtime ID from the output - you'll need it for updates.
To update an existing agent runtime:
# Update with your runtime ID
npm run update -- <runtime-id>
# Example
npm run update -- tjariy_bug_bash-abc1234567Runtime ID Format: <name>-<10-character-suffix>
- Example:
my-agent-service-abc1234567 - Pattern:
[a-zA-Z][a-zA-Z0-9_]{0,99}-[a-zA-Z0-9]{10}
The update process will:
- Validate runtime ID format
- Verify runtime exists
- Build TypeScript
- Build and push Docker image
- Update the Bedrock Agent Runtime
Wait about 1 minute for the update to complete, then test:
npm run invoke -- <runtime-arn>The ARN will be displayed at the end of the initialize or update process.
npm start- Build and run the service locallynpm run dev- Development mode with TypeScript compilationnpm run build- Compile TypeScriptnpm run invoke -- <runtime-arn>- Test the service (local or deployed)npm run initialize [name]- Create a new agent runtime (first-time setup)npm run update -- <runtime-id>- Update an existing agent runtimenpm run lint- Run ESLintnpm run format- Format code with Prettiernpm run check- Run lint and format
├── src/
│ ├── index.ts # Main service entry point
│ └── invoke.ts # Test invocation script
├── Dockerfile # Docker configuration
├── initialize.sh # First-time runtime creation script
├── update.sh # Runtime update script
├── build-docker.sh # Docker build script
├── create-iam-role.sh # IAM role creation script
└── package.json # Dependencies and scripts
The service uses the following configuration:
- Port: 8080 (configurable via environment)
- AWS Region: us-west-2 (configurable in initialize.sh and update.sh)
- ECR Repository: Based on runtime name/ID
- Bedrock package not found: Ensure
bedrock-agentcore-0.1.1.tgzis in the project root directory - Docker build fails: Check that Docker is running and you have sufficient permissions
- AWS deployment fails: Verify AWS CLI configuration and IAM permissions
- Service not responding: Check that port 8080 is available and not blocked by firewall
Check Docker logs:
docker logs <container-id>Check AWS CloudWatch logs for deployed service.