-
Notifications
You must be signed in to change notification settings - Fork 434
Add lambda agentcore invocation tutorial #489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add lambda agentcore invocation tutorial #489
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Latest scan for commit: Security Scan ResultsScan Metadata
SummaryScanner ResultsThe table below shows findings by scanner, with status based on severity thresholds and dependencies: Column Explanations: Severity Levels (S/C/H/M/L/I):
Other Columns:
Scanner Results:
Severity Thresholds (Thresh Column):
Threshold Source: Values in parentheses indicate where the threshold is configured:
Statistics calculation:
|
Please clear the [Python Code Quality / python-lint] check. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
F401 json
imported but unused
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aws-opentelemetry-distro==0.12.1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- We need to call out to skip running Transaction search if it is already enabled on the account.
- Please scope down the agentcore_policy_document
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rule ID: CKV_DOCKER_2
Location: 01-tutorials/06-AgentCore-observability/05-Lambda-AgentCore-invocation/Dockerfile:1-41
Please clear the security finding
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
01-tutorials/06-AgentCore-observability/05-Lambda-AgentCore-invocation/lambda_agentcore_invoker.py:26:15: F541 f-string without any placeholders
4. Follow the step-by-step instructions in the notebook to: | ||
- Configure CloudWatch Transaction Search | ||
- Create and deploy the MCP agent | ||
- Build and deploy the Lambda function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To display Lambda Invoker Node in Trace view, another separate step needs to be set up to enable Active Tracing for Lambda function.
https://docs.aws.amazon.com/lambda/latest/dg/services-xray.html#services-xray-api
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NVM. Found it is configured as part of Lambda deployment.
API/User → AWS Lambda → AgentCore Runtime → Strands Agent → MCP Servers (AWS Docs + CDK) | ||
↓ ↓ | ||
CloudWatch CloudWatch | ||
(X-Ray Traces) (Gen AI Observability) | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has this setup been tested? Does AWS Lambda appear in the Trace view? It seems the Application Signals Lambda Layer need to be installed to propagate the trace context from Lambda to AgentCore and preserve trace continuity, but this step appears to be missing from the setup.
- Add comprehensive README for Lambda AgentCore invocation tutorial - Update parent README to include new Lambda invocation section - Document architecture, features, and usage examples
- Add comprehensive README for Lambda AgentCore invocation tutorial - Add Lambda function code for invoking AgentCore Runtime agents - Add MCP agent with multiple servers (AWS Docs + CDK) - Add Dockerfile for Lambda container deployment - Add Jupyter notebook with step-by-step tutorial - Update parent README to include new Lambda invocation section
- Fix f-string without placeholders in lambda_agentcore_invoker.py - Remove unused json import from mcp_agent_multi_server.py - Update aws-opentelemetry-distro to version 0.12.1 - Add HEALTHCHECK instruction to Dockerfile
12f1519
to
aab40b6
Compare
…dempotency - Remove Transaction Search enablement code; move to console-based prerequisite guide - Remove programmatic trace querying (Steps 9, 10); replace with console links - Simplify logs section to Lambda logs only with limited output - Scope down IAM policies to specific runtime ARN (remove wildcards) - Fix Lambda f-string and zip creation for Python 3.13 compatibility - Add idempotent resource creation/update for Lambda, IAM roles, and policies - Add environment variable propagation wait time before Lambda invocation - Reduce tutorial from 12 to 9 steps for better readability - Add architecture diagram Addresses feedback: - Remove complex code examples in favor of console UI - Keep tutorial simple and runnable end-to-end - Enable multiple notebook executions without errors - Fix hanging zip file creation issue
01198a7
to
1985be6
Compare
- Add Dockerfile to .gitignore (generated dynamically in notebook) - Fix F541 f-string without placeholder in lambda_agentcore_invoker.py line 25
c4c4d61
to
f7db7ce
Compare
@mvangara10 @mxiamxia Thanks for the detailed feedback! I've addressed all the comments and pushed an update. Regarding the Application Signals Lambda Layer question - I have X-Ray Active Tracing configured but didn't add the Layer. Let me know if that's needed for full Gen AI Observability integration and I'll add it. Please let me know if I missed anything or if there are any other concerns. Thanks again for the thorough review! |
Amazon Bedrock AgentCore Samples Pull Request
Important
review ready
label to it. Only PRs withreview ready
will be reviewed.Issue number: N/A
Concise description of the PR
Add Lambda AgentCore invocation tutorial with CloudWatch observability to the observability examples.
This PR adds a complete tutorial demonstrating how to invoke Strands agents hosted on Amazon Bedrock AgentCore Runtime from AWS Lambda functions with full CloudWatch observability enabled.
Changes include:
User experience
Before this change:
After this change:
Checklist
Acknowledgment
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the project license.