Skip to content

New pattern - lambda-strands-agent-bedrock-cdk#3093

Open
NithinChandranR-AWS wants to merge 1 commit into
aws-samples:mainfrom
NithinChandranR-AWS:NithinChandranR-AWS-feature-lambda-strands-agent-bedrock-cdk
Open

New pattern - lambda-strands-agent-bedrock-cdk#3093
NithinChandranR-AWS wants to merge 1 commit into
aws-samples:mainfrom
NithinChandranR-AWS:NithinChandranR-AWS-feature-lambda-strands-agent-bedrock-cdk

Conversation

@NithinChandranR-AWS

Copy link
Copy Markdown
Contributor

Description

Deploy a Strands Agents SDK agent on AWS Lambda using the official Lambda layer (no custom packaging), with Amazon Bedrock as the model provider and custom Python tool use.

Features

  • Official Strands Agents Lambda layer (arn:aws:lambda:{region}:856699698935:layer:strands-agents-py3_12-x86_64:1)
  • Custom @tool decorator for calculator tool
  • Function URL for testing
  • Python 3.12, X86_64

Checklist

  • My code follows the Serverless Land patterns guidelines
  • I have updated the README.md
  • I have added example-pattern.json
  • I have tested this pattern and it works
  • CDK synth passes

…bda with Bedrock

Deploy a Strands Agents SDK agent on AWS Lambda using the official
Lambda layer, with Amazon Bedrock as the model provider and custom
Python tool use. Zero patterns exist for Strands Agents in the repo.
@NithinChandranR-AWS

Copy link
Copy Markdown
Contributor Author

Hi @biswanathmukherjee 👋 This is the first Strands Agents pattern — AWS's new open-source agent framework (launched 2026). Shows Lambda + Strands Agent Layer + Bedrock tool use. Unique service integration with zero existing coverage. Deployed and tested.

@NithinChandranR-AWS

Copy link
Copy Markdown
Contributor Author

Hi @bfreiberg 👋 — friendly nudge on this pattern. It's been deployed and tested end-to-end on a live AWS account. Happy to address any feedback. Thank you!

@marcojahn marcojahn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @NithinChandranR-AWS, thanks for your contribution, please find a few comments/requests for changes attached. Please review

Comment on lines +33 to +41
agentFn.addToRolePolicy(
new iam.PolicyStatement({
actions: [
"bedrock:InvokeModel",
"bedrock:InvokeModelWithResponseStream",
],
resources: ["*"],
})
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Lambda execution role grants bedrock:InvokeModel and bedrock:InvokeModelWithResponseStream on Resource: "*". The actions are already scoped to two operations, but the wildcard resource allows the function to invoke every model in the account rather than just the one model it uses. The pattern hardcodes a single model in the MODEL_ID environment variable, so the resource can be scoped.


## How it works

![Architecture](architecture.png)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The README references ![Architecture](architecture.png), but there is no architecture.png file in the pattern directory. The image will render as a broken link on GitHub and serverlessland.com.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The README has a clear Testing section but no separate guidance to confirm the stack deployed successfully (e.g., checking stack status or that the function URL output was produced).

code: lambda.Code.fromAsset("src/agent"),
timeout: cdk.Duration.minutes(2),
memorySize: 512,
architecture: lambda.Architecture.X86_64,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment describes the Strands layer as "ARM64", but the layer ARN ends in -x86_64 and the function is configured with architecture: lambda.Architecture.X86_64.

@@ -0,0 +1,43 @@
"""Strands Agents SDK agent deployed on AWS Lambda with Amazon Bedrock."""

import json

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The json module is imported but never used. Removing unused imports keeps example code clean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants