Skip to content
fullstack ai-machine-learning featured

Telegram AI Agent Automation v3.0

Modular Telegram AI assistant featuring deep Google Workspace integration, advanced RAG, Voice-to-Action capabilities, and a Multi-Agent Debate System.

fullstack │ live · flow-chart-telegram-assitent-ai-agent.amazthegreatape.fun · ai-agent· google-automation· multi-agent· nlp
Telegram AI Agent Automation v3.0 screenshot
AI Agent Google Automation Multi-Agent NLP Productivity Python RAG System

A Telegram bot that acts as a personal assistant across the whole Google suite — Drive, Sheets, Docs, Calendar, Gmail and Forms — with DeepSeek for reasoning and a hybrid retrieval layer so it can answer from documents you upload rather than only from its own training.

Highlights

  • Retrieval that combines two ranking families — Pinecone vector search alongside BM25 keyword ranking, so a question phrased loosely and a question quoting an exact term both land on the right passage. Documents are chunked with NLTK rather than split on a fixed character count.
  • A file upload as the way around Telegram's message limit — Telegram caps a message at 4,096 characters, which makes pasting a long document impossible. Uploading the file instead lifts that ceiling entirely: the bot parses it, stores it, and indexes it.
  • Full text in Postgres because the vector store cannot hold it — Pinecone metadata is limited to roughly 1,000 characters, so storing the document there would silently truncate it. The embeddings live in Pinecone and the complete text lives in Postgres, each holding what it is actually good at.
  • Five document formats, parsed in pure Python — .txt with automatic encoding detection, .pdf, .docx, .xlsx and .csv with multi-encoding support. The PDF path deliberately avoids native dependencies so the image still builds and runs on Fly.io.
  • Long answers are split, not cut — responses above the Telegram limit are broken across messages automatically, which is the difference between a truncated answer and a complete one.
  • Multi-tenant from the service layer up — separate multi-tenant variants of the AI client, Google client and memory service exist alongside the single-user ones, so the same deployment can serve more than one owner.

Key Features

  1. AI chat in two depths — a fast Chat mode and a slower Thinking mode for deeper analysis, both on DeepSeek.
  2. Google Workspace control from chat — upload and organise Drive files, build and analyse spreadsheets, draft and edit Docs, manage Calendar events and reminders, triage Gmail and draft replies, and generate Forms or quizzes.
  3. Document Q&A — upload a file and ask questions against its contents, backed by the hybrid RAG pipeline.
  4. News and research — RSS aggregation via feedparser plus DuckDuckGo search for live lookups.
  5. YouTube transcripts — pull a video's transcript and summarise or query it.
  6. Persistent memory — a dedicated memory service so the assistant carries context across sessions instead of restarting cold each time.
  7. Charts from data — pandas and matplotlib render analysis back into the chat as images.

Tech Stack

  • Python 3.10+ with python-telegram-bot 20+ (job queue enabled)
  • DeepSeek through the OpenAI SDK
  • Pinecone 5 (vector search) + rank-bm25 (keyword ranking)
  • PostgreSQL via psycopg2-binary and asyncpg (full document storage)
  • Google API Python Client + google-auth-oauthlib + gspread
  • pypdf, python-docx, openpyxl, chardet (document parsing), NLTK (chunking)
  • feedparser, duckduckgo-search, youtube-transcript-api, beautifulsoup4
  • pandas + matplotlib (analysis and charts)
  • Docker + Fly.io deployment (Procfile and docker-compose also present)

Status & Maturity

Active. The repository carries unusually thorough operational documentation — a deployment guide, a multi-tenant guide, a setup checklist, a quick reference, and an implementation report for the retrieval upgrade, which alone accounts for roughly 1,750 lines. Four test suites are present, which is real but modest coverage for a codebase of this size; the Google integrations in particular are verified by hand against live accounts.

Measured Metrics

Commits 56
Date Range 17 Dec 2025 – 20 Jan 2026
Lines of code 25,037
Tests 4 test suites present