Skip to content

aws-solutions-library-samples/guidance-for-agentic-ai-research-platform-on-aws

AI Research Platform

A prototype developed by AWS WWSO Prototyping.

Table of Contents

  1. Overview
  2. Prerequisites
  3. Deployment Steps
  4. Deployment Validation
  5. Running the Guidance
  6. Next Steps
  7. Cleanup
  8. Notices

Overview

The AI Research Platform is an AI-powered research assistant built on AWS, featuring a Next.js frontend deployed on ECS Fargate behind CloudFront, with AI agents running on Amazon Bedrock AgentCore. Agents are powered by Claude Sonnet 4.5 and equipped with tools for code execution, knowledge base retrieval, web search, and task management. Users can create custom agents with tailored system prompts, while all conversations persist to PostgreSQL for context continuity. The infrastructure is defined in AWS CDK with a self-mutating CI/CD pipeline, Cognito authentication, and secure VPC networking.

⚠️ Regional Limitation: This solution is currently hard-coded to deploy in us-east-1 due to the staggered release of Amazon Bedrock AgentCore services across AWS regions. Support for additional regions will be added as AgentCore becomes generally available in those regions.

Cost

Base Infrastructure Monthly Costs

Category Monthly Cost
Compute (ECS Fargate) $52.45
Database (RDS PostgreSQL) $61.88
Storage & Backup $13.50
Elasticache Serverless $54.00
Load Balancer $16.43
CloudFront $8.50
Lambda Functions $2.00
Cognito $0.55
Secrets Manager $0.80
Bedrock AgentCore (Gateway + Runtime) $7.00

Total Monthly (Fixed) Costs: $217.19

Variable Costs

Component Cost Structure
AgentCore Runtime $0.10 per active hour; $0.000008 per request
AgentCore Runtime (detailed) $0.0895 per vCPU-hour; $0.00945 per GB-hour
AgentCore Gateway $5 per million tool invocations
AgentCore Memory (short-term) $0.25 per 1,000 events
AgentCore Memory (long-term) $0.75 per 1,000 records
Claude Sonnet 4.5 (input) $3 per million tokens
Claude Sonnet 4.5 (output) $15 per million tokens
Claude Haiku 4.5 (input) $1 per million tokens
Claude Haiku 4.5 (output) $5 per million tokens

Key Cost Advantage

AgentCore's serverless architecture provides significant cost efficiency. Since you only pay for actual CPU usage, long-running tasks where the agent is looping or processing will cost substantially less compared to Lambda invocations, as the charges are based on compute time rather than per-invocation billing.

Prerequisites

Operating System

  • Mac OSX (arm64)
  • Ubuntu 24.04

Deployment Steps

Step 0 – Configure docker if using Ubuntu on an amd64 architecture

sudo apt-get update
sudo apt-get install -y qemu-user-static
sudo docker run --privileged --rm tonistiigi/binfmt --install arm64

docker buildx create --name multiarch --driver docker-container --bootstrap
docker buildx use multiarch
docker buildx ls

You should see linux/arm64 listed.

Step 1 – Deploy the CloudFormation Stacks

Create switch to a new git branch called guidance:

# Change the default branch to be called "guidance"
git checkout -b guidance

Create and activate the deployment conda environment. Note: all subsequent instructions are to be performed with the ai-research-platform environment activated.

conda env create -f ./environment.yml -n ai-research-platform
conda activate ai-research-platform

Deploy the PipelineStack, which contains the CodePipeline project that manages the deployment of all the platform resources via a CI/CD pipeline.

bash ./deploy.sh

This will produce output resembling the following:

Outputs:
Pipeline.GitRemoteOriginCLICommand = git remote add s3 s3+zip://airesplatpipelinerepositorystac-repobucket████████████████████/repo
Stack ARN:
arn:aws:cloudformation:us-east-1:<AWS_ACCOUNT_ID>:stack/AiResPlatPipeline/████████-████-████-████-████████████

Add the s3 remote to the git workspace, referenced in the deployment output above.

git remote add s3 s3+zip://airesplatpipelinerepositorystac-repobucket████████████████████/repo

Trigger the CodePipeline project to deploy the platform:

git push --force s3 guidance

Visit the AWS CodePipeline Console in the browser and click on the CodePipeline Pipeline:

This should display the pipeline workflow:

After ~5-6mins, the pipeline will stop at the "ApproveDeployment" action in the "App" stage and await your manual approval:

Clicking on "ApproveDeployment" will raise the following form for your input:

If you select "Approve" and then click "Submit", the pipeline will continue and begin deploying the individual CloudFormation stacks of this solution, which should take a further ~45mins to complete.

In total, the entire solution should take between 50 to 55 minutes to deploy from scratch.

Step 2 – Add Users

2.1 – Get the Cognito User Pool ID that was deployed:

aws cloudformation list-exports --query "Exports[?Name=='CognitoUserPoolId'].Value" --output text

which should output something resembling the following:

us-east-1_█████████

2.2 – Visit the Amazon Cognito Console in the browser and click on the User Pool that matches the User Pool ID from above:

2.3 – Click "Users" then "Create User":

2.4 – Complete the "Create User" Form as you see fit, however, the following settings will send an invitation to the specified e-mail address, which will contain a temporary password to be used upon the invitee's first login:

Repeat this step for each user you wish to invite.

Deployment Validation

Get the CloudFront URL of the web interface:

aws cloudformation list-exports --query "Exports[?Name=='CloudFrontDomainNameOutput'].Value" --output text

which will output the URL resembling:

d█████████████.cloudfront.net

Visit this URL in your browser to validate the UI platform has been successfully deployed.

Running the Guidance

⚠️ Caution: You may encounter an HTTP 500 error message: "Invalid prisma.user.upsert() invocation: Can't reach database server at ..." upon your first login. If this occurs, clearing your browser cookies, restarting the browser, and then retrying the login process typically resolves the issue. We are currently addressing this issue.

Using the Base Agent

Login with your e-mail address and the temporary password received in step 2.4, you will be asked to set a new password.

You will then be brought to the landing page where you will be able to submit your first research question. Type in your first research question:

after a few seconds, you will begin receiving the results back as a token stream:

Creating and Using a Custom Agent

In this example, we'll demonstrate how to create and perform research tasks using a custom agent. A custom agent will give you access to the following tools:

  • read_files - Reads file contents from the sandbox environment
  • create_file - Creates a new file with specified content in the sandbox
  • execute_command - Executes shell commands in a Linux sandbox
  • str_replace - Performs find-and-replace edits in existing files
  • append_to_file - Appends content to the end of an existing file
  • retrieve_kb_data - Searches the Bedrock Knowledge Base using semantic vector search
  • web_search - Searches the web using DuckDuckGo
  • news_search - Searches recent news articles using DuckDuckGo News
  1. Click on the "Agents" button in the left navbar, this will take you to the custom agent configuration form. Enter a name and a description of the agent. Then select the model you'd like to use for the Agent's LLM.

  1. Click on the "Instructions" tab and then add the Agent's system prompt.

  1. Click on the "Tools" tab then–to keep things simple–select only the "Web Search" and "News Search" tools, which will allow the agent to search DuckDuckGo for related websites and news articles when answering your research question.

The newly-created custom agent will appear in the list of agents.

  1. Click on "New Task" in the left navbar then select the custom agent you just created and type in your desired research question, press Return to submit the question.

  1. The custom agent(s) will then be launched and you can track the progress of the research process. You can inspect the search and news results by clicking on the "Web Search" or "News Search" buttons when their respsective searches have completed, with the results appearing in the right hand "Agent's Computer" panel.

A Custom Agent w/ Bedrock Knowledge Base

This solution also demonstrates how a custom agent can be used to read and process the contents of a Bedrock Knowledge Base, in which you may want to store your organization's documents to make them available to the agents.

As of this writing, Bedrock Knowledge Bases support the ingestion of the following document file types:

Format Extension
Plain text (ASCII only) .txt
Markdown .md
HyperText Markup Language .html
Microsoft Word document .doc/.docx
Comma-separated values .csv
Microsoft Excel spreadsheet .xls/.xlsx
Portable Document Format .pdf

See the latest supported formats in the official AWS documentation.

In this example, we'll ingest the README.md file of this solution (the file you are currently reading) into the knowledge base and create a custom agent that can read it.

  1. First, locate the knowledge base source S3 bucket s3://ai-res-plat-kb-source-<REGION>-<ACCOUNT_ID> in the Amazon S3 Console, which was deployed as part of this solution.

  1. Click on the bucket name and then click on "Upload".

  1. You'll be presented with the option to upload individual files ("Add files") or the contents of a single folder; or, you can drag and drop the files or folder directly into the browser. Use any of these approaches to upload this README.md file to the bucket, then click the "Upload" button.

  1. Navigate to the Amazon Bedrock Knowledge Bases console and select the poc-knowledge-base-research-platform knowledge base.

  1. Select the checkbox next to the poc-data-source data source and then click "Sync". Wait until the sync process completes, a notification message indicating sync completion will a appear on the page.

  1. Now, navigate back to the AI Research Platform frontend, and follow steps 1 and 2 of Creating and Using a Custom Agent, name the agent "Knowledge Base Agent", click on the "Knowledge" tab, then toggle the "Customer S3 Bucket" option which will enable knowledge base access for the custom agent. Then, click "Save Agent".

  1. Click "New Task" in the left navbar, type in the prompt "In what order should the cloudformation stack be deleted"? This seeks to retrieve the table in the Cleanup section of this file. Then select the "Knowledge Base Agent" and press Return to submit the prompt.

  1. As the prompt gets processed, you can view the chunk(s) associated with the prompt from the knowledge base on the right hand side in "Agent's Computer" panel.

Cleanup

The deployment resources can be deleted from the CloudFormation console in the browser. The CloudFormation stacks must be deleted in a specific order due to the dependencies between their resources. Note that the AiResPlat- prefix are omitted from the stack names in the table below, for brevity.

Order Stack(s) Notes
1 AgentPlatformStack Delete first - depends on most stacks
2 AgentBaseRuntimeStack, CognitoStack Can delete in parallel
8 DataKnowledgeStore Delete after AgentBaseRuntimeStack
3 CloudFrontStack, DatabaseStack, CacheStack, ECSStack Can delete in parallel
4 ALBStack Delete after CloudFrontStack
5 VPCStack Delete last - most stacks depend on it
6 AiResPlatDeploymentPipelineRepositoryStack Only if removing entire infrastructure
7 AiResPlatPipeline Only if removing entire infrastructure
Any AgentGatewayStack Independent - delete anytime

You can (optionally) delete the two S3 buckets:

  • s3://airesplatpipeline-pipelineartifactsbucke...
  • s3://airesplatpipelinerepositorystac-repobucket...

You can also manually delete the SSM parameter store entries via the AWS Systems Manager console:

Caveats

Deletion of the AgentBaseRuntimeStack and VPCStack stacks may initially lead to a "DELETE_FAILED" state. This is presently due to the nature of how AgentCore resources are deleted behind the scenes. In which case, a second deletion attempt on these stacks using the "Retry delete" button and selecting "Force delete this entire stack" will typically resolve the issue:

If further issues persist, please contact your Account Manager for assistance.

Notices

Customers are responsible for making their own independent assessment of the information in this Guidance. This Guidance: (a) is for informational purposes only, (b) represents AWS current product offerings and practices, which are subject to change without notice, and (c) does not create any commitments or assurances from AWS and its affiliates, suppliers or licensors. AWS products or services are provided “as is” without warranties, representations, or conditions of any kind, whether express or implied. AWS responsibilities and liabilities to its customers are controlled by AWS agreements, and this Guidance is not part of, nor does it modify, any agreement between AWS and its customers.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •