Skip to content

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, with editMessageText and 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.
  • MCP client -- connect to 1000+ external tool servers via the Model Context Protocol.
  • Browser tools -- browse URLs, click elements, fill forms, take screenshots via Playwright.
  • Skills system -- agent creates reusable SKILL.md + scripts for repetitive tasks, hot-reload without restart.
  • 22 Telegram commands -- inline keyboard settings management (model, voice, language, routing, exec security, and more).
  • Anthropic memory tool -- dual-layer architecture with /memories directory and trained memory behavior.
  • Server-side code execution -- Anthropic code_execution_20250825 for Python sandboxed execution.
  • Webhook and WebChat -- external event webhooks (GitHub, CRM, CI/CD) and WebSocket-based webchat adapter.
  • Lifecycle hooks -- on_startup, on_shutdown, on_pre_turn, on_post_turn extension points.
  • 1M context window -- auto-detection for Opus 4.6 and Sonnet 4.6.
  • 115+ plugin tools -- ready-made plugins for amoCRM, Bitrix24, 1C, AbsMarket, iBox POS, Eskiz SMS, and more.

How It Compares to OpenClaw

Aspect Qanot AI OpenClaw
Size Lightweight (~35 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 + Anthropic memory tool Basic memory
Context Auto-compaction + working buffer (1M window) Manual management
MCP Built-in client for 1000+ tool servers No MCP support
Browser Playwright-based browse/click/fill/screenshot No browser tools
Skills Self-improving agent with hot-reload scripts No skill system
Commands 22 Telegram slash commands with inline keyboards Limited commands
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

Requirements

  • Python 3.11+
  • A Telegram bot token (from @BotFather)
  • At least one LLM API key (Anthropic, OpenAI, Gemini, or Groq)
  • Optional: sqlite-vec for RAG vector search (pip install qanot[rag])
  • Optional: MCP client for external tool servers (pip install qanot[mcp])
  • Optional: Browser tools via Playwright (pip install qanot[browser])