Built with Python Β· FastAPI Β· Streamlit Β· LangChain
MindSpace is an AI-powered mental wellness assistant that combines the power of large language models, intelligent agent workflows, and real-time tools to create a supportive conversational experience. It understands user queries, responds naturally and empathetically, and can trigger helpful actions like emergency assistance or expert support routing.
| Feature | Description |
|---|---|
| π¬ Conversational AI | Natural, empathetic mental health focused dialogue |
| π€ AI Agent Workflow | Tool-calling agent built with LangChain / LangGraph |
| β‘ FastAPI Backend | High-performance async REST API |
| π¨ Streamlit Frontend | Clean, calming chat interface |
| π§ Modular Tools | Pluggable tool system for external services |
| π§ Multi-LLM Support | Works with OpenAI, Groq, and Ollama |
| π Extensible | Easy to add new tools, workflows, and integrations |
MIND_SPACE_AI_AGENT/
β
βββ back-end/
β βββ ai_agent.py # Core AI agent logic & LLM interaction
β βββ config.py # Configuration & environment variables
β βββ main.py # FastAPI entry point & API routes
β βββ tools.py # Agent tools, helpers & service integrations
β
βββ frontend.py # Streamlit chat interface
βββ main.py # Application runner
βββ requirements.txt # Project dependencies
βββ pyproject.toml # Alternative dependency config
βββ .env # Environment variables (not committed)
βββ .gitignore
βββ README.md
- Runtime β Python 3.10+
- Backend β FastAPI + Uvicorn
- Frontend β Streamlit
- AI / LLM β OpenAI, Groq, Ollama
- Agent Framework β LangChain, LangGraph
- HTTP Client β Requests, HTTPX
- Config β python-dotenv
git clone <your-repository-url>
cd MIND_SPACE_AI_AGENTWindows
python -m venv .venv
.venv\Scripts\activateMac / Linux
python3 -m venv .venv
source .venv/bin/activatepip install -r requirements.txtOr if using pyproject.toml:
pip install .Create a .env file in the root directory:
# LLM Provider Keys (add whichever you use)
OPENAI_API_KEY=your_openai_key_here
GROQ_API_KEY=your_groq_key_here
# Optional: Ollama runs locally, no key needed
# OLLAMA_BASE_URL=http://localhost:11434cd back-end
uvicorn main:app --reloadBackend will be available at: http://127.0.0.1:8000
API docs auto-generated at:
http://127.0.0.1:8000/docs
Open a new terminal and run:
streamlit run frontend.pyFrontend will open at: http://localhost:8501
User (Streamlit UI)
β
βΌ
FastAPI Backend βββΊ AI Agent (LangChain)
β
βββββββββββΌββββββββββ
βΌ βΌ βΌ
LLM Tools Workflows
(GPT/Groq/ (Emergency/ (LangGraph
Ollama) Expert...) chains)
βββββββββββΌββββββββββ
β
Final Response
β
Back to User
- User types a message in the Streamlit chat interface
- Request is forwarded to the FastAPI backend via REST API
- The AI agent processes the query using the configured LLM
- If needed, the agent calls tools (emergency services, expert routing, etc.)
- The final response is returned and displayed in the chat
- Agent workflow orchestration
- Prompt template management
- LLM interaction & response parsing
- Tool invocation logic
- External service integrations
- Custom action implementations
- Helper utilities
- Emergency & support routing
- API key management
- Environment variable loading
- Model configuration
- App-wide settings
- ποΈ Voice interaction support
- π¨ββοΈ Therapist recommendation system
- π¨ Emergency calling integration
- π§ Memory-enabled conversations
- π€ Multi-agent workflow
- π User authentication system
- π Persistent conversation history
- π Mood tracking & analytics
Screenshots and demo GIFs coming soon.
Contributions, ideas, and improvements are always welcome!
# 1. Fork the repository
# 2. Create your feature branch
git checkout -b feature/your-feature-name
# 3. Commit your changes
git commit -m "Add: your feature description"
# 4. Push and open a Pull Request
git push origin feature/your-feature-nameThis project is built for educational and development purposes.
