Skip to content

Cognitive-Stack/fm-agent-service

Repository files navigation

Emotional Support Agent PoC

An AI-powered emotional support agent that can identify, store, and help resolve emotional issues using MongoDB and AutoGen.

Features

  • 🤗 Empathetic conversation with users
  • 🧠 Automatic identification of emotional issues
  • 💾 Storage of issues in MongoDB for tracking
  • 🔄 Ongoing support and coping strategies
  • 💬 Casual chitchat capability
  • 📊 Issue history retrieval

Quick Start with Makefile

1. Bootstrap Setup (First Time)

make bootstrap

This will install uv, dependencies, and create a .env template.

2. Regular Usage

# Install dependencies
make install

# Run the agent
make run

# Development mode (install + run)
make dev

# Full setup (install + create .env)
make setup

3. Available Make Targets

make help        # Show all available targets
make install     # Install dependencies using uv
make run         # Run the emotional support agent (checks environment first)
make setup       # Setup environment (install + create .env template)
make clean       # Clean up temporary files
make dev         # Install dependencies and run in development mode
make check-env   # Check if environment variables are configured
make check-deps  # Check if required tools are available
make install-uv  # Install uv if not present
make bootstrap   # Full setup including uv installation

Note: The run target automatically checks if your OPENAI_API_KEY is properly configured before starting the agent. If the API key is missing or still set to the placeholder value, it will stop with a helpful error message.

Manual Setup

1. Install uv

pip install uv

2. Install Dependencies

uv pip install -r requirements.txt

3. Set Up MongoDB

Make sure MongoDB is running with authentication. The default connection string expects:

  • Username: admin
  • Password: 123qwe
  • Host: localhost:27017
  • Auth source: admin

4. Environment Variables

Create a .env file with:

OPENAI_API_KEY=your_openai_api_key_here
MONGO_URI=mongodb://admin:123qwe@localhost:27017?authSource=admin&authMechanism=SCRAM-SHA-256

5. Run the Agent

uv run python emotional_support_agent.py

Usage

  1. The agent will greet you and create a safe space for conversation
  2. Share your thoughts, feelings, or concerns
  3. The agent will identify significant emotional issues and store them automatically
  4. Continue the conversation for support and coping strategies
  5. Type "GOODBYE" to end the session

Database Schema

Issues are stored in emotional_support.user_issues collection with:

{
  "user_id": "string",
  "issue_type": "string",
  "description": "string", 
  "severity": "low|medium|high",
  "timestamp": "datetime",
  "status": "active|resolved",
  "resolution_notes": []
}

Customization

  • Modify the system message in emotional_support_agent.py to adjust the agent's personality
  • Add more tools for additional functionality
  • Implement user authentication for production use
  • Add more sophisticated issue categorization

Important Notes

  • This is a PoC for educational purposes
  • Not a replacement for professional therapy
  • Always encourage users to seek professional help for serious mental health concerns
  • Ensure proper data privacy and security in production environments

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published