Skip to content

Conversation

didhd
Copy link
Contributor

@didhd didhd commented Oct 3, 2025

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: #(to be created)

Concise description of the PR

Add comprehensive marketing agent system that leverages AWS Bedrock and Strands framework to create a dynamic multi-agent workflow with task planning, execution, and specialized agents for research, SQL analysis, Python computation, and report generation. Includes persistent memory capabilities, web search integration, and professional markdown report output with visualizations.

User experience

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

Before: No marketing agent example available in the repository.

After: Users can deploy and interact with a sophisticated marketing agent system that:

  • Accepts natural language marketing requests via CLI or Streamlit UI
  • Automatically plans and executes complex research workflows using specialized agents
  • Maintains conversation memory and business context across sessions
  • Generates professional marketing reports with data visualizations
  • Supports both local development and AgentCore Runtime deployment
localhost_8501_ (6)

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.

didhd and others added 11 commits September 30, 2025 12:09
…mory capabilities

Add a comprehensive marketing agent system that leverages AWS Bedrock and Strands framework to:
- Create a dynamic task planning and execution workflow
- Implement specialized agents for research, SQL, Python analysis, and report generation
- Integrate persistent memory capabilities using mem0_memory
- Add web search functionality via Tavily API
- Support SQLite database queries for customer data analysis
- Include quality assurance through reflection agent
- Generate professional markdown reports with visualizations

The system features a rich CLI interface with progress indicators, parallel task execution,
and automatic memory management for user preferences and business context.
…ailed tasks due to type mismatch during research phase
… agent

- Add .bedrock_agentcore.yaml configuration for runtime deployment
- Add iam.py for AgentCore IAM role creation and runtime setup
- Update utils.py with enhanced AgentCore role permissions and Cognito setup

Cherry-picked from commits:
- 37c2479: Implemented AgentCore Runtime
- 00e4ea7: Type mismatch error fixes
- 1d94143: Merge branch updates
- Add comprehensive README.md with architecture overview, setup instructions, and usage examples
- Update requirements.txt with latest versions and proper dependencies
- Enhance .gitignore with comprehensive exclusions for development and runtime files
- Add .env.example template with all required configuration options
- Include AgentCore Runtime deployment instructions and memory integration details
- Reference architecture.png for visual system overview
- Converted single agent to multi-agent orchestrator following Strands 'agent as tools' philosophy
- Added workflow tool for coordinating specialized agents (planner, researcher, python, report, etc.)
- Implemented proper task dependency management and parallel execution
- Enhanced system prompt with workflow usage examples and decision framework
- Aligned implementation with README documentation for true multi-agent architecture
- Added support for complex marketing research workflows with specialist coordination
…pattern

- Created real Agent objects for each specialist (planner, researcher, python, text2sql, report, reflection)
- Implemented Strands 'agents as tools' pattern with @tool decorators
- Added proper tool integration for each agent (web tools, python_repl, file_write, etc.)
- Updated orchestrator to use agent tools instead of workflow tool
- Followed Strands documentation patterns for multi-agent coordination
- Each agent now has focused system prompts and appropriate tool access
- Enables true multi-agent collaboration with task management approach
- Fixed Generated Reports section to look in output/reports/ directory instead of output/
- Updated render_markdown_with_images function to handle various image path formats
- Added support for both ./path and output/path image references
- Improved image path resolution with better error messages
- Now properly displays generated marketing reports in the sidebar
- Images in reports should now render correctly in the preview
- Restored 01-tutorials/03-AgentCore-identity/05-Outbound_Auth_3lo/chatbot_app_cognito.py to original version
- Removed unintended changes that were included in previous commits
- This file should not have been modified as part of marketing-researcher-agent work
- Restored 02-use-cases/video-games-sales-assistant/agentcore-strands-data-analyst-assistant/app.py to original version
- Removed unintended changes that were included in previous commits
- This file should not have been modified as part of marketing-researcher-agent work
@github-actions github-actions bot added 01-tutorials 01-tutorials 02-use-cases 02-use-cases labels Oct 3, 2025
Comment on lines +206 to +208
response = requests.post(
st.session_state.agent_url, json=payload, stream=True, timeout=300
)

Check failure

Code scanning / CodeQL

Full server-side request forgery Critical

The full URL of this request depends on a
user-provided value
.
# Extract tool info
tool_tag = buffer[start_idx:end_idx]
try:
tool_content = re.search(r'<TOOL_START>(.*?)</TOOL_START>', tool_tag)

Check failure

Code scanning / CodeQL

Polynomial regular expression used on uncontrolled data High

This
regular expression
that depends on a
user-provided value
may run slow on strings starting with '<TOOL_START>' and with many repetitions of '<TOOL_START>a'.
display_text = current_text
if buffer.strip():
# Only show clean text (no incomplete tool tags)
clean_buffer = re.sub(r'<TOOL_START>.*$', '', buffer)

Check failure

Code scanning / CodeQL

Polynomial regular expression used on uncontrolled data High

This
regular expression
that depends on a
user-provided value
may run slow on strings starting with '<TOOL_START>' and with many repetitions of '<TOOL_START>'.
# Final display without cursor
final_text = current_text + buffer
# Clean up any remaining tool tags
final_text = re.sub(r'<TOOL_START>.*?</TOOL_START>', '', final_text)

Check failure

Code scanning / CodeQL

Polynomial regular expression used on uncontrolled data High

This
regular expression
that depends on a
user-provided value
may run slow on strings starting with '<TOOL_START>' and with many repetitions of '<TOOL_START>'.
text_placeholder.markdown(final_text.strip())

# Clean version for session (remove tool indicators)
clean_content = re.sub(r'🔧 \*\*.*?\*\* ✅', '', final_text)

Check failure

Code scanning / CodeQL

Polynomial regular expression used on uncontrolled data High

This
regular expression
that depends on a
user-provided value
may run slow on strings starting with '\ufffd **' and with many repetitions of '\ufffd **'.
Copy link

github-actions bot commented Oct 3, 2025

Latest scan for commit: f0da623 | Updated: 2025-10-03 19:19:48 UTC

Security Scan Results

Scan Metadata

  • Project: ASH
  • Scan executed: 2025-10-03T19:19:33+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 0 0 0 3 0 1.0s 0 PASSED MED (g)
cdk-nag 0 0 0 0 0 0 28.0s 0 PASSED MED (g)
cfn-nag 0 0 0 0 0 0 12ms 0 PASSED MED (g)
checkov 0 1 0 0 0 0 7.6s 1 FAILED MED (g)
detect-secrets 0 5 0 0 0 0 1.0s 5 FAILED MED (g)
grype 0 0 0 0 0 0 <1ms 0 ERROR MED (g)
npm-audit 0 0 0 0 0 0 162ms 0 PASSED MED (g)
opengrep 0 0 0 0 0 0 <1ms 0 SKIPPED MED (g)
semgrep 0 0 0 0 0 0 15.1s 0 PASSED MED (g)
syft 0 0 0 0 0 0 2.0s 0 PASSED MED (g)

Detailed Findings

Show 6 actionable findings

Finding 1: SECRET-SECRET-KEYWORD

  • Severity: HIGH
  • Scanner: detect-secrets
  • Rule ID: SECRET-SECRET-KEYWORD
  • Location: 02-use-cases/marketing-researcher-agent/Dockerfile:25

Description:
Secret of type 'Secret Keyword' detected in file '02-use-cases/marketing-researcher-agent/Dockerfile' at line 25

Code Snippet:

Secret of type Secret Keyword detected

Finding 2: SECRET-SECRET-KEYWORD

  • Severity: HIGH
  • Scanner: detect-secrets
  • Rule ID: SECRET-SECRET-KEYWORD
  • Location: 01-tutorials/utils.py:45

Description:
Secret of type 'Secret Keyword' detected in file '01-tutorials/utils.py' at line 45

Code Snippet:

Secret of type Secret Keyword detected

Finding 3: SECRET-SECRET-KEYWORD

  • Severity: HIGH
  • Scanner: detect-secrets
  • Rule ID: SECRET-SECRET-KEYWORD
  • Location: 01-tutorials/utils.py:38

Description:
Secret of type 'Secret Keyword' detected in file '01-tutorials/utils.py' at line 38

Code Snippet:

Secret of type Secret Keyword detected

Finding 4: SECRET-SECRET-KEYWORD

  • Severity: HIGH
  • Scanner: detect-secrets
  • Rule ID: SECRET-SECRET-KEYWORD
  • Location: 02-use-cases/marketing-researcher-agent/utils.py:41

Description:
Secret of type 'Secret Keyword' detected in file '02-use-cases/marketing-researcher-agent/utils.py' at line 41

Code Snippet:

Secret of type Secret Keyword detected

Finding 5: SECRET-SECRET-KEYWORD

  • Severity: HIGH
  • Scanner: detect-secrets
  • Rule ID: SECRET-SECRET-KEYWORD
  • Location: 02-use-cases/marketing-researcher-agent/utils.py:49

Description:
Secret of type 'Secret Keyword' detected in file '02-use-cases/marketing-researcher-agent/utils.py' at line 49

Code Snippet:

Secret of type Secret Keyword detected

Finding 6: CKV_DOCKER_2

  • Severity: HIGH
  • Scanner: checkov
  • Rule ID: CKV_DOCKER_2
  • Location: 02-use-cases/marketing-researcher-agent/Dockerfile:1-39

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

Code Snippet:

FROM public.ecr.aws/docker/library/python:3.13-slim
WORKDIR /app



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




RUN pip install aws-opentelemetry-distro>=0.10.0


# Set AWS region environment variable

ENV AWS_REGION=us-west-2
ENV AWS_DEFAULT_REGION=us-west-2


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

ENV TAVILY_API_KEY="YOUR TAVILY KEY"

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

EXPOSE 8080
EXPOSE 8000

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

# Use the full module path

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

Report generated by Automated Security Helper (ASH) at 2025-10-03T19:19:27+00:00

zhiyinglzy added a commit to NicoloAlbanese/amazon-bedrock-agentcore-samples that referenced this pull request Oct 9, 2025
… marketing system with memory capabilities and Streamlit UI awslabs#437"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

01-tutorials 01-tutorials 02-use-cases 02-use-cases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants