https://github.com/awslabs/amazon-bedrock-agent-samples

Example Jupyter notebooks 📓 and code scripts 💻 for using Amazon Bedrock Agents 🤖 and its functionalities

https://github.com/awslabs/amazon-bedrock-agent-samples

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • â—‹
    CITATION.cff file
  • ✓
    codemeta.json file
    Found codemeta.json file
  • ✓
    .zenodo.json file
    Found .zenodo.json file
  • â—‹
    DOI references
  • â—‹
    Academic publication links
  • â—‹
    Academic email domains
  • â—‹
    Institutional organization owner
  • â—‹
    JOSS paper metadata
  • â—‹
    Scientific vocabulary similarity
    Low similarity (9.8%) to scientific vocabulary

Keywords

amazon-bedrock amazon-bedrock-agents bedrock bedrock-agents generative-ai multi-agents-collaboration
Last synced: 9 months ago · JSON representation

Repository

Example Jupyter notebooks 📓 and code scripts 💻 for using Amazon Bedrock Agents 🤖 and its functionalities

Basic Info
Statistics
  • Stars: 716
  • Watchers: 23
  • Forks: 237
  • Open Issues: 35
  • Releases: 0
Topics
amazon-bedrock amazon-bedrock-agents bedrock bedrock-agents generative-ai multi-agents-collaboration
Created over 1 year ago · Last pushed 10 months ago
Metadata Files
Readme Contributing License Code of conduct Notice

README.md

Front-End Implementation - Integrating Amazon Bedrock Agent with a Ready-to-Use Data Analyst Assistant Application

This tutorial guides you through setting up a React Web application that integrates with your Amazon Bedrock Agent, creating a Data Analyst Assistant for Video Game Sales.

Overview

By the end of this tutorial, you'll have a fully functional Generative AI web application that allows users to interact with a Data Analyst Assistant interface.

The application consists of:

  • React Web Application: Delivers the user interface for the assistant
    • The application invokes the Amazon Bedrock Agent for interacting with the assistant
    • For chart generation, the application directly invokes the Claude 3.5 Sonnet model

[!IMPORTANT] This sample application is for demonstration purposes only and is not production-ready. Please validate the code against your organization's security best practices.

Prerequisites

Before you begin, ensure you have:

  • An Alias created for your Amazon Bedrock Agent from the Generative AI Application - Data Source and Amazon Bedrock Agent Deployment tutorial
  • Node.js version 18+
  • React Scripts installed: bash npm install react-scripts

Set Up the Front-End Application

Navigate to the React application folder (amplify-video-games-sales-assistant-bedrock-agent/) and install the Reac application dependencies:

bash npm install

Configure IAM User Access for Front-End Permissions

Update the values with your , , and that you can find in the outputs from the SAM tutorial.

json { "Version": "2012-10-17", "Statement": [ { "Sid": "InvokeBedrockAgent", "Effect": "Allow", "Action": [ "bedrock:InvokeAgent" ], "Resource": [ "<agent_arn>", "arn:aws:bedrock:*:<account_id>:agent-alias/<agent_id>/*" ] }, { "Sid": "InvokeBedrockModel", "Effect": "Allow", "Action": [ "bedrock:InvokeModel" ], "Resource": [ "arn:aws:bedrock:*:<account_id>:inference-profile/us.anthropic.claude-3-5-sonnet-20241022-v2:0", "arn:aws:bedrock:us-east-2::foundation-model/anthropic.claude-3-5-sonnet-20241022-v2:0", "arn:aws:bedrock:us-east-1::foundation-model/anthropic.claude-3-5-sonnet-20241022-v2:0", "arn:aws:bedrock:us-west-2::foundation-model/anthropic.claude-3-5-sonnet-20241022-v2:0" ] }, { "Sid": "DynamoDB", "Effect": "Allow", "Action": [ "dynamodb:Query" ], "Resource": "<question_answers_table_arn>" } ] }

Configure Environment Variables

  • Rename the file src/sample.env.js to src/env.js and update the following environment variables:

    • AWS Credentials and Region:
      • ACCESSKEYID
      • SECRETACCESSKEY
      • AWS_REGION
    • Agent and table information that you can find in the CloudFormation Outputs from the SAM project:
      • AGENT_ID
      • AGENTALIASID
      • QUESTIONANSWERSTABLE_NAME
    • Also, you can update the general application description:
      • APP_NAME
      • APP_SUBJECT
      • WELCOME_MESSAGE

Test Your Data Analyst Assistant

Start the application locally:

bash npm start

Try these sample questions to test the assistant:

  • Hello!
  • How can you help me?
  • What is the structure of the data?
  • Which developers tend to get the best reviews?
  • What were the total sales for each region between 2000 and 2010? Give me the data in percentages.
  • What were the best-selling games in the last 10 years?
  • What are the best-selling video game genres?
  • Give me the top 3 game publishers.
  • Give me the top 3 video games with the best reviews and the best sales.
  • Which is the year with the highest number of games released?
  • Which are the most popular consoles and why?
  • Give me a short summary and conclusion of our conversation.

[!TIP] 🚀 For production deployment, consider using AWS Amplify Hosting and integrate Amazon Cognito or another identity provider for proper authentication and authorization instead of using IAM user credentials.

Application Features

Congratulations! Your Data Analyst Assistant can provide you with the following conversational experience:

Video Games Sales Assistant

  • Conversational interface with an agent responding to user questions

Video Games Sales Assistant

  • Detailed answers including the rationale behind SQL query generation

Video Games Sales Assistant

  • Raw query results displayed in tabular format

Video Games Sales Assistant

  • Chart visualization generated from the agent's answer and the data query results (created using Apexcharts).

Video Games Sales Assistant

  • Summary and conclusion derived from the data analysis conversation

Video Games Sales Assistant

Thank You

License

This project is licensed under the Apache-2.0 License.

Owner

  • Name: Amazon Web Services - Labs
  • Login: awslabs
  • Kind: organization
  • Location: Seattle, WA

AWS Labs

Issues and Pull Requests

Last synced: 9 months ago

All Time
  • Total issues: 22
  • Total pull requests: 117
  • Average time to close issues: 16 days
  • Average time to close pull requests: 6 days
  • Total issue authors: 19
  • Total pull request authors: 46
  • Average comments per issue: 0.23
  • Average comments per pull request: 0.39
  • Merged pull requests: 61
  • Bot issues: 1
  • Bot pull requests: 10
Past Year
  • Issues: 22
  • Pull requests: 117
  • Average time to close issues: 16 days
  • Average time to close pull requests: 6 days
  • Issue authors: 19
  • Pull request authors: 46
  • Average comments per issue: 0.23
  • Average comments per pull request: 0.39
  • Merged pull requests: 61
  • Bot issues: 1
  • Bot pull requests: 10
Top Authors
Issue Authors
  • EashanKaushik (3)
  • rostcheck (2)
  • vikramelango (1)
  • robbieowens15 (1)
  • tloth-phx (1)
  • bignellrp (1)
  • amotl (1)
  • xiehust (1)
  • jayasimhag1reddy (1)
  • wesmorishita (1)
  • manbearshark (1)
  • MartinR-L (1)
  • gmansilla (1)
  • LucaiB (1)
  • hasanp87 (1)
Pull Request Authors
  • aurbac (16)
  • EashanKaushik (11)
  • omrsamer (10)
  • dependabot[bot] (9)
  • aidan-ricci (6)
  • isingh09 (4)
  • LucaiB (4)
  • rchandra20 (3)
  • mttanke (3)
  • johanneslanger (3)
  • rostcheck (3)
  • niklas-palm (2)
  • aarora79 (2)
  • eercanayar (2)
  • tsanti (2)
Top Labels
Issue Labels
bug (15)
Pull Request Labels
dependencies (9) javascript (5) python (3) bug (1)

Dependencies

examples/amazon-bedrock-agents/inline_agent/requirements.txt pypi
  • awscli *
  • boto3 *
  • botocore *
  • opensearch-py *
  • retrying *
examples/amazon-bedrock-agents/online_banking_agent/requirements.txt pypi
  • awscli *
  • boto3 *
  • botocore *
  • opensearch-py *
  • retrying *
examples/amazon-bedrock-agents/restaurant_booking_cdk_agent/lambda/collections/requirements.txt pypi
  • opensearch-py *
  • requests-aws4auth *
examples/amazon-bedrock-agents/restaurant_booking_cdk_agent/requirements.txt pypi
  • aws-cdk-lib ==2.147.0
  • boto3 *
examples/amazon-bedrock-agents/restaurant_booking_custom_orchestration_agent/requirements.txt pypi
  • awscli *
  • boto3 *
  • botocore *
  • opensearch-py *
  • retrying *
examples/amazon-bedrock-agents/restaurant_booking_mistral_agent/requirements.txt pypi
  • awscli *
  • boto3 *
  • botocore *
  • opensearch-py *
  • retrying *
examples/amazon-bedrock-agents/solar_panel_agent/requirements.txt pypi
  • awscli *
  • boto3 *
  • botocore *
  • opensearch-py *
  • retrying *
examples/amazon-bedrock-multi-agent-collaboration/devops_agent/01_Create_Grafana_Assistant_Agent/lambda_requirements.txt pypi
  • numpy * development
  • pandas * development
  • requests * development
examples/amazon-bedrock-multi-agent-collaboration/devops_agent/01_Create_Grafana_Assistant_Agent/requirements.txt pypi
  • boto3 * development
  • botocore * development
  • dash-core-components ==2.0.0 development
  • dash-html-components ==2.0.0 development
  • dash-table ==5.0.0 development
  • opensearch-py * development
  • retrying * development
examples/amazon-bedrock-multi-agent-collaboration/devops_agent/02_Create_GitHub_Assistant_Agent/lambda_requirements.txt pypi
  • requests * development
examples/amazon-bedrock-multi-agent-collaboration/devops_agent/02_Create_GitHub_Assistant_Agent/requirements.txt pypi
  • boto3 * development
  • botocore * development
  • dash-core-components ==2.0.0 development
  • dash-html-components ==2.0.0 development
  • dash-table ==5.0.0 development
  • opensearch-py * development
  • retrying * development
examples/amazon-bedrock-multi-agent-collaboration/devops_agent/03_Create_Supervisor_Devops_Agent/requirements.txt pypi
  • boto3 * development
  • botocore * development
  • opensearch-py * development
  • retrying * development
examples/amazon-bedrock-multi-agent-collaboration/devops_agent/requirements.txt pypi
  • boto3 * development
  • botocore * development
  • opensearch-py * development
  • retrying * development
examples/amazon-bedrock-multi-agent-collaboration/energy_efficiency_management_agent/1-energy-forecast/requirements.txt pypi
  • awscli *
  • boto3 *
  • botocore *
  • opensearch-py *
  • retrying *
  • rich *
  • termcolor *
examples/amazon-bedrock-multi-agent-collaboration/energy_efficiency_management_agent/4-energy-agent-collaborator/requirements.txt pypi
  • awscli *
  • boto3 *
  • botocore *
  • opensearch-py *
  • retrying *
  • rich *
  • termcolor *
examples/amazon-bedrock-multi-agent-collaboration/energy_efficiency_management_agent/5-clean-up/requirements.txt pypi
  • awscli *
  • boto3 *
  • botocore *
  • opensearch-py *
  • retrying *
  • rich *
  • termcolor *
examples/amazon-bedrock-multi-agent-collaboration/energy_efficiency_management_agent/requirements.txt pypi
  • awscli *
  • boto3 *
  • botocore *
  • opensearch-py *
  • retrying *
  • rich *
  • termcolor *
src/requirements.txt pypi
  • black ==24.10.0
  • boto3 *
  • botocore *
  • ipython ==8.29.0
  • matplotlib ==3.9.2
  • opensearch-py ==2.7.1
  • pydantic ==2.10.2
  • rich ==13.9.4
  • termcolor ==2.5.0