Calendar AI Assistant

Talk to your schedule in plain English

Built with Mackenzie (SeaMeetsSky38Times) · Submitted to HackMars 3.0 (Neon)

Try It — Schedule Planner

Describe your tasks and any fixed commitments for the day. The AI builds a time-blocked schedule — the same output the Calendar AI pipeline produces.

Demo Video

Description

What it does: Connects to your Google Calendar and Gmail through OAuth 2.0 and lets you manage your schedule entirely in plain English. Add events, query your week, turn emails into todos, and generate an optimised time-block plan from a task list — all from a single chat prompt. A 4-agent CrewAI pipeline handles every request: Intent Analyzer → Schedule Data Retriever → Schedule Processor → Response Verifier. Available as both a Streamlit Web UI and a rich CLI.

AI Providers: Supports 5 providers switchable from the Settings page — OpenAIGroqGeminiMistralOllama — so it runs fully offline with Ollama or on free cloud tiers. Provider and model are stored in secrets.toml and never hardcoded.

Google Integration: Reads and writes Google Calendar v3 and reads Gmail v1 via OAuth 2.0. The token flow is handled by backend/auth/add_google_oauth.py, which caches credentials with pickle and refreshes them automatically.

How it was built: Python core. CrewAI 1.1 orchestrates the agent pipeline. streamlit-calendar renders the month/week/day grid. Config in TOML; events and todos persisted as JSON; OAuth tokens in pickle. A run.py launcher with questionary lets you choose CLI or Streamlit on startup.

Streamlit App Pages

Calendar

Full streamlit-calendar grid with month, week, and day views. Events pulled from Google Calendar via the data retriever agent and rendered live.

AI Chat (Sidebar)

Persistent chat sidebar across all pages. Ask anything about your calendar — the pipeline runs, returns a verified response, and any calendar actions are applied immediately.

Todo List

Add and delete tasks with titles and descriptions. Stored in todos.json. The AI can generate todos from chat prompts or turn Gmail threads into task items.

Settings

Choose AI provider, set model name, enter API key, set calendar view default. Google OAuth connect / disconnect button. One-click cache clear.

Portfolio (built-in)

The app ships with its own portfolio page showing live metrics, full feature list, architecture diagram, tech stack, and live Google account status with upcoming events.

Description

Reads and renders README.md directly inside the Streamlit app so the project description stays in sync with the repo automatically.

Architecture

  Calendar AI Assistant — Full Architecture
  ══════════════════════════════════════════

  run.py  (questionary launcher)
     ├── "Run in CLI"        →  frontend/cli/cli.py
     └── "Run in Streamlit"  →  frontend/streamlit/Page.py

  ┌──────────────────────────────────────────────────────┐
  │  frontend/streamlit/Page.py                          │
  │                                                      │
  │  Pages: Description · Portfolio · Calendar           │
  │          Todo List · Settings                        │
  │                                                      │
  │  Sidebar: AI Chat (persistent across pages)          │
  │           user_input → connect_to_ai.py              │
  └────────────────────────┬─────────────────────────────┘
                           │
                           ▼
  ┌──────────────────────────────────────────────────────┐
  │  backend/tools/connect_to_ai.py                      │
  │  provider routing: OpenAI · Groq · Gemini            │
  │                    Mistral · Ollama                   │
  └────────────────────────┬─────────────────────────────┘
                           │  JSON action
        ┌──────────────────┼──────────────────┐
        ▼                  ▼                  ▼
  calendar_events.py   todo_stuff.py    crew.py (CrewAI)
  Google Calendar v3   todos.json        ┌─ Intent Analyzer
  add / read events    CRUD              ├─ Data Retriever
                                         ├─ Schedule Processor
                                         └─ Response Verifier

  backend/auth/add_google_oauth.py
    OAuth 2.0 flow  ·  token pickle cache  ·  auto-refresh
    Google Calendar v3  +  Gmail v1

  Storage:
    backend/storage/calendar_events.json   ← local event cache
    backend/storage/todos.json             ← todo list
    backend/storage/configs.toml           ← UI preferences
    backend/storage/secrets.toml           ← provider / API key
Both CLI and Streamlit call the same backend/ layer — no duplicated logic between interfaces.

Dev Notes

Problem Solved

Calendar apps show data but don't reason about it. This lets you talk to your schedule like a human assistant — and have it actually act: create events, file todos, read your Gmail, build a time-block plan.

Hardest Part

Google OAuth across two developers and two runtime modes (CLI vs. Streamlit). Token refresh had to be airtight — a stale token mid-pipeline breaks the whole crew.

What I'd Do Differently

Abstract all Google API calls into a single data layer from day one instead of letting both interfaces call the API directly. Would have prevented several sync bugs.