Skip to content

Latest commit

 

History

History
168 lines (89 loc) · 8.32 KB

DEPLOYMENT.md

File metadata and controls

168 lines (89 loc) · 8.32 KB

Solution Deployment

The following instructions show how to deploy Agents4Energy (A4E) in your AWS account for experimentation and testing. This process takes approximately an hour, and requires an AWS account with administrative access. All of the sample agents, configuration, AWS resources, and sample data used in the public demonstration site are provided. Please be aware that deployment into your AWS account will create industry sample resources that incur AWS costs even if they are not used.

Once work with this project is complete, it is recommended to delete the CloudFormation stack if you no longer need Agents4Energy to prevent ongoing cloud costs which are approximately $500/month with the sample agents and supporting resources (as of March 2025).

  1. Fork the Agents4Energy GitHub repository to create a working version of the code

  2. Login to your AWS account navigate to Model Access in Amazon Bedrock

Model Access

  1. Enable the desired foundation models for use with your agentic workflows (select all)

Enable Models

  1. Access should be granted immediately

Access Granted

  1. Test the models in the Chat/Text playground of your desired region to make sure LLMs are working

Chat Playground

  1. Navigate to AWS Amplify and click Deploy an app

Amplify Landing Page

  1. The Amplify Gen2 app will be linked to the GitHub url of the fork created in Step 1

Amplify Landing Page

  1. This example shows the main branch which can also be deployed if you don't plan to make any changes - keep in mind this will automatically be updated with future changes in A4E main branch repository

Amplify Landing Page

  1. Amplify provides configuration of your build and service role policies

Amplify Landing Page

  1. Make sure to update the Advanced Settings to use Custom Build Image aws/codebuild/amazonlinux2-x86_64-standard:5.0 and add a Key for _BUILD_TIMEOUT of 120 minutes

Amplify Landing Page

  1. Click "Save and deploy" to start the deployment.

THIS STEP WILL BEGIN TO CREATE AGENTS4ENERGY AWS RESOURCES AND INCUR COSTS IN YOUR AWS ACCOUNT!

Amplify Landing Page

  1. Amplify will bootstrap CDK in your account

Amplify Landing Page

  1. After the environment is bootstrapped, agents4energy will start deploying automatically

Amplify Landing Page

  1. Be patient – the initial deployment will take around 45minutes, but you can keep an eye on the logs in Amplify

Amplify Landing Page

  1. In CloudFormation, you can track the progress of the stack deployments with more detail

Amplify Landing Page

  1. After the build and deployment steps are complete, Amplify should look something like this. The Domain link provides the URL to access the demo application in your AWS account.

Amplify Landing Page

  1. You can click on the "Domain" URL link to launch the application

Amplify Landing Page

  1. Click Start a Chat which will direct you to create a user account since you won't already be logged in. Make sure to switch the login dialog to "Create Account" and enter your email and desired password 2x

Amplify Landing Page

  1. You'll get an email with a 6 digit code that you enter into the Confirmation Code box to validate your email

Amplify Landing Page

  1. Now when you Start a Chat you'll be brought to the main A4E chat workspace

Amplify Landing Page

  1. Pick the Production Agent using the ellipsis to the right of Chat Agents

Amplify Landing Page

  1. You can start interacting with the Agent, but the example prompts may be helpful since you don't know what data is in the samples!
Search the well files for the well with API number 30-045-29202 to make a table with type of operation (drilling, completion, workover, plugging, other), text from the report describing operational details, and document title. Also execute a sql query to get the total monthly oil, gas and water production from this well. Create a plot with both the event data and the production data.

Amplify Landing Page

  1. Make sure the doc links to pdf source documents work

Amplify Landing Page

  1. Example pdf docs (from New Mexico Oil Conservation Division) should pull un in another web browser tab

Amplify Landing Page

  1. Test out the multi-series chart popups works (with links to documents) by clicking on the event series in the chart

Amplify Landing Page

  1. Switch the app to dark mode and try out the Maintenance Agent – it should find 2 biodiesel tanks located in the biodiesel unit of the refinery defined in the CMMS database

Amplify Landing Page

  1. Notice that the example prompts change as the Agent considers the context of the conversation

Amplify Landing Page

  1. When were the tanks in the biodiesel unit last inspected or serviced?

Amplify Landing Page

  1. Make up your own maintenance optimization questions – push the limits to see what Anthropic Claude Sonnet 3 can do when it has access to your CMMS database!
I am concerned that our inspections took longer than expected in 2024.  Time is money in the refinery business since every day I have the biodiesel unit at reduced capacity it costs me $15,000.  If I want to make sure the inspections complete on time so we don't have to take the unit offline longer than planned, which technician should I have do the work based on the inspections last year?

Amplify Landing Page

Review Deployed AWS Resources

If you want to begin exploring the unstructured document data included in the samples, go to S3 and search for a bucket with "file" in the bucket name. all of the pdfs, word docs, and other files that are embedded into the vectorized database are sourced from this S3 bucket.

Amplify Landing Page

You can view the sample refinery shift handover reports and other documents in S3

Amplify Landing Page

Relational Database Service (RDS) resources are secured through AWS Secrets Manager

Amplify Landing Page

Click on the blue boxes to the left of the Secret ARN to copy it to your clipboard

Amplify Landing Page

Once the RDS databases are deployed, you can use the Amazon RDS Query Editor to browse the CMMS data and validate Agent responses.

Amplify Landing Page

You can use this secret to access the Query Editor to see the data in maintdb PostgreSQL database

Amplify Landing Page

The tables in the public schema contains oil & gas sample data that is accessible to Agents4Energy Maintenance Agent

Amplify Landing Page

Work order samples are provided in the table called maintenance

Amplify Landing Page

Troubleshooting

Amplify Landing Page

If you don't see any rows in the maintenance table, or the table doesn't exist, try running the Lambda function with "PrepDbFunction" in the name. This will reset the data to the default set of deployment data, so you can run it at any time, but it will back out any changes you have made with the Maintenance Agent (INSERT, UPDATE, or DELETE)

Amplify Landing Page

Finally, verify that all Amazon Bedrock Knowledge Base Data Sources are synchronized. That is the final verification step. Your Agents4Energy environment is ready to use!