Qanot AI¶
Lightweight Python agent framework for building AI-powered Telegram bots.
PyPI: qanot | Python: 3.11+ | License: MIT
What is Qanot AI?¶
Qanot AI is a framework that turns an LLM into a persistent, tool-using Telegram assistant. You provide a config file and a Telegram bot token, and Qanot handles the agent loop, memory, streaming, cron scheduling, and multi-provider failover.
Built for the Uzbekistan market: defaults to Asia/Tashkent timezone, Telegram-first design (Telegram is the dominant messaging platform in Uzbekistan), and Uzbek-language error messages.
Key Features¶
- Multi-provider support -- Anthropic Claude, OpenAI GPT, Google Gemini, Groq. Switch providers in config without code changes.
- Automatic failover -- configure multiple providers and Qanot switches between them on errors with cooldown tracking.
- Live streaming -- real-time response streaming via Telegram Bot API 9.5
sendMessageDraft, witheditMessageTextand blocked fallbacks. - RAG (Retrieval-Augmented Generation) -- built-in document indexing with hybrid search (vector + BM25). Uses sqlite-vec for local vector storage.
- Memory system -- WAL protocol scans every message for corrections and preferences before responding. Daily notes, session state, and long-term memory files.
- Context management -- token tracking with automatic compaction at 60% usage and working buffer activation at 50%.
- Cron scheduler -- APScheduler-based scheduled tasks with isolated agent spawning or system event injection.
- Plugin system -- extend with custom tools via a decorator-based plugin API.
- Per-user isolation -- separate conversation histories per Telegram user with automatic eviction of idle conversations.
- Voice support -- 4 voice providers (Muxlisa, KotibAI, Aisha, Whisper) for speech-to-text and text-to-speech.
- Model routing -- 3-tier routing (Haiku/Sonnet/Opus) based on message complexity for cost optimization.
- Web dashboard -- Bloomberg Terminal aesthetic monitoring dashboard at :8765.
- Image generation/editing -- Gemini-powered image generation and editing via natural language.
- Multi-agent delegation -- spawn and delegate tasks to sub-agents with tool/model overrides.
- Execution security -- 3 levels (open/cautious/strict) for sandboxed command execution.
- Web search and fetch -- Brave Search API integration with SSRF-protected web fetching.
- Cost tracking -- per-user token and cost tracking across providers.
- 115+ plugin tools -- ready-made plugins for amoCRM, Bitrix24, 1C, AbsMarket, and more.
How It Compares to OpenClaw¶
| Aspect | Qanot AI | OpenClaw |
|---|---|---|
| Size | Lightweight (~30 modules) | Heavy (many modules) |
| Providers | 4 built-in + failover | Typically single provider |
| Streaming | Native sendMessageDraft |
editMessageText only |
| RAG | Built-in hybrid search | External dependency |
| Memory | WAL protocol + daily notes | Basic memory |
| Context | Auto-compaction + working buffer | Manual management |
| Market focus | Uzbekistan (timezone, Telegram) | General |
Quick Start¶
# 1. Install
pip install qanot
# 2. Create a project
qanot init mybot
# 3. Configure (edit bot_token and api_key)
nano mybot/config.json
# 4. Run
qanot start mybot
Your bot is now live on Telegram. Send it a message.
Documentation¶
- Getting Started -- installation, first bot, configuration walkthrough
- Configuration Reference -- every config field explained
- LLM Providers -- provider setup, failover, custom providers
- Memory System -- WAL protocol, daily notes, working buffer
- RAG -- document indexing, hybrid search, memory integration
- Tools -- built-in tools, cron tools, RAG tools
- Plugin System -- creating custom tools and plugins
- Telegram Integration -- response modes, streaming, webhooks
- Cron Scheduler -- scheduled tasks, heartbeat, proactive messaging
- Architecture -- system design, agent loop, data flow
- API Reference -- class and method documentation
Requirements¶
- Python 3.11+
- A Telegram bot token (from @BotFather)
- At least one LLM API key (Anthropic, OpenAI, Gemini, or Groq)
- Optional:
sqlite-vecfor RAG vector search (pip install qanot[rag])