Skip to content

nitsujiang/TaskPilot

Repository files navigation

TaskPilot

TaskPilot is a Slack agent that extracts tasks/meetings from natural language, stores them in PostgreSQL, supports Google Calendar/Drive meeting workflows, and provides a Streamlit overview dashboard.

Current Capabilities

  • Extract task or meeting fields (task, title, description, owners, deadline, urgency) from Slack messages.
  • Clarification loop for missing fields.
  • Meeting flow:
    • book a user-provided time
    • or suggest common availability after Google OAuth connection.
  • Conflict checking before meeting booking.
  • Materials flow to append links/Drive files to event descriptions.
  • Google backend service for OAuth + Calendar + Drive APIs.
  • Reminder pipeline:
    • hourly scheduler checks tasks due within the next 14 days
    • Slack reminders to assignees
    • email reminders via backend Gmail (/gmail/send) using Google-connected profiles (not desktop client_secrets flow)
  • Streamlit board for DB overview (this week, open tasks, reminder readiness).

Architecture

  • app.py
    Flask Slack event handler, orchestration flow, meeting booking/materials, scheduler startup.
  • services/google_api.py
    FastAPI service for Google OAuth, Calendar, and Drive endpoints.
  • agent/parser.py, agent/prompts.py
    Gemini extraction + clarification behavior.
  • agent/scheduler.py
    Hourly reminder scheduler (Slack + email).
  • utils/slack.py, utils/gmail_utils.py, utils/gemini.py, utils/time.py
    Integrations and shared helpers.
  • databases/db.py, databases/tasks.sql, databases/profiles.sql
    PostgreSQL persistence.
  • frontend/streamlit_app.py
    Streamlit dashboard over DB state.

Prerequisites

  • Python 3.12+
  • PostgreSQL database
  • Slack app and bot token (at least app_mentions:read, chat:write, users:read)
  • Gemini API key
  • Google OAuth client credentials for Calendar/Drive backend
  • ngrok for local Slack event tunneling

Environment

Use root .env (and optionally agent-backend/.env) with values such as:

DATABASE_URL=...
GEMINI_API_KEY=...
SLACK_BOT_TOKEN=...
SLACK_SIGNING_SECRET=...
GOOGLE_CLIENT_ID=...
GOOGLE_CLIENT_SECRET=...
BACKEND_API_KEY=...
STATE_SIGNING_SECRET=...
APP_EXTERNAL_URL=http://localhost:8000
API_ENDPOINT=http://localhost:8000

Install

pip install -r <your requirements export>  # optional style
pip install apscheduler streamlit tzdata

Or your existing project sync workflow (uv sync / lock-based flow).

Local Run (All Services)

Open separate terminals.

  1. Flask bot:
flask --app app run --port 3000 --reload
  1. FastAPI Google backend:
uvicorn services.google_api:app --host 127.0.0.1 --port 8000
  1. ngrok tunnel to Flask:
ngrok http 3000

If ngrok is not in PATH, run by full executable path.

  1. Streamlit overview board:
streamlit run frontend/streamlit_app.py

Set Slack Event Subscriptions URL to:

https://<ngrok-id>.ngrok-free.app/slack/events

Email Reminder Setup Notes

  • Initial “task saved” and recurring reminder emails go through utils/gmail_utils.send_email, which calls the FastAPI backend POST /gmail/send with X-Backend-Key.
  • The sender profile must have completed /connect/google (same OAuth as Calendar/Drive, including Gmail send scope).
  • Reminder cadence is urgency-aware; the scheduler runs hourly and considers deadlines in the next 14 days, with per-recipient spacing stored in Postgres (last_email_reminder_by_recipient).

Quick Test Flow

  1. Mention bot in Slack with a task/meeting message.
  2. Confirm task saved message and DB insert.
  3. For meetings, connect Google via link and ask for suggestions.
  4. Book a suggested time and verify event creation.
  5. Open Streamlit board to confirm task visibility.
  6. Create a near-term task and verify reminder behavior in Flask logs/inbox.

About

Agentic AI solution to prevent decision drift and action-item amnesia over time from Break Through Tech's Productivity Team 1.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors