New pattern - lambda-strands-agent-bedrock-cdk#3093
Conversation
…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.
|
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. |
|
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
left a comment
There was a problem hiding this comment.
Hello @NithinChandranR-AWS, thanks for your contribution, please find a few comments/requests for changes attached. Please review
| agentFn.addToRolePolicy( | ||
| new iam.PolicyStatement({ | ||
| actions: [ | ||
| "bedrock:InvokeModel", | ||
| "bedrock:InvokeModelWithResponseStream", | ||
| ], | ||
| resources: ["*"], | ||
| }) | ||
| ); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Good catch and thank you for the feedback, I've scoped to the specific inference-profile and foundation-model ARNs now.
|
|
||
| ## How it works | ||
|
|
||
|  |
There was a problem hiding this comment.
The README references , but there is no architecture.png file in the pattern directory. The image will render as a broken link on GitHub and serverlessland.com.
There was a problem hiding this comment.
Replaced the broken image link with a text architecture description in its own section. All the previous patterns, the JSON file created one on its own, i can create one if thats not the case, Please advice.
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
Added a Verification section with a describe-stacks command to confirm outputs after deploy.
| code: lambda.Code.fromAsset("src/agent"), | ||
| timeout: cdk.Duration.minutes(2), | ||
| memorySize: 512, | ||
| architecture: lambda.Architecture.X86_64, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Fixed it, comment now says x86_64 to match the layer ARN and architecture config.
| @@ -0,0 +1,43 @@ | |||
| """Strands Agents SDK agent deployed on AWS Lambda with Amazon Bedrock.""" | |||
|
|
|||
| import json | |||
There was a problem hiding this comment.
The json module is imported but never used. Removing unused imports keeps example code clean.
There was a problem hiding this comment.
Removed, thanks for catching that.
|
All comments addressed and pushed. Thanks for the thorough review, @marcojahn , Appreciate your time and help. |
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
arn:aws:lambda:{region}:856699698935:layer:strands-agents-py3_12-x86_64:1)@tooldecorator for calculator toolChecklist