Restructure obsy samples#1654
Conversation
…n-lambda sample
- Move observability-fullstack-examples/agentic-sales-analyst → agents-on-ecs/agentic-sales-analyst (git rename preserves history)
- Restructure agents-on-aws-lambda into two subfolders:
- 01-lambda-invokes-runtime/: existing Lambda→AgentCore runtime pattern
- 02-agent-in-lambda/: new pattern — Strands agent wrapped inside Lambda with ADOT observability
- New 02-agent-in-lambda sample includes:
- lambda_agent.py: Strands Agent handler
- requirements.txt: strands-agents + aws-opentelemetry-distro
- build.sh: SAM container build producing Lambda-compatible ZIP
- images/: console screenshots for X-Ray, ADOT layer, env vars, permissions
- README.md: step-by-step setup guide with console screenshots, env var table, IAM policy,
and explanation of the Lambda-suppresses-spans problem with requirements for the
Lambda-invokes-runtime pattern
- Add top-level agents-on-aws-lambda/README.md comparing both patterns
…el via pip - requirements.txt: remove aws-opentelemetry-distro; only strands-agents needed - build.sh: remove opentelemetry-instrument copy step; ZIP contains only strands-agents - lambda_agent.py: update docstring to reflect layer-based setup; clean up logging - README.md: rewrite setup steps for managed layer approach: - add ADOT layer ARN table for all major regions (account 901920570463) - AWS_LAMBDA_EXEC_WRAPPER=/opt/otel-instrument (layer path, not /var/task/) - AGENT_OBSERVABILITY_ENABLED=true for Strands Gen AI spans - Option A (manual ARN) and Option B (Application Signals console toggle) - retain console screenshots, IAM policy, test CLI invocation, trace viewing steps - retain Lambda-invokes-runtime span-suppression pattern explanation
… and evaluation pipeline - Add aws-opentelemetry-distro to requirements.txt so the bundled OTel packages are compatible with the ADOT layer's startup code (fixes ImportError: cannot import name 'LogData' from opentelemetry.sdk._logs) - Add _CWJsonSpanExporter to lambda_agent.py: writes each OTel span as a compact single-line JSON to stdout to the Lambda CloudWatch log group, enabling AgentCore batch evaluation to read Gen AI sessions without a separate /aws/spans sink - Add deploy.py, invoke.py, evaluate.py, cleanup.py scripts - evaluate.py: starts Builtin.GoalSuccessRate batch evaluation using the Lambda log group as the cloudWatchLogs data source - Gitignore lambda_config.json (runtime artifact) Tested end-to-end: 5 Lambda invocations then evaluation COMPLETED
…string without placeholders)
|
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:
Detailed FindingsShow 101 actionable findingsFinding 1: B608
Description: Code Snippet: Finding 2: CFN_NAG_W11
Description: Finding 3: CFN_NAG_W28
Description: Finding 4: CFN_NAG_W28
Description: Finding 5: CFN_NAG_W28
Description: Finding 6: CFN_NAG_W84
Description: Finding 7: CFN_NAG_W28
Description: Finding 8: CFN_NAG_W28
Description: Finding 9: CFN_NAG_W28
Description: Finding 10: CFN_NAG_W35
Description: Finding 11: CFN_NAG_W41
Description: Finding 12: CFN_NAG_W5
Description: Finding 13: CFN_NAG_W9
Description: Finding 14: CKV_AWS_18
Description: Code Snippet: Finding 15: CKV_AWS_21
Description: Code Snippet: Finding 16: CKV_AWS_103
Description: Code Snippet: Finding 17: CKV_AWS_2
Description: Code Snippet: Finding 18: AwsSolutions-VPC7
Description: Exception Reason: N/A Code Snippet: Finding 19: AwsSolutions-IAM4
Description: Exception Reason: N/A Code Snippet: Finding 20: AwsSolutions-IAM5
Description: Exception Reason: N/A Code Snippet: Finding 21: AwsSolutions-IAM5
Description: Exception Reason: N/A Code Snippet: Finding 22: AwsSolutions-S1
Description: Exception Reason: N/A Code Snippet: Finding 23: AwsSolutions-S10
Description: Exception Reason: N/A Code Snippet: Finding 24: AwsSolutions-S10
Description: Exception Reason: N/A Code Snippet: Finding 25: AwsSolutions-EC23
Description: Exception Reason: N/A Code Snippet: Finding 26: AwsSolutions-ECS2
Description: Exception Reason: N/A Code Snippet: Finding 27: GHSA-mw96-cpmx-2vgc-rollup
Description: Finding 28: GHSA-rp65-9cf3-cjxr-nth-check
Description: Finding 29: GHSA-3w6x-2g7m-8v23-axios
Description: Finding 30: GHSA-w9j2-pvgh-6h63-axios
Description: Finding 31: GHSA-87r5-mp6g-5w5j-jsonpath
Description: Finding 32: GHSA-7fh5-64p2-3v2j-postcss
Description: Finding 33: GHSA-q8qp-cvcw-x6jj-axios
Description: Finding 34: GHSA-xpqw-6gx7-v673-svgo
Description: Finding 35: GHSA-5m6q-g25r-mvwx-node-forge
Description: Finding 36: GHSA-w7jw-789q-3m8p-shell-quote
Description: Finding 37: GHSA-rf6f-7fwh-wjgh-flatted
Description: Finding 38: GHSA-4v9v-hfq4-rm2v-webpack-dev-server
Description: Finding 39: GHSA-6c59-mwgh-r2x6-jsonpath |
|
Bharathi, does this also include renaming "observability" to "3P-observability" and deleting "simple-dual-obsy"? |
|
TY Bharathi. Commits merged. |
Amazon Bedrock AgentCore Samples Pull Request
Important
review readylabel to it. Only PRs withreview readywill be reviewed.Issue number:
Add agents-on-ecs and agent-in-lambda samples under agents-hosted-outside-runtime
Restructures 03-integrations/agents-hosted-outside-runtime to add two new patterns:
Moves observability-fullstack-examples/agentic-sales-analyst → agents-on-ecs/agentic-sales-analyst,
giving the ECS-hosted multi-agent sample a proper home under agents-hosted-outside-runtime.
Adds agents-on-aws-lambda/02-agent-in-lambda: a new sample showing how to host a Strands agent
directly inside AWS Lambda with full Gen AI observability via the ADOT managed Lambda layer.
Existing lambda-invokes-runtime content is moved into 01-lambda-invokes-runtime/ and given its
own README explaining the span-suppression pattern.
The 02-agent-in-lambda sample fixes a version-conflict bug (strands-agents bundles its own
opentelemetry packages that shadow the ADOT layer's copies) by adding aws-opentelemetry-distro
to requirements.txt. It also adds _CWJsonSpanExporter to lambda_agent.py, which writes each OTel
span as a compact single-line JSON to the Lambda CloudWatch log group so that AgentCore batch
evaluation can read Gen AI sessions without requiring a separate /aws/spans sink.
User experience
▎ Before: agents-hosted-outside-runtime only showed the "Lambda invokes a runtime" pattern. There was no sample for running an agent directly inside Lambda, and the ECS-based
agentic-sales-analyst lived under the unrelated observability-fullstack-examples folder.
▎ After:
▎ - agents-on-ecs/agentic-sales-analyst — the full-stack ECS multi-agent sample is discoverable under the right parent folder.
▎ - agents-on-aws-lambda/01-lambda-invokes-runtime/ — the existing pattern (Lambda triggers a hosted runtime agent) is preserved with an updated README explaining the span-suppression problem
and the ADOT fix for it.
▎ - agents-on-aws-lambda/02-agent-in-lambda/ — new end-to-end sample: deploy.py creates the Lambda with the ADOT layer attached, invoke.py generates 5 sessions, evaluate.py runs a
Builtin.GoalSuccessRate batch evaluation job against the Lambda CloudWatch log group, and cleanup.py tears everything down. Console screenshots walk through enabling Application Signals,
attaching the ADOT layer, and setting the required environment variables.
Checklist
If your change doesn't seem to apply, please leave them unchecked.
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.