Voiced by Amazon Polly |
Introduction
Personalization is at the heart of delivering standout user experiences, whether helping someone discover a great new restaurant or suggesting an ideal weekend activity. While preferences matter, factors like location and weather significantly influence what people are in the mood for. A sunny day might call for a picnic in the park, whereas rainy weather might steer someone toward a warm café. To build an intelligent agent that adapts to these dynamic contexts, we can leverage the capabilities of Amazon Bedrock Agents alongside Foursquare rich location data. So, we will explore how to develop a location-aware AI agent that delivers highly tailored recommendations by seamlessly blending user preferences, local insights, and real-time conditions.
Pioneers in Cloud Consulting & Migration Services
- Reduced infrastructural costs
- Accelerated application deployment
Amazon Bedrock Agents
Building and scaling generative AI applications is made simple with Amazon Bedrock. A single API offers access to top-performing foundation models (FMs) from top AI firms, including AI21 Labs, Anthropic, Cohere, Luma, Meta, Mistral AI, Stability AI, and Amazon. You do not need to maintain infrastructure because it is serverless and connects with well-known AWS services for security, privacy, and responsible AI. You may experiment with models, adapt them to your data, and develop apps without writing sophisticated code.
An Amazon Bedrock feature called Amazon Bedrock bots lets you build AI bots that work independently. By connecting to the APIs and data sources of your business, these agents can comprehend user requests, deconstruct them into stages, and finish tasks. For instance, they may automate inventory management and insurance claim processing, which makes them effective for corporate operations. Rapidly put them up without worrying about infrastructure management since they automatically take care of prompt engineering, memory, and security.
Foursquare Places APIs
Applications needing contextual awareness can benefit from the exact location knowledge provided by Foursquare Places APIs. The Places APIs convert geographic coordinates into useful business context and are built on top of the open-source global Places dataset, which contains 100 million sites of interest in 1,500 categories.
Applications may quickly ascertain if a user is in Central Park, a Macy’s department store, or a neighbourhood coffee shop thanks to the GeoTagging API, which precisely correlates GPS coordinates to a specific location. The Place Search & Data APIs offer sophisticated filtering features beyond basic proximity searches, revolutionizing how apps find locations. For genuinely contextual results, developers can apply attribute-based constraints (like price range or special amenities), filter locations by specific categories (like restaurants, parks, or tourist attractions), take temporal factors (like current operating status), and strike a balance between distance and relevance. Contextual features such as images, reviews, quality ratings, and up-to-date popularity statistics are added to each returned location.
Foursquare Places APIs, combined with Amazon Bedrock Agents, allow developers to build apps that comprehend the whole context of a user location, producing timely, relevant, and customized experiences.
Solution overview
Developed a straightforward architecture that generates an Amazon Bedrock agent using the Foursquare Places APIs and a Weather API to illustrate the potential of integrating location with Amazon Bedrock Agents. Combining these features allows us to design distinctive user experiences that are tailored to the user location.
Through a Streamlit web interface, the user communicates with the agent in the solution workflow. The web application uses the application logic that calls the cloud-based Amazon Bedrock agent. Even though the location and weather tools are hosted locally within the application, the agent is aware of them. The application logic receives a return of control response when the agent invokes the tools. This logic runs the tool and returns the tool answer in a subsequent agent invocation. Along with the tools, the agent is given basic guidelines on the behaviors and personality types it should encourage.
Let’s look at an example of a quick conversation with the agent in which we inquire about the existence of a park in the area and a suggested restaurant for takeout.
The initial encounter with an agent is depicted in the following screenshot, where the agent uses the Foursquare APIs to find a local park.
This example shows how the agent notifies the user of the activities occurring (thinking, triggering a tool, triggering the model, etc.) by sending them intermediate events.
The following screenshot displays the list of restaurants recommended by the Foursquare APIs around the park.
In this example, the Streamlit UI links the Foursquare output to a map, and the agent calls the APIs in response to user input.
Build the Agent
The Foursquare agent source code is open source and can be found in the GitHub repository. To upgrade the agent in your local folder from the source, perform these steps:
- Create a local folder clone of the repository.
- Set up your Foursquare API token environment variables:
1 |
export FOURSQUARE_SERVICE_TOKEN=<Foursquare API token> |
3. Configure your AWS credentials environment variables:
1 |
export AWS_ACCESS_KEY_ID=<AWS_ACCESS_KEY_ID> |
4. Install requirements:
1 |
pip install requirements.txt |
5. Launch Streamlit UI:
1 |
streamlit run agent_ui.py |
Conclusion
By harnessing the capabilities of Amazon Bedrock foundation models in the cloud and enriching them with Foursquare rich place data, developers can craft smart, contextually aware applications that anticipate user needs and deliver relevant, timely recommendations, elevating customer engagement to an entirely new level.
Drop a query if you have any questions regarding Amazon Bedrock Agents and we will get back to you quickly.
Making IT Networks Enterprise-ready – Cloud Management Services
- Accelerated cloud migration
- End-to-end view of the cloud environment
About CloudThat
CloudThat is a leading provider of Cloud Training and Consulting services with a global presence in India, the USA, Asia, Europe, and Africa. Specializing in AWS, Microsoft Azure, GCP, VMware, Databricks, and more, the company serves mid-market and enterprise clients, offering comprehensive expertise in Cloud Migration, Data Platforms, DevOps, IoT, AI/ML, and more.
CloudThat is the first Indian Company to win the prestigious Microsoft Partner 2024 Award and is recognized as a top-tier partner with AWS and Microsoft, including the prestigious ‘Think Big’ partner award from AWS and the Microsoft Superstars FY 2023 award in Asia & India. Having trained 650k+ professionals in 500+ cloud certifications and completed 300+ consulting projects globally, CloudThat is an official AWS Advanced Consulting Partner, Microsoft Gold Partner, AWS Training Partner, AWS Migration Partner, AWS Data and Analytics Partner, AWS DevOps Competency Partner, AWS GenAI Competency Partner, Amazon QuickSight Service Delivery Partner, Amazon EKS Service Delivery Partner, AWS Microsoft Workload Partners, Amazon EC2 Service Delivery Partner, Amazon ECS Service Delivery Partner, AWS Glue Service Delivery Partner, Amazon Redshift Service Delivery Partner, AWS Control Tower Service Delivery Partner, AWS WAF Service Delivery Partner, Amazon CloudFront Service Delivery Partner, Amazon OpenSearch Service Delivery Partner, AWS DMS Service Delivery Partner, AWS Systems Manager Service Delivery Partner, Amazon RDS Service Delivery Partner, AWS CloudFormation Service Delivery Partner, AWS Config, Amazon EMR and many more.
FAQs
1. What do I need to get started with this solution?
ANS: – Access to Amazon Bedrock, Foursquare API token, AWS credentials, Python installed with dependencies, and Streamlit for the UI.
2. Can I add a weather or time-based context to the agent?
ANS: – Yes, you can integrate weather, time, or other data sources to enhance the agent recommendations.

WRITTEN BY Aayushi Khandelwal
Aayushi, a dedicated Research Associate pursuing a Bachelor's degree in Computer Science, is passionate about technology and cloud computing. Her fascination with cloud technology led her to a career in AWS Consulting, where she finds satisfaction in helping clients overcome challenges and optimize their cloud infrastructure. Committed to continuous learning, Aayushi stays updated with evolving AWS technologies, aiming to impact the field significantly and contribute to the success of businesses leveraging AWS services.
Comments