On this put up, we discover the right way to construct a web based buying AI agent. We concentrate on its structure and implementation with Amazon OpenSearch Service, Amazon Bedrock AgentCore, and Strands Brokers. Amazon Bedrock AgentCore is an agentic platform for deploying and working these brokers and instruments securely at scale with out managing infrastructure. AgentCore Runtime is the safe, serverless runtime that hosts your Strands Brokers and instruments as containerized purposes. Strands Brokers is an open supply SDK for constructing AI brokers. On this SDK, an agent is outlined by a mannequin, instruments, and a immediate. Instruments are callable capabilities that enable brokers to carry out actions past textual content era, reminiscent of API calls, database queries, and file operations. The framework lets the mannequin autonomously plan steps and invoke instruments to finish duties.
Right this moment’s AI buying assistants perceive pure language, context, and buying intent, making a extra human-like interplay. These assistants deal with advanced buying necessities, reminiscent of “Discover me a proper gown underneath $200 that’s acceptable for a summer season wedding ceremony.” They preserve dialog historical past, course of follow-up questions naturally, and supply personalised suggestions primarily based on consumer preferences and previous interactions. Prospects can use visible search to add photographs of things that they need, and the AI finds comparable merchandise throughout a number of retailers, matching kinds and patterns. The purpose is to supply immediate, related, and personalised help at scale, making a extra environment friendly buying journey for customers worldwide.
AI brokers mixed with Retrieval Augmented Technology (RAG) on Amazon OpenSearch Service symbolize an evolution in conversational search. This integration builds AI brokers on enriched catalogs, supporting context-aware and autonomous search experiences whereas sustaining accuracy and relevance via grounded responses.
Resolution overview
The next diagram illustrates the answer structure of an AI-powered on-line buying agent constructed utilizing Strands Brokers, Amazon Bedrock AgentCore Runtime, and Amazon OpenSearch Service. For simplicity, the diagram doesn’t present authentication and authorization. In a manufacturing setup, safe entry to the backend through the use of mechanisms reminiscent of Amazon API Gateway, AWS Id and Entry Administration (IAM) roles, or OAuth-based authentication.
The next is a walkthrough of the reference structure:
- The consumer submits a query via the front-end utility. AgentCore Runtime receives the request and routes it to the Strands Retail Agent.
- The Strands Agent processes the duty and invokes the
search_product_cataloginstrument. - OpenSearch Service performs semantic search and returns related product outcomes.
- The Strands Agent invokes Amazon Bedrock giant language fashions (LLMs) to generate a pure language response.
- The agent response is returned to the consumer via the entrance finish.
Walkthrough
The next part walks you thru the right way to construct a web based buying AI agent.
Conditions
To implement this resolution, you want an AWS account. You additionally want an OpenSearch Service area with OpenSearch model 2.13 or later. You should use an present area or create a brand new area.
To make use of the vector search capabilities of OpenSearch Service with Strands Brokers on AgentCore, you utilize ingest pipelines. These ingestion pipelines apply built-in processors to pre-process your paperwork earlier than you index them in OpenSearch Service.
You employ the text_embedding processor, which depends on the ML Commons plugin and a registered embedding mannequin—Amazon Nova Multimodal Embeddings on Amazon Bedrock. OpenSearch Service makes use of the ML Commons plugin to generate vector embedding on your information and makes use of the identical mannequin to transform incoming queries into vectors. This helps semantic search throughout your listed content material.
You prolong your semantic search backend by including an agent constructed with Strands Brokers and deployed on Amazon Bedrock AgentCore.
Code samples supplied on this put up are examined in Python 3.11. You solely want to put in Python 3.11 in your surroundings to execute the python scripts. You additionally want Node.js 18 or later put in to make use of the AgentCore CLI. The supplied code scripts will deploy into your AWS account so be sure your terminal has entry to obligatory AWS credentials.
Set up AgentCore CLI
Set up the AgentCore CLI globally utilizing npm:
Python Dependencies
You additionally must create a necessities.txt file with following dependencies in your workspace to deploy the brokers.
Run pip set up -r necessities.txt in your terminal to put in the required dependencies. To keep away from conflicts with different dependencies in your system, you should use a digital surroundings.
Now, stroll via every step.
Step 1: Configure IAM permissions
Full the next steps to register the Nova Multimodal Embeddings mannequin with OpenSearch Service and confirm that your OpenSearch Service area has permission to invoke the Amazon Bedrock API.
- Go to the IAM console and create a brand new function with a {custom} belief coverage. Add the next belief coverage.
- Skip including a permission coverage.
- Give your function a reputation and create it. For this put up, we use OpenSearchBedrockEmbeddingRole because the function identify. OpenSearch Service makes use of this function to invoke the Nova Multimodal Embeddings mannequin on Amazon Bedrock.
- On the Permissions tab, connect an inline coverage with the next permissions. For this put up, we identify this coverage OpenSearchBedrockEmbeddingPolicy.
- Create a
passRolecoverage with the next JSON doc and assign it to the IAM function that creates the ML connector. This lets the principal working the Python code cross the OpenSearchBedrockEmbeddingRole to OpenSearch. Exchangewith your personal AWS account ID. - Through the use of fine-grained entry management (FGAC), map the IAM function as a backend function for the
ml_full_accessfunction within the OpenSearch Dashboards Safety plugin. This mapping lets the consumer create ML connectors:- Log in to OpenSearch Dashboards and open the Safety web page from the navigation menu.
- Select Roles and choose
ml_full_access. - Select Mapped Customers and Handle Mapping.
- Below Backend roles, add the ARN of the IAM function that you just created within the earlier steps.

Step 2: Hook up with the mannequin through the use of OpenSearch ML Connectors
On this part, you create an ML connector to hyperlink OpenSearch Service with the Bedrock Nova Multimodal Embeddings mannequin. You then register and deploy the mannequin so you should use it for neural search queries.
- Create a file named
create-connector.pywith the next code. Exchange,, andplaceholders inside the code.
- Run
python create-connector.pyin your terminal through the use of the IAM function withml_full_accessandpassRolepermissions created within the earlier step. This script creates a connector between OpenSearch Service and the Bedrock Nova Multimodal Embeddings mannequin. - This system responds with
connector_id. Take a be aware of it. Then, navigate to OpenSearch Dashboards and open Dev Instruments. Create a mannequin group towards which to register this mannequin within the OpenSearch Service area.
- Register a mannequin through the use of
connector_idandmodel_group_id.
- Run the next API name to deploy the mannequin. Use the registered mannequin ID from the earlier step.
Step 3: Create an ingest pipeline for information indexing
Use the next code to create an ingest pipeline for information indexing. The pipeline establishes a connection to the embedding mannequin, retrieves the embedding for the title area, and shops it within the OpenSearch index.
Step 4: Create an index for storing information
Create an index named product for storing information through the use of Dev Instruments. This index shops uncooked textual content and 1024-dimensional embeddings of the title area, and makes use of the ingest pipeline you created within the earlier step.
Step 5: Ingest pattern information
Use the next code to ingest the pattern product information in Dev Instruments.
Step 6: Question the index
Run the next API name to check semantic search through the use of the Nova Multimodal Embeddings mannequin.
The output of the previous question ought to appear to be the next.
Step 7: Create an agent with Strands and Bedrock AgentCore Runtime
Now, create the Strands Agent that makes use of Anthropic Claude Sonnet 4.6 on Amazon Bedrock to go looking merchandise from the OpenSearch Service index. To take action:
- Import the Runtime app with
from bedrock_agentcore.runtime import BedrockAgentCoreApp. - Initialize the app in your code with
app = BedrockAgentCoreApp(). - Create the OpenSearch Service connection and search question with the
@instrumentdecorator. - Enhance the invocation operate with the
@app.entrypointdecorator. - Let AgentCore Runtime management the working of the agent with
app.run().
Now, full the next steps:
- Just remember to have put in the mandatory dependencies from the Conditions part of this put up.
- Create and save a file named
search_agent.pywith the next code. Exchange,, andplaceholders inside the code.This deploys your agent domestically for testing functions.
- Navigate to the IAM console and add the AmazonBedrockLimitedAccess permission coverage to the principal working the code.
- Navigate to OpenSearch Dashboards and, from the left menu, select Safety plugin, then select Roles.
- Select Create Function.
- Identify the function agentcore-permissions.
- Below cluster permissions, add
cluster:admin/opensearch/ml/fashions/getandcluster:admin/opensearch/ml/predict. - Below index permissions, enter
product*because the index sample. Addsearchandgetpermissions. - Create the function.
- Select the function you created, swap to the Mapped Customers tab, select Handle mapping, and add the function that you just use for working the Python code as a backend function.
- Uncomment the road
strands_agent_bedrock({"immediate": "Search jacket"})and ensure theapp.run()line is commented within the code. - Run
python search_agent.pyin your terminal to begin the buying agent. The output ought to look just like the next. - Remark
strands_agent_bedrock({"immediate": "Search jacket"})and uncomment theapp.run()line within the code earlier than going into the subsequent step.
Step 8: Configure and launch your agent to Bedrock AgentCore Runtime
The AgentCore CLI is a command-line instrument supplied by AWS that simplifies deployment of brokers to Amazon Bedrock AgentCore Runtime. Whenever you run the CLI deployment command, it automates your entire deployment workflow: it creates the mandatory IAM execution function with correct permissions, packages your Python utility code together with its dependencies, makes use of AWS CodeBuild to construct an optimized Docker container picture, pushes that container picture to Amazon Elastic Container Registry (ECR), and at last provisions the AgentCore Runtime surroundings that hosts your containerized agent. This eliminates the necessity for handbook Dockerfile creation, container builds, or infrastructure administration.
- Earlier than you begin this step, be sure to have gone via part 7 and put in the AgentCore CLI and Python dependencies listed within the Conditions part.
- Create a coverage named AgentCoreAccessPolicy with the next permissions and fix it to the function working the code. Exchange
andplaceholders.
- Create a file named
agentcore.yamlin your challenge listing with the next configuration. Exchange,, andplaceholders:
- Run the next command in your terminal to deploy the agent to AgentCore Runtime:
- Create the AgentCore challenge and exchange along with your search agent.
- Add OpenSearch and different dependencies:
- Deploy the agent to Agentcore Runtime. This course of takes roughly 5-10 minutes.
- As soon as deployment completes, confirm the runtime standing:
You must see:
Step 9: Configure OpenSearch Service entry
Map your AgentCore execution function to an OpenSearch backend function so the agent can entry your information.
- Navigate to OpenSearch Dashboards. From the left menu, select the Safety plugin, then select Roles.
- Seek for agentcore-permissions and select the function. Then, navigate to the Mapped Customers tab, select Handle mapping, and add
arn:aws:iam::as a backend function. Exchange the:function/AmazonBedrockAgentCoreSDKRuntime-us-east-1-custom placeholder along with your account ID.

Step 10: Invoke the Bedrock AgentCore Runtime
You’ll be able to check the agent in Agent Sandbox. Enter the immediate Search jacket lower than 50$, and the agent returns the related outcome from the OpenSearch Service index with a abstract.

In real-world eventualities, you may design a search utility with a Strands Agent deployed in AgentCore Runtime. You’ll be able to add AgentCore Reminiscence, which provides your AI brokers the flexibility to recollect previous interactions and supply extra context-aware, personalised conversations.
Cleanup
To keep away from incurring future prices, delete the assets created whereas constructing this resolution:
Conclusion
On this put up, you noticed the right way to create a conversational search with Amazon OpenSearch Service and Strands Brokers. You additionally discovered the right way to deploy the agent on Amazon Bedrock AgentCore Runtime. You’ll be able to additional improve this buying agent through the use of different AgentCore capabilities. For instance, AgentCore Reminiscence retains consumer preferences and previous interactions throughout classes, AgentCore Id manages shopper authentication and entry management, and AgentCore Observability helps you monitor and debug agent conduct in manufacturing. Collectively, these providers aid you construct buying experiences that ship immediate, related help at scale.
Now it’s your flip. Construct your personal conversational search expertise by integrating OpenSearch Service and Strands Brokers along with your product catalog. To be taught extra, see the Amazon OpenSearch Service and Amazon Bedrock AgentCore element pages.
In regards to the authors
