Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#Environment file
.env

#User memory and data
user_profile.json

#Python cache & compiled files
__pycache__/
*.py[cod]
*.pyo

#Jupyter notebooks checkpoints (if using notebooks)
.ipynb_checkpoints/

#VSCode and PyCharm editor settings
.vscode/
.idea/

#Virtual environment
.venv/
venv/
env/
ENV/

#Python environment files
*.egg-info/
*.egg
*.log
pip-log.txt
pip-delete-this-directory.txt

#Build artifacts
build/
dist/

#OS files
.DS_Store
Thumbs.db

#Dependency lock (optional if not using pip freeze)
poetry.lock
Pipfile.lock

# Ignore Python venv and system paths
.venv/
src/.venv/
src/Lib/
src/Scripts/
src/Include/
43 changes: 24 additions & 19 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
## 2. `ARCHITECTURE.md`

```markdown
# Architecture Overview

Below, sketch (ASCII, hand-drawn JPEG/PNG pasted in, or ASCII art) the high-level components of your agent.

## Components

1. **User Interface**
- E.g., Streamlit, CLI, Slack bot

2. **Agent Core**
- **Planner**: how you break down tasks
- **Executor**: LLM prompt + tool-calling logic
- **Memory**: vector store, cache, or on-disk logs
Below is a high-level diagram of the Cognitive Companion Agentic AI system:

3. **Tools / APIs**
- E.g., Google Gemini API, Tools, etc
![Architecture Diagram](./architecture_v2.png)
<!-- or use ./assets/architecture_v2.png if stored in /assets -->

4. **Observability**
- Logging of each reasoning step
- Error handling / retries
## Components

### 1. **User Interface**
- CLI-based for now (command line interaction)
- Accepts natural language input from the user

### 2. **Agent Core**
- **Planner**: *(To be implemented)* will break user goals into subtasks
- **Executor**: Calls Gemini API with context and handles tool execution
- **Memory**: JSON-based store to persist user profile, routines, and context

### 3. **Tools / APIs**
- **Gemini API** for LLM responses
- **Gmail SMTP** for notifications
- *(Optional future tools: Push Notification APIs, Calendar, SMS)*

### 4. **Observability**
- Uses terminal logging for:
- LLM inputs and outputs
- Memory updates
- Notification triggers
- Errors are caught and logged
23 changes: 2 additions & 21 deletions DEMO.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,4 @@
# Demo Video

Please record a 3–5 minute walkthrough showing:
### 📽️ Demo Video

- The problem you solve
- End-to-end agent behavior on a representative example
- Highlighted “agentic” steps (planning, tool calls, memory use)

---

📺 **Provide a Hosted Public Video Link (YouTube unlisted / Loom / MP4):** MUST BE ON A HOS
https://your.video.link.here

PLEASE DO NOT UPLOAD RAW VIDOE FILES. These submissions will not be reviewed.

### Timestamps

- **00:00–00:30** — Introduction & setup
- **00:30–01:30** — User input → Planning step
- **01:30–02:30** — Tool calls & memory retrieval
- **02:30–03:30** — Final output & edge-case handling

- Vidoes longer than 5 minutes may not be reviewd.
Watch the demo video on [YouTube](https://www.canva.com/design/DAGuRzIru7g/U4j1YZCm0coIcS_gkcSU8Q/watch?utlId=hae22173251).
36 changes: 1 addition & 35 deletions EXPLANATION.md
Original file line number Diff line number Diff line change
@@ -1,35 +1 @@
# Technical Explanation

## 1. Agent Workflow

Describe step-by-step how your agent processes an input:
1. Receive user input
2. (Optional) Retrieve relevant memory
3. Plan sub-tasks (e.g., using ReAct / BabyAGI pattern)
4. Call tools or APIs as needed
5. Summarize and return final output

## 2. Key Modules

- **Planner** (`planner.py`): …
- **Executor** (`executor.py`): …
- **Memory Store** (`memory.py`): …

## 3. Tool Integration

List each external tool or API and how you call it:
- **Search API**: function `search(query)`
- **Calculator**: LLM function calling

## 4. Observability & Testing

Explain your logging and how judges can trace decisions:
- Logs saved in `logs/` directory
- `TEST.sh` exercises main path

## 5. Known Limitations

Be honest about edge cases or performance bottlenecks:
- Long-running API calls
- Handling of ambiguous user inputs

📄 [View High-Level Design (HLD) Document](./HLD.pdf)
Binary file added HLD.pdf
Binary file not shown.
Binary file added ProductRequirementsDocument.pdf
Binary file not shown.
121 changes: 98 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,117 @@
# Agentic AI App Hackathon Template
# 🧠 Memory Anchor — Agentic AI for Alzheimer’s Support

Welcome! This repository is your starting point for the **Agentic AI App Hackathon**. It includes:
Cognitive Companion is an Agentic AI application designed to assist early-stage Alzheimer's patients with memory support, routine reminders, and emotionally comforting conversations. It can also notify loved ones via email when needed.

- A consistent folder structure
- An environment spec (`environment.yml` or `Dockerfile`)
- Documentation placeholders to explain your design and demo
---

## 📋 Submission Checklist
## ✨ Features

- [ ] All code in `src/` runs without errors
- [ ] `ARCHITECTURE.md` contains a clear diagram sketch and explanation
- [ ] `EXPLANATION.md` covers planning, tool use, memory, and limitations
- [ ] `DEMO.md` links to a 3–5 min video with timestamped highlights
- Onboards the user and stores their routine/memory profile
- Uses Google Gemini (via Gemini API) to generate memory-aware, emotionally supportive replies
- Sets local reminders for daily routines or medications
- Sends email alerts to loved ones
- Saves user memory locally for context-aware interaction
- Secured using environment variables

---

## 🚀 Getting Started
## 🧩 Core Modules Implemented

1. **Clone / Fork** this template. Very Important. Fork Name MUST be the same name as the teamn name
| File | Purpose |
|----------------|-------------------------------------------------------------------------|
| `planner.py` | (To be implemented) Breaks down user goals into sub-tasks |
| `executor.py` | Calls Gemini API, generates responses using prompt + memory |
| `memory.py` | Saves and retrieves user memory (e.g., routines, meds, contacts) |
| `tools.py` | Contains helper functions like `set_reminder()` and `send_notification()` |
| `notifier.py` | Sends email to emergency contacts using Gmail SMTP |

---

## 📂 Folder Layout
## ⚙️ Setup Instructions

![Folder Layout Diagram](images/folder-githb.png)
### 1. Create and Activate Virtual Environment

```bash
python -m venv .venv
.venv\Scripts\activate # On Windows
source .venv/bin/activate # On macOS/Linux
```

---

## 🏅 Judging Criteria
### 2. Install Requirements

- **Technical Excellence **
This criterion evaluates the robustness, functionality, and overall quality of the technical implementation. Judges will assess the code's efficiency, the absence of critical bugs, and the successful execution of the project's core features.
```bash
pip install -r requirements.txt
```

- **Solution Architecture & Documentation **
This focuses on the clarity, maintainability, and thoughtful design of the project's architecture. This includes assessing the organization and readability of the codebase, as well as the comprehensiveness and conciseness of documentation (e.g., GitHub README, inline comments) that enables others to understand and potentially reproduce or extend the solution.
---

- **Innovative Gemini Integration **
This criterion specifically assesses how effectively and creatively the Google Gemini API has been incorporated into the solution. Judges will look for novel applications, efficient use of Gemini's capabilities, and the impact it has on the project's functionality or user experience. You are welcome to use additional Google products.
### 3. Configure `.env` for Gemini + Gmail

- **Societal Impact & Novelty **
This evaluates the project's potential to address a meaningful problem, contribute positively to society, or offer a genuinely innovative and unique solution. Judges will consider the originality of the idea, its potential real‑world applicability, and its ability to solve a challenge in a new or impactful way.
1. Get a free Gemini API key via [Google AI Studio](https://makersuite.google.com/app)
2. Create a `.env` file in the project root and add:

```env
# Gemini API Key (from Google AI Studio)
GEMINI_API_KEY=your_gemini_api_key_here

# Gmail SMTP credentials (App Password required)
EMAIL_SENDER=your_email@gmail.com
EMAIL_PASSWORD=your_gmail_app_password
```

---

### 📧 How to Set Up Gmail for Notifications

1. Go to: [https://myaccount.google.com/security](https://myaccount.google.com/security)
→ Under "Signing in to Google", enable **2-Step Verification**

2. After enabling 2FA, go to: [https://myaccount.google.com/apppasswords](https://myaccount.google.com/apppasswords)
→ Choose **Mail** as the app and **Other (Custom name)** as the device (e.g., `Promptonauts`)
→ Click **Generate**

3. Copy the **16-character App Password** (e.g., `abcd efgh ijkl mnop`)
→ Paste it into `.env` like this (no spaces):

```env
EMAIL_PASSWORD=abcdefghijklmnop
```

📌 Never commit `.env` to Git. It's already in `.gitignore`.

---

### 4. Run the App

```bash
python src/main.py
```


---

## 📹 Demo Video

We have recorded a **5-minute demo video** showcasing the full working of the Cognitive Companion Agent — from onboarding, planning, tool usage, to output generation and edge case handling.

📎 **Watch the video demo**: [Demo Video Link](https://www.canva.com/design/DAGuRzIru7g/U4j1YZCm0coIcS_gkcSU8Q/watch?utlId=hae22173251)



---


## Documentation

- [📄 High-Level Design (HLD)](./HLD.pdf)
- [📄 Product Requirements Document (PRD)](./ProductRequirementsDocument.pdf)





### ⚠️ Disclaimer

This is a hackathon prototype and not intended for medical use without proper safety, testing, and regulatory approval.
Binary file added architecture_v2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added requirements.txt
Binary file not shown.
66 changes: 66 additions & 0 deletions src/executor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# src/executor.py

import os
from google import genai
from memory import load_user_profile
from datetime import datetime
from dotenv import load_dotenv

load_dotenv()

# Create Gemini client using API key from environment
client = genai.Client(api_key=os.getenv("GEMINI_API_KEY"))

def generate_response(user_input):
# Load saved user profile
profile = load_user_profile()
if not profile:
return "No user profile found."

name = profile.get("name", "friend")
routines = profile.get("routines", {})
meds = routines.get("medications", {})
contacts = profile.get("contacts", [])

now = datetime.now().strftime("%A %I:%M %p")

# Build memory snippet string
memory_snippets = []
if routines.get("dinner"):
memory_snippets.append(f"{name} has dinner at {routines['dinner']}.")
for med, time in meds.items():
memory_snippets.append(f"The {med} is taken {time}.")
if contacts:
memory_snippets.append(f"Close contacts include: {', '.join(contacts)}.")

memory_text = "\n".join(memory_snippets)

# Construct prompt
prompt = f"""
You are a caring AI assistant helping {name}, an early-stage Alzheimer’s patient.
Current time: {now}
Memory:
{memory_text}

User input:
"{user_input}"

Your job:
- Understand what {name} is asking
- Respond in a friendly, emotionally supportive tone
- If it's a reminder, infer the right time if not mentioned
- Help reduce confusion or anxiety

Respond directly to the user.
"""

try:
# Send prompt to Gemini
response = client.models.generate_content(
model="gemini-2.5-pro", # You can switch to gemini-2.5 if available
contents=prompt
)
return response.text.strip()

except Exception as e:
return f"Error contacting Gemini: {e}"
Loading