Skip to content

Conversation

@dianaalse
Copy link

Added Agentcore observability to AgentCore runtime Langgraph agent

Amazon Bedrock AgentCore Samples Pull Request

Important

  1. We strictly follow a issue-first approach, please first open an issue relating to this Pull Request.
  2. Once this Pull Request is ready for review please attach review ready label to it. Only PRs with review ready will be reviewed.

Issue number:

Concise description of the PR

Changes to ..., because ...

User experience

Please share what the user experience looks like before and after this change

Checklist

If your change doesn't seem to apply, please leave them unchecked.

  • I have reviewed the contributing guidelines
  • Add your name to CONTRIBUTORS.md
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Are you uploading a dataset?
  • Have you documented Introduction, Architecture Diagram, Prerequisites, Usage, Sample Prompts, and Clean Up steps in your example README?
  • I agree to resolve any issues created for this example in the future.
  • I have performed a self-review of this change
  • Changes have been tested
  • Changes are documented

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.

Added Agentcore observability to AgentCore runtime Langgraph agent

Signed-off-by: dianaalse <[email protected]>
@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@github-actions github-actions bot added 01-tutorials 01-tutorials 06-AgentCore-observability 01-tutorials/06-AgentCore-observability labels Oct 17, 2025
@github-actions
Copy link

github-actions bot commented Oct 17, 2025

Latest scan for commit: 06f22e3 | Updated: 2025-10-31 15:39:26 UTC

Security Scan Results

Scan Metadata

  • Project: ASH
  • Scan executed: 2025-10-31T15:39:07+00:00
  • ASH version: 3.0.0

Summary

Scanner Results

The table below shows findings by scanner, with status based on severity thresholds and dependencies:

Column Explanations:

Severity Levels (S/C/H/M/L/I):

  • Suppressed (S): Security findings that have been explicitly suppressed/ignored and don't affect the scanner's pass/fail status
  • Critical (C): The most severe security vulnerabilities requiring immediate remediation (e.g., SQL injection, remote code execution)
  • High (H): Serious security vulnerabilities that should be addressed promptly (e.g., authentication bypasses, privilege escalation)
  • Medium (M): Moderate security risks that should be addressed in normal development cycles (e.g., weak encryption, input validation issues)
  • Low (L): Minor security concerns with limited impact (e.g., information disclosure, weak recommendations)
  • Info (I): Informational findings for awareness with minimal security risk (e.g., code quality suggestions, best practice recommendations)

Other Columns:

  • Time: Duration taken by each scanner to complete its analysis
  • Action: Total number of actionable findings at or above the configured severity threshold that require attention

Scanner Results:

  • PASSED: Scanner found no security issues at or above the configured severity threshold - code is clean for this scanner
  • FAILED: Scanner found security vulnerabilities at or above the threshold that require attention and remediation
  • MISSING: Scanner could not run because required dependencies/tools are not installed or available
  • SKIPPED: Scanner was intentionally disabled or excluded from this scan
  • ERROR: Scanner encountered an execution error and could not complete successfully

Severity Thresholds (Thresh Column):

  • CRITICAL: Only Critical severity findings cause scanner to fail
  • HIGH: High and Critical severity findings cause scanner to fail
  • MEDIUM (MED): Medium, High, and Critical severity findings cause scanner to fail
  • LOW: Low, Medium, High, and Critical severity findings cause scanner to fail
  • ALL: Any finding of any severity level causes scanner to fail

Threshold Source: Values in parentheses indicate where the threshold is configured:

  • (g) = global: Set in the global_settings section of ASH configuration
  • (c) = config: Set in the individual scanner configuration section
  • (s) = scanner: Default threshold built into the scanner itself

Statistics calculation:

  • All statistics are calculated from the final aggregated SARIF report
  • Suppressed findings are counted separately and do not contribute to actionable findings
  • Scanner status is determined by comparing actionable findings to the threshold
Scanner S C H M L I Time Action Result Thresh
bandit 0 2 0 0 0 0 784ms 2 FAILED MED (g)
cdk-nag 0 0 0 0 0 0 29.1s 0 PASSED MED (g)
cfn-nag 0 0 0 0 0 0 17ms 0 PASSED MED (g)
checkov 0 1 0 0 0 0 4.8s 1 FAILED MED (g)
detect-secrets 0 0 0 0 0 0 743ms 0 PASSED MED (g)
grype 0 0 0 0 0 0 30.6s 0 PASSED MED (g)
npm-audit 0 0 0 0 0 0 176ms 0 PASSED MED (g)
opengrep 0 0 0 0 0 0 <1ms 0 SKIPPED MED (g)
semgrep 0 2 0 0 0 0 14.8s 2 FAILED MED (g)
syft 0 0 0 0 0 0 1.9s 0 PASSED MED (g)

Detailed Findings

Show 5 actionable findings

Finding 1: B307

  • Severity: HIGH
  • Scanner: bandit
  • Rule ID: B307
  • Location: 01-tutorials/06-AgentCore-observability/01-Agentcore-runtime-hosted/Langgraph/langgraph_agent.py:41-43

Description:
Use of possibly insecure function - consider using safer ast.literal_eval.

Code Snippet:

# Evaluate the expression safely
        result = eval(expression, safe_dict)
        return str(result)

Finding 2: B307

  • Severity: HIGH
  • Scanner: bandit
  • Rule ID: B307
  • Location: 01-tutorials/06-AgentCore-observability/01-Agentcore-runtime-hosted/Langgraph/langgraph_bedrock.py:43-45

Description:
Use of possibly insecure function - consider using safer ast.literal_eval.

Code Snippet:

# Evaluate the expression safely
        result = eval(expression, safe_dict)
        return str(result)

Finding 3: CKV_DOCKER_2

  • Severity: HIGH
  • Scanner: checkov
  • Rule ID: CKV_DOCKER_2
  • Location: 01-tutorials/06-AgentCore-observability/01-Agentcore-runtime-hosted/Langgraph/Dockerfile:1-41

Description:
Ensure that HEALTHCHECK instructions have been added to container images

Code Snippet:

FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim
WORKDIR /app

# All environment variables in one layer
ENV UV_SYSTEM_PYTHON=1 \
    UV_COMPILE_BYTECODE=1 \
    UV_NO_PROGRESS=1 \
    PYTHONUNBUFFERED=1 \
    DOCKER_CONTAINER=1 \
    AWS_REGION=us-east-1 \
    AWS_DEFAULT_REGION=us-east-1



COPY requirements.txt requirements.txt
# Install from requirements file
RUN uv pip install -r requirements.txt




RUN uv pip install aws-opentelemetry-distro>=0.10.1


# Signal that this is running in Docker for host binding logic
ENV DOCKER_CONTAINER=1

# Create non-root user
RUN useradd -m -u 1000 bedrock_agentcore
USER bedrock_agentcore

EXPOSE 9000
EXPOSE 8000
EXPOSE 8080

# Copy entire project (respecting .dockerignore)
COPY . .

# Use the full module path

CMD ["opentelemetry-instrument", "python", "-m", "langgraph_agent"]

Finding 4: python.lang.security.audit.eval-detected.eval-detected

  • Severity: HIGH
  • Scanner: semgrep
  • Rule ID: python.lang.security.audit.eval-detected.eval-detected
  • Location: 01-tutorials/06-AgentCore-observability/01-Agentcore-runtime-hosted/Langgraph/langgraph_agent.py:42

Description:
Detected the use of eval(). eval() can be dangerous if used to evaluate dynamic content. If this content can be input from outside the program, this may be a code injection vulnerability. Ensure evaluated content is not definable by external sources.

Code Snippet:

result = eval(expression, safe_dict)

Finding 5: python.lang.security.audit.eval-detected.eval-detected

  • Severity: HIGH
  • Scanner: semgrep
  • Rule ID: python.lang.security.audit.eval-detected.eval-detected
  • Location: 01-tutorials/06-AgentCore-observability/01-Agentcore-runtime-hosted/Langgraph/langgraph_bedrock.py:44

Description:
Detected the use of eval(). eval() can be dangerous if used to evaluate dynamic content. If this content can be input from outside the program, this may be a code injection vulnerability. Ensure evaluated content is not definable by external sources.

Code Snippet:

result = eval(expression, safe_dict)

Report generated by Automated Security Helper (ASH) at 2025-10-31T15:39:01+00:00

@mvangara10
Copy link
Contributor

Sent detailed review to contributor for clean up of the PR.

dianaalse and others added 9 commits October 21, 2025 01:05
Signed-off-by: dianaalse <[email protected]>
Signed-off-by: dianaalse <[email protected]>
…osted/Langgraph/images/observability_with_langgraph_and_bedrock_models.ipynb

Signed-off-by: dianaalse <[email protected]>
…osted/Langgraph/observability_with_langgraph_and_bedrock_models.ipynb

Signed-off-by: dianaalse <[email protected]>
Signed-off-by: dianaalse <[email protected]>
…osted/Langgraph/observability_with_langgraph_and_bedrock_models.ipynb

Signed-off-by: dianaalse <[email protected]>
Signed-off-by: dianaalse <[email protected]>
Signed-off-by: dianaalse <[email protected]>
@github-actions github-actions bot added the 01-AgentCore-runtime 01-tutorials/01-AgentCore-runtime label Oct 30, 2025
@dianaalse
Copy link
Author

addressed the comments but one in the latest, need feedback one last requirement

@dianaalse
Copy link
Author

added OTEL as well

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

Labels

01-AgentCore-runtime 01-tutorials/01-AgentCore-runtime 01-tutorials 01-tutorials 06-AgentCore-observability 01-tutorials/06-AgentCore-observability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants