Skip to main content

๐Ÿงช PharmaOne Pharma Product QnA Assistant

Build an AI-powered assistant for pharmaceutical representatives to answer product questions and check inventory

๐Ÿ“‹ Overviewโ€‹

This demonstration showcases a complete solution for pharmaceutical representatives who need instant access to accurate product information and real-time inventory data while in the field meeting with healthcare providers.

โœ… Key Capabilitiesโ€‹

CapabilityDescription
Product KnowledgeAnswer detailed questions about medication indications, contraindications, dosages, and side efects
Inventory ManagementCheck real-time stock levels across multiple distribution centers
MemoryMaintain conversation context and recall previous interactions
ComplianceGenerate accurate responses based only on approved documentation

๐Ÿ—๏ธ Solution Architectureโ€‹

ComponentPurpose
MAAP Data LoaderIngest and process pharmaceutical documentation (PDFs, package inserts, technical data)
MAAP Agent BuilderCreate a conversational AI interface with specialized tool-calling capabilities
Memory MCP ServerStore and manage conversational memory for contextual responses
MongoDB AtlasStore and query both unstructured product knowledge and structured inventory data

๐Ÿ”„ Implementation Processโ€‹

This implementation guide is organized into three sequential phases:

๐Ÿ“Š Phase 1: Data Pipelineโ€‹

  • Download pharmaceutical product PDFs from PharmaOne
  • Process documents using MAAP Data Loader
  • Extract and index meaningful content
  • Import structured inventory and product data

๐Ÿค– Phase 2: Agent Creationโ€‹

  • Configure the pharmaceutical representative agent
  • Set up vector search for product knowledge
  • Integrate MongoDB tools for inventory queries
  • Define agent behavior parameters

๐Ÿงช Phase 3: Validationโ€‹

  • Test with representative medical field queries
  • Verify accuracy against official documentation
  • Confirm inventory checking capabilities
  • Evaluate response quality and compliance

๐Ÿ“š PHASE 1: DATA PIPELINE

Ingest and process PharmaOne pharmaceutical documentation

This phase walks through setting up the data pipeline that will power your pharmaceutical assistant. We'll process product documentation and create searchable collections in MongoDB Atlas.

โš™๏ธ Prerequisitesโ€‹

Before starting, verify you have the following components ready:

RequirementDetails
MongoDB AtlasActive cluster with connection string
MAAP Data LoaderInstalled and configured
Python EnvironmentPython 3.8+ with required libraries
Source DataAccess to PharmaOne product documentation URLs
AWS AccountOptional: For AWS Bedrock embedding generation

๐Ÿ› ๏ธ Setup Processโ€‹

Step 1: Environment Configurationโ€‹

First, set up your development environment:

# Clone the repository
git clone https://github.com/mongodb-partners/maap-data-loader.git
cd maap-data-loader

# Create and activate virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

Step 2: Configuration File Setupโ€‹

Create a .env file in the project root directory:

#===================================
# MongoDB Configuration
#===================================
MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net
MONGODB_DATABASE=dr_reddys_demo
MONGODB_COLLECTION=product_documents

#===================================
# AWS Configuration
#===================================
AWS_ACCESS_KEY_ID=your_aws_access_key
AWS_SECRET_ACCESS_KEY=your_aws_secret_key
AWS_REGION=us-east-1

#===================================
# Application Settings
#===================================
LOCAL_FILE_OUTPUT_DIR=./processed_files
RUN_ENV=local

Step 3: Document Collectionโ€‹

3.1 Download Product Documentationโ€‹

Gather PharmaOne pharmaceutical product documentation using the provided scripts:

Python Script (Advanced)

# Navigate to the data directory
cd data

# Install required dependencies
pip install requests pdfkit selenium webdriver-manager

# Execute the Python downloader with options
python download_urls.py --output-dir ./pdf_downloads --concurrent 3

# Return to project root
cd ..

3.2 Document Content Overviewโ€‹

The downloaded PDFs contain comprehensive pharmaceutical information:

Content TypeDescription
Active IngredientsChemical compounds and their concentrations
IndicationsApproved medical uses and conditions
ContraindicationsSituations when medication should not be used
Dosage InformationRecommended dosages by age, weight, condition
Side EffectsCommon and rare adverse reactions
Storage InstructionsTemperature, humidity and handling requirements
Regulatory InformationApproval details and compliance data

๐Ÿ”„ Data Processing Workflowโ€‹

Step 4: Document Processingโ€‹

4.1 Start the Data Processing Serviceโ€‹

Launch the MAAP Data Loader service:

# Start the processing server
python app.py

4.2 Verify Service Healthโ€‹

Confirm the service is running correctly:

curl -X GET http://localhost:8000/health

Expected response:

{"status": "healthy"}

4.3 Process Individual Documentsโ€‹

Process a single document to test the pipeline:

# Process a single PDF file
curl -X POST http://localhost:8000/local/upload \
-H "Content-Type: multipart/form-data" \
-F "files=@./data/pdf_downloads/all5-17.07.2024.pdf" \
-F 'json_input_params={
"user_id": "dr_reddys_demo",
"mongodb_config": {
"uri": "mongodb+srv://username:password@cluster.mongodb.net",
"database": "dr_reddys_demo",
"collection": "product_documents",
"index_name": "vector_index",
"text_field": "text",
"embedding_field": "embedding"
}
}'

4.4 Batch Process All Documentsโ€‹

Create and execute a batch processing script for all documents:

# Create batch processing script
cat > process_all_pdfs.sh << 'EOF'
#!/bin/bash

PDF_DIR="./data/pdf_downloads"
PROCESSED=0
TOTAL=$(find "$PDF_DIR" -name "*.pdf" | wc -l)

echo "๐Ÿ”„ Starting batch processing of $TOTAL PDF files"

for pdf_file in "$PDF_DIR"/*.pdf; do
if [ -f "$pdf_file" ]; then
PROCESSED=$((PROCESSED+1))
FILENAME=$(basename "$pdf_file")

echo "๐Ÿ“„ [$PROCESSED/$TOTAL] Processing: $FILENAME"

curl -s -X POST http://localhost:8000/local/upload \
-H "Content-Type: multipart/form-data" \
-F "files=@$pdf_file" \
-F 'json_input_params={
"user_id": "dr_reddys_demo",
"mongodb_config": {
"uri": "mongodb+srv://username:password@cluster.mongodb.net",
"database": "dr_reddys_demo",
"collection": "product_documents",
"index_name": "vector_index",
"text_field": "text",
"embedding_field": "embedding"
}
}'

echo -e "\nโฑ๏ธ Waiting 2 seconds before next file..."
sleep 2
fi
done

echo "โœ… Completed processing $PROCESSED files"
EOF

# Make the script executable
chmod +x process_all_pdfs.sh

# Run the batch processing script
./process_all_pdfs.sh

4.5 Expected Processing Resultsโ€‹

Each successfully processed document will return:

{
"success": true,
"message": "Upload processed successfully",
"details": {
"files_processed": 1,
"urls_processed": 0,
"documents_stored": 1,
"file_list": ["all5-17.07.2024.pdf"],
"url_list": []
}
}

๐Ÿ” Verification Processโ€‹

Step 5: Data Validationโ€‹

5.1 MongoDB Atlas Web Interfaceโ€‹

Verify proper document ingestion using the MongoDB Atlas web interface:

  1. Log in to your MongoDB Atlas account
  2. Navigate to your project > Database > Browse Collections
  3. Select the dr_reddys_demo database
  4. Examine the product_info collection
  5. Confirm documents contain the following structure:
{
"_id": ObjectId("..."),
"text": "ALLERWAY 5: COMPOSITION: Each film-coated tablet contains levocetirizine dihydrochloride 5 mg...",
"embedding": [0.023, -0.128, 0.332, ...],
"user_id": "dr_reddys_demo",
"metadata": {
"filename": "all5-17.07.2024.pdf",
"processed_at": "2025-08-08T10:23:45Z",
"pages": 4,
"file_type": "application/pdf"
}
}

5.2 MongoDB Compass (Desktop Client)โ€‹

For more advanced validation using the MongoDB Compass desktop client:

  1. Download and install MongoDB Compass
  2. Connect using your MongoDB Atlas connection string
  3. Navigate to the dr_reddys_demo.product_info collection
  4. Run sample validation queries:

Sample Query 1: Find documents by product name

{text: {$regex: "Cifloc", $options: "i"}}

Sample Query 2: Find documents with dosage information

{text: {$regex: "recommended dose|dosage|administered", $options: "i"}}

Sample Query 3: Find documents with side effects

{text: {$regex: "adverse|side effects|warnings", $options: "i"}}

๐Ÿ“Š PHASE 1B: STRUCTURED DATA INTEGRATION

Enhance your agent with real-time inventory and product data

While PDF content provides valuable pharmaceutical information, structured data gives your agent access to precise, queryable business data like inventory levels and product specifications.

๐Ÿ—ƒ๏ธ MongoDB Inventory Integrationโ€‹

Step 1: Prepare Structured Data Schemaโ€‹

Our inventory system will track products across multiple distribution centers with the following information:

  • Product ID and name
  • Batch numbers and expiration dates
  • Quantity available
  • Distribution center location
  • Pricing information

Step 2: Run Data Ingestion Scriptโ€‹

Execute our structured data ingestion script:

# Navigate to the demo directory
cd dr_reddy_pharma_sales_rep_demo

# Execute the import script
python ingest_structured_data.py \
--mongodb-uri "mongodb+srv://username:password@cluster.mongodb.net" \
--database "dr_reddys_demo" \
--products-collection "products" \
--inventory-collection "inventory" \
--centers-collection "distribution_centers"

Step 3: Script Functionalityโ€‹

The ingest_structured_data.py script performs these key operations:

OperationDescription
Data LoadingImports structured product data from data/dr_reddys_products.json
Collection CreationCreates and populates three interrelated collections
Relationship BuildingEstablishes connections between products, documents, and inventory
Data EnrichmentAdds computed fields and search optimizations

Step 4: Data Model Overviewโ€‹

The script creates a comprehensive data model with these collections:

Collection: products

{
"_id": ObjectId("..."),
"brand_name": "Allerway 5",
"molecule": "Levocetirizine Dihydrochloride",
"therapy": "Antihistaminics",
"dosage_form": "Tabs",
"package_insert_url": "https://www.drreddys.co.za/sites/.../all5-17.07.2024.pdf",
"document_id": ObjectId("..."), // Link to unstructured PDF data
"search_text": "Allerway 5 Levocetirizine Dihydrochloride"
}

Collection: inventory

{
"_id": ObjectId("..."),
"product_id": ObjectId("..."),
"distribution_center_id": ObjectId("..."),
"quantity": 315,
"last_updated": ISODate("2025-08-08T12:34:56Z"),
"reorder_level": 50,
"available": true
}

Collection: distribution_centers

{
"_id": ObjectId("..."),
"name": "Mumbai Central",
"location": {
"city": "Mumbai",
"state": "Maharashtra",
"country": "India"
},
"address": "123 Main Street, Mumbai",
"contact": "+91-9876543210"
}

Step 5: Verify Data Ingestionโ€‹

A successful import will show this output:

๐Ÿ”„ Loading data from ./data/dr_reddys_products.json
โœ… Successfully connected to MongoDB Atlas
๐Ÿ“Š Created products collection with 38 products
๐Ÿ“ฆ Created inventory collection with 152 inventory records
๐Ÿข Created distribution centers collection with 12 centers
๐Ÿ”— Successfully linked PDF documents with product data

๐Ÿ”„ Dual-Data Advantageโ€‹

With both unstructured and structured data sources integrated, your agent can now:

  1. Access Deep Knowledge: Retrieve detailed pharmaceutical information from product documentation
  2. Provide Business Context: Offer real-time inventory levels, pricing, and availability information
  3. Answer Complex Queries: Respond to questions that require both knowledge types:
    • "What is the recommended dosage for Allerway 5 and is it available in the Boston distribution center?"
    • "Tell me about the side effects of Reegen-D 15000 and check if it's available for expedited shipping from our New York warehouse."

๐Ÿค– PHASE 2: AGENT CREATION

Build an intelligent pharmaceutical assistant with MAAP Agent Builder

Now that our data pipeline is complete with both unstructured (PDFs) and structured (products/inventory) data in MongoDB Atlas, we'll install, configure, and deploy a specialized agent for pharmaceutical representatives.

๐Ÿ”ง Installing MAAP Agent Builderโ€‹

Before configuring your agent, you need to set up the MAAP Agent Builder framework:

# Clone the repository
git clone https://github.com/mongodb-partners/maap-agent-builder.git
cd maap-agent-builder

# Set up a virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate

# Install the package
pip install -e .

# Create necessary directories
mkdir -p config logs prompts

Required Dependenciesโ€‹

The agent builder requires several key dependencies:

# Install core dependencies for MongoDB integration
pip install pymongo langchain-mongodb

# Install embedding providers
pip install voyageai boto3 langchain-aws

# Install MCP dependencies for memory capabilities
pip install langchain-mcp-adapters fastmcp

๐Ÿ› ๏ธ Agent Configurationโ€‹

Step 1: YAML Configurationโ€‹

Create or update your config/agents.yaml file with the following configuration:

#===================================
# PharmaOne Pharma Sales Rep Agent - Configuration
#===================================

# Configure the embedding models
embeddings:
- name: voyage_embeddings
provider: voyageai
model_name: voyage-3.5-lite
additional_kwargs:
output_dimension: 512
- name: bedrock-titan
provider: bedrock
model_name: amazon.titan-embed-text-v1

# Configure the language model
llms:
- name: claude-3.5
provider: bedrock
model_name: anthropic.claude-3-5-sonnet-20240620-v1:0
temperature: 0.7
max_tokens: 4096

# Configure agent tools
tools:
# Product Availability Tool (Full-text search)
- name: product_availability
tool_type: full_text_search
description: Checks product availability of the product in the MongoDB database
connection_str: ${MONGODB_URI:-mongodb://localhost:27017}
namespace: dr_reddys.product_inventory
additional_kwargs:
index_name: full_text_search_index
text_field: search_text
top_k: 5

# Product Information Tool (Vector search)
- name: product_information
tool_type: vector_search
description: Searches for relevant documents in the vector store to help with FAQ on pharmaone product information
connection_str: ${MONGODB_URI:-mongodb://localhost:27017}
namespace: dr_reddys.product_info
embedding_model: voyage_embeddings # Reference to the embedding model defined above
additional_kwargs:
index_name: vector_index
top_k: 3
min_score: 0.7

# AI Memory Tool (MCP server integration)
- name: ai-memory
tool_type: mcp
description: MongoDB MCP Toolkit for advanced data operations
servers_config:
"ai-memory":
url: "http://localhost:8080/mcp"
transport: "streamable_http"
filter:
- store_memory
- retrieve_memory
- semantic_cache_response

# Configure checkpointing
checkpointer:
connection_str: ${MONGODB_URI:-mongodb://localhost:27017}
db_name: dr_reddy_agent_state
collection_name: checkpoints
name: rag_agent_checkpointer

# Configure the agent
agent:
name: rag_react_agent
agent_type: react
llm: claude-3.5 # Reference to the LLM defined above
tools:
- product_information # References to the tools defined above
- product_availability
- ai-memory
system_prompt_path: ./prompts/rag_system_prompt.txt

Step 2: Agent Deploymentโ€‹

Launch the agent service with all required environment variables:

# Set required environment variables
export MONGODB_URI="mongodb+srv://username:password@cluster.mongodb.net"
export AWS_ACCESS_KEY_ID="your_aws_access_key"
export AWS_SECRET_ACCESS_KEY="your_aws_secret_key"
export AWS_REGION="us-east-1"
export VOYAGE_API_KEY="your_voyage_api_key" # Required for voyage embeddings

# Start the agent service
python -m agent_builder.cli serve \
--config config/agents.yaml \
--host 0.0.0.0 \
--port 5000

Step 3: Create System Promptโ€‹

Create a system prompt file that defines your agent's behavior and capabilities:

# Create the prompts directory if it doesn't exist
mkdir -p prompts

# Create the system prompt file
cat > prompts/rag_system_prompt.txt << 'EOF'
# Pharmaceutical Sales Representative Assistant

You are an AI assistant specialized in helping pharmaceutical sales representatives with detailed product information, inventory management, and clinical knowledge.

## Your Capabilities

- Access detailed pharmaceutical product information including indications, contraindications, dosages, side effects
- Check real-time inventory levels across distribution centers
- Maintain conversation memory to provide contextual assistance
- Generate compliant, factual responses based only on approved documentation

## Guidelines

1. Always provide factually accurate information based on official PharmaOne product documentation
2. When discussing medications, include important safety information and contraindications
3. For inventory queries, provide specific details on availability, location, and quantity
4. Use professional, clear language appropriate for pharmaceutical professionals
5. Maintain conversation context by referencing relevant details from previous exchanges
6. If unsure about any information, clearly state the limitations of your knowledge
7. Do not provide medical advice beyond what is contained in official product documentation

Remember: Your responses will be used by pharmaceutical representatives when speaking with healthcare professionals, so accuracy and compliance are essential.
EOF

Step 4: Agent Validationโ€‹

Test the agent through the API:

# Example API request
curl -X POST http://localhost:5000/chat \
-H "Content-Type: application/json" \
-d '{
"messages": [
{"role": "user", "content": "What are the indications for Allerway 5?"}
],
"config": {
"thread_id": "user-session-123",
"recursion_limit": 10,
}
}'

Or access the web interface by opening: http://localhost:5000

๐Ÿ“ Example Prompts for Testingโ€‹

Test your agent with these pharmaceutical representative scenarios:

CategoryExample Prompt
Product Information"What are the side effects of Cifloc and how do they compare to similar antibiotics?"
Dosage Guidance"A doctor is considering prescribing Alnedra to an elderly patient with kidney issues. What's the recommended dosage adjustment?"
Inventory Check"I'm meeting with a hospital pharmacy manager tomorrow. What's our current inventory level of Drymed 500 in the Mumbai distribution center?"
Safety Information"A patient is pregnant in her second trimester. Are there any contraindications for using Cifloc in her case?"
Storage Requirements"A clinic in a rural area without reliable refrigeration asks about Lenap 10mg. What are the storage requirements?"
Combined Query"I need information about Reegen-D 15000 for a dermatology clinic. What are the key benefits and do we have enough stock to fulfill a large order?"

๏ฟฝ PHASE 2B: MCP SERVER INTEGRATION

Enhance your agent with MongoDB Memory MCP server integration

After configuring the basic agent, you can extend its capabilities by integrating with the MongoDB Memory MCP server, providing advanced memory management, semantic caching, and hybrid search functionality.

๐Ÿ› ๏ธ Memory MCP Setupโ€‹

The MongoDB Memory MCP server provides powerful memory management for conversational agents, allowing them to store and retrieve information across sessions.

Step 1: Clone the Memory MCP Repositoryโ€‹

# Clone the MongoDB Memory MCP repository
git clone https://github.com/mongodb-partners/memory-mcp.git
cd memory-mcp

# Create necessary environment files from examples
cp .env.example .env

Step 2: Configure Environment Variablesโ€‹

Edit the .env file with your MongoDB and AWS credentials:

# Core Application Settings
APP_NAME=memory-mcp
DEBUG=False
PORT=8080

# Service URLs (default Docker Compose settings)
LOGGER_SERVICE_URL=http://event-logger:8181
AI_MEMORY_SERVICE_URL=http://ai-memory:8182
SEMANTIC_CACHE_SERVICE_URL=http://semantic-cache:8183

# MongoDB Configuration
MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net
DATABASE_NAME=memory_mcp
COLLECTION_NAME=memory

# AWS Configuration
AWS_ACCESS_KEY_ID=your_access_key
AWS_SECRET_ACCESS_KEY=your_secret_key
AWS_REGION=us-east-1
EMBEDDING_MODEL_ID=amazon.titan-embed-text-v1
LLM_MODEL_ID=us.anthropic.claude-3-sonnet-20240229-v1:0
VECTOR_DIMENSION=1536

# External APIs
TAVILY_API_KEY=your_tavily_api_key

Step 3: Deploy Using Docker Composeโ€‹

# Build and start all services
docker-compose up -d

# Verify deployment
docker-compose ps
docker-compose logs memory-mcp

๐Ÿ’ก Integrating Memory MCP with Agent Builderโ€‹

Step 1: Update Agent Configurationโ€‹

Your config/agents.yaml file already includes the Memory MCP integration with the ai-memory tool. Here's the relevant section highlighting the MCP configuration:

# AI Memory Tool Configuration
tools:
# Other tools configuration...

# Memory MCP Integration
- name: ai-memory
tool_type: mcp
description: MongoDB MCP Toolkit for advanced data operations
servers_config:
"ai-memory":
url: "http://localhost:8080/mcp"
transport: "streamable_http"
filter:
- store_memory
- retrieve_memory
- semantic_cache_response

# Agent configuration using the Memory MCP tool
agent:
name: rag_react_agent
agent_type: react
llm: claude-3.5
tools:
- product_information
- product_availability
- ai-memory # AI Memory tool is included in the agent's toolset
system_prompt_path: ./prompts/rag_system_prompt.txt

Step 2: Understanding Memory MCP Toolsโ€‹

The Memory MCP server provides several powerful tools that enhance your pharmaceutical sales rep agent:

ToolPurposeBenefits
store_memorySave conversation messages for future contextMaintains conversation history across sessions
retrieve_memoryGet relevant context from past conversationsProvides continuity for pharmaceutical discussions
semantic_cache_responseCache responses for similar queriesReduces latency for common drug inquiries
check_semantic_cacheCheck for existing similar responsesEnsures consistency in medication information
hybrid_searchAdvanced document search combining vector and keyword matchingImproves accuracy of pharmaceutical documentation searches

Step 3: Testing Memory-Enhanced Agentโ€‹

Start your agent with the updated configuration:

# Start the agent builder service with MCP integration
python -m agent_builder.cli serve \
--config config/agents.yaml \
--host 0.0.0.0 \
--port 5000

Test the memory capabilities with sequential queries:

  1. First query establishes context:

    "Tell me about the side effects of Allerway 5"
  2. Follow-up query references previous context:

    "Given those side effects, what precautions should be taken?"
  3. The agent should respond using memory from the previous interaction, demonstrating continuity of conversation.

๏ฟฝ๐Ÿš€ PHASE 3: VALIDATION & EXPANSION

Test, validate and expand your pharmaceutical assistant

After completing the configuration and deployment of your pharmaceutical sales representative agent, it's essential to thoroughly test its capabilities and plan for future enhancements.

๐Ÿงช Agent Testing Strategyโ€‹

Step 1: Knowledge Testingโ€‹

Verify the agent can accurately retrieve information from pharmaceutical documentation:

  1. Factual Queries

    • "What is the active ingredient in Allerway 5?"
    • "What are the contraindications for Cifloc?"
    • "What is the recommended pediatric dosage for Lenap 10mg?"
  2. Contextual Understanding

    • "Compare the side effects of Drymed 500 and Cifloc"
    • "Explain when Alnedra should be taken with food versus without"
    • "What safety precautions should be taken with Reegen-D 15000?"

Step 2: Inventory Intelligenceโ€‹

Test the agent's ability to access structured inventory data:

  1. Basic Inventory Queries

    • "How many units of Allerway 5 are available across all distribution centers?"
    • "Is Cifloc currently in stock at the Mumbai distribution center?"
    • "What's our current inventory level for Drymed 500?"
  2. Complex Business Logic

    • "Which distribution center has the highest stock of Lenap 10mg?"
    • "Are we below the reorder threshold for Alnedra in any location?"
    • "What's the total inventory value of antihistamine products?"

๐Ÿ”„ Continuous Improvementโ€‹

Enhancement Roadmapโ€‹

EnhancementDescriptionPriority
Image RecognitionAllow scanning of product packagingMedium
Prescription AnalysisExtract information from prescription imagesHigh
Mobile IntegrationNative mobile app for field representativesHigh
Offline ModeLimited functionality without internet connectionMedium
Competitor AnalysisAdd comparative product informationLow

Deployment Optionsโ€‹

  1. Cloud Deployment

    • Deploy to MongoDB Atlas App Services
    • Configure with AWS/Azure/GCP serverless functions
    • Set up CI/CD pipeline for automated updates
  2. On-Premises Solutions

    • Kubernetes deployment within corporate infrastructure
    • Integration with existing enterprise systems
    • Compliance with internal security policies
  3. Hybrid Approaches

    • Keep sensitive data on-premises
    • Use cloud resources for model serving
    • Implement proper data encryption and access controls

๐Ÿ” Troubleshooting Guideโ€‹

If you encounter issues during setup or operation, here are some common problems and solutions:

MongoDB Connection Issuesโ€‹

Error: MongoDB connection failed

Solutions:

  • Verify your MongoDB Atlas connection string
  • Check if your IP address is whitelisted in MongoDB Atlas
  • Ensure your cluster is running and accessible
  • Test connection with MongoDB Compass

Embedding Model Errorsโ€‹

Error: Failed to generate embeddings

Solutions:

  • Verify your API keys for VoyageAI or AWS are correct and active
  • Check that the embedding model specified exists
  • Ensure your network can reach the embedding service
  • Try reducing embedding dimensions if you encounter memory issues

MCP Server Connection Problemsโ€‹

Error: Failed to connect to MCP server

Solutions:

  • Verify the MCP server is running with docker-compose ps
  • Check if the port is correctly exposed and accessible
  • Review the MCP server logs with docker-compose logs memory-mcp
  • Ensure your MongoDB configuration for the MCP server is correct

Agent Execution Errorsโ€‹

Error: Tool execution failed

Solutions:

  • Check if all required environment variables are set
  • Verify namespace values match your MongoDB collections
  • Review tool permissions and settings
  • Test each tool individually to isolate the problem