Task Genie is a Telegram bot for managing tasks and reminders with natural language.
- PocketFlow for orchestration
- LiteLLM for LLM access
- Langfuse tracing via
pocketflow-tracing - FastAPI + Aiogram for the app boundary and Telegram adapter
- Beanie + MongoDB for persistence
- short-term conversation history stored in MongoDB
Telegram
→ bot adapter
→ application service boundary
→ PocketFlow conversation engine
→ LiteLLM + task services + history
→ MongoDB / Langfuse
app/bot/maps Telegram updates to request/response objects.app/application/owns the use-case boundary and result contracts.app/ai/engine/handles planning, task resolution, execution, tracing, and history.app/models/contains persistence models.
- supports task creation, editing, deletion, listing, completion, and stats
- keeps short-term conversation history across restarts
- asks for clarification when task references are ambiguous
- uses Langfuse for tracing when enabled
- Python 3.11+
- MongoDB
- Redis (required for Aiogram FSM / session storage)
- Telegram bot token
- OpenAI-compatible API key through LiteLLM
- A valid Fernet
ENCRYPTION_KEY(generate withpython -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())") - Langfuse credentials when tracing is enabled
uv sync
cp .env.example .envuv run pytest -quv run uvicorn app.main:app --reloadThe bot is webhook-only in the current stack: Telegram updates are received at POST /webhook, not via long polling.
curl http://localhost:8000/healthCopy .env.example to .env and fill in:
MONGO_URIMONGO_DB_NAMETELEGRAM_BOT_TOKENWEBHOOK_URLTELEGRAM_WEBHOOK_SECRET_TOKENREDIS_URLENCRYPTION_KEYMODELorLITELLM_MODELTRACING_ENABLEDLANGFUSE_PUBLIC_KEYLANGFUSE_SECRET_KEYLANGFUSE_HOSTLANGFUSE_PROJECT
ENCRYPTION_KEYmust be a valid Fernet key, not an arbitrary secret string.- Tracing only activates when
TRACING_ENABLED=trueand the Langfuse credentials/host are set. - Redis is required for the bot session/FSM layer even if you only run the webhook app.
- Telegram delivery is webhook-based only; configure
WEBHOOK_URLbefore expecting inbound updates. GET /healthis available for basic liveness checks.
- Telegram is an adapter only; core behavior lives in application services.
- Conversation history is intentionally short-term, not full graph checkpointing.