Gift Shopping Multi-Agent AI assistant

(OpenAI / LangChain / AWS / Next.js)

Streamlined gift discovery through conversational AI and intelligent task management. The app, running serverless on AWS, showcases a sophisticated AI-powered assistant designed to change the gift-shopping experience. At its core is an AI assistant that guides users through a natural, chat-based interface while searching for products online or providing personalized recommendations. Supporting the experience are background AI agents, designed to maintain a dynamic list of gift recipients and occasions, chat long-term memory, and push updates based on the conversation to minimize manual input.


Mobile-friendly web application with a conversational AI chat assistant


The user starts on the landing page creating the app's first impression.
From there they proceed to sign up with their preferred login way.


Upon first login, the user is guided through an onboarding tutorial to get familiar with the app's features.


After the welcome message in chat, the user starts chatting with the AI gift assistant, while recipients and occasions are auto-managed.


The gift assistant suggests options within the specified budget, which the user can save for later online shopping.


Users can also add gifts manually, with the app auto-filling details from the product URL.

Solution Architecture Design

The concept behind implementing this application draws inspiration from the idea of a "Cognitive Hive"—a network of AI agents collaboratively tackling problem-solving tasks in a distributed manner. This approach involves multiple application units operating independently, each leveraging AI capabilities to address specific, narrowly focused tasks.

The primary agent serves as the user's point of interaction, maintaining a conversation to guide them through gift-shopping ideas and gathering relevant information. Meanwhile, secondary agents work in the background, processing the conversation's details and managing domain-specific entities such as gift recipients, occasions, their attributes, and the connections between them.


Cognitive Hive AI for Distributed Problem-Solving

Solution Architecture Description

The Gift Shopping Multi-Agent AI Assistant is built on a robust and scalable cloud-based architecture that leverages multiple AWS services to support real-time interaction, background processing, and user context management. Below is a detailed description of its design:

Key Architectural Decisions

Scalability

  • The use of serverless services (Lambda, S3, DynamoDB) ensures the solution scales automatically based on user demand at low cost.

Low Latency

  • WebSocket APIs support real-time interaction, enabling a responsive user experience.
  • This includes server-to-client communication for instant updates.

Modularity and Decoupling

  • By using SNS and SQS, the system ensures modularity, fault tolerance, and ease of maintenance.
  • Lower-tier functionality does not affect components serving the primary purpose.

Security and Compliance

  • Cognito handles secure user authentication.
  • API Gateway and Secrets Manager ensure secure data transmission and storage.

Automation and CI/CD

  • GitHub Actions provide one-click deployment and continuous integration pipelines, enabling quick iteration and testing.

User-Centric Design

  • Distributed Background AI agents, while running in parallel, minimize user effort by dynamically updating recipient and occasion lists based on conversational context, enhancing usability, and offloading the main AI cognitive workload by assisting it with secondary tasks. This allows the chat assistant to respond faster and focus on its single core purpose.

Solution Architecture Diagram

Key Components

Frontend Web Application

  • Developed using Next.js and deployed with One-Click deployment via GitHub Actions and AWS Amplify, providing a seamless user interface accessible through desktop and mobile browsers.

    One-Click deployment with Github Actions and Amplify for Next.js App and its Backend

  • Domain management and routing are handled by Route 53 for secure HTTPS access and CloudFront CDN for optimized content delivery.

User Authentication

  • Utilizes AWS Cognito with support for federated identities (Google, Apple, etc.) to provide a secure and convenient login experience.
  • An Authorizer Lambda function validates user tokens for secure communication.

Real-Time Interaction

  • Communication between the user and the assistant occurs via WebSocket API, enabling low-latency real-time chat.
  • A WebSocket handler Lambda processes incoming user input, runs the main AI assistant (which builds context based on available user information), and generates responses.

    WebSocket communication between the Next.js client app and AI Agent Chat Assistant

AI-Powered Background Agents

  • Background tasks are managed by a network of Lambda functions that:
    • Update and maintain the user context dynamically.
    • Manage gift recipient lists and occasion details based on conversation data.
  • SNS Topics and SQS Queues are used for decoupling and ensuring reliable task execution.

AI Models

  • Built on OpenAI's GPT (integrated via LangChain) for natural language understanding and generation.
  • The Secrets Manager securely stores API keys for AI services.
    Background Agents in a swarm way maintain user data context running in parallel

Data Storage and APIs

  • User data, including chat history and gift preferences, is stored in DynamoDB for scalability and low-latency access.
  • REST APIs are implemented using AWS API Gateway and Flask-based Lambda endpoints, providing interfaces for external operations such as accessing user and product data.

    Authenticated API request to access user data in DynamoDB

File and Media Handling

  • User-uploaded images (e.g., profile or product pictures) are processed via signed S3 uploads.
  • Media assets are stored in Amazon S3 buckets and delivered via Cloudfront CDN.

    User Registered triggers downloading profile picture to S3 bucket and sending a welcome email

Event-Driven Workflows

  • EventBridge triggers scheduled events, such as daily job executions or user email notifications.
  • Welcome emails and notifications are sent via Amazon SES, ensuring users are promptly informed of key events.

    Scheduled recurring job with email user notifications

Development Journey

The team partnered with the client and provided full-cycle development and delivery, including:

1. Discovery Phase (2 weeks)

  • Conducted research and held several sessions with the client to break down the client's requests into well-defined requirements.
  • By the end of this milestone:
    • The client had a solid plan and solution architecture design.
    • The team had a detailed list of tasks and a ready CI/CD pipeline for both development and production environments.

2. Development Phase

  • The development scope was divided into 4 major milestones, each with a clearly defined scope:
    • Early milestones focused on core functionality, allowing users to sign up and interact with the AI assistant.
    • The final milestone was dedicated to fine-tuning functionality and creating a pixel-perfect UI for the application and its landing page, following the Figma design provided by the client.

3. Testing and Rollout

  • Set up monitoring and alerting systems to track key business metrics.
  • Conducted beta testing in the production environment and polished the application before increasing traffic.

Value-Added Insights

Throughout the project, the team proactively recommended improvements to enhance the application by:

  • Addressing UX challenges.
  • Optimizing third-party integrations.
  • Implementing key architectural decisions to improve scalability, reliability, and performance.

The client was delighted with these enhancements and their impact on the final product.

Outcome

What began as an MVP evolved into a fully-fledged, production-quality application.

The final product is:

  • Highly available and scalable, running serverless on AWS.
  • Powered by the LangChain framework, OpenAI, and high-quality prompt engineering.
  • Supported by an array of additional services that enable its diverse features.

Watch the video on YouTube A quick overview of the app's core features.


Next Project: Social Media Content Generator