Telegram AI Agent: The Complete Guide to Autonomous AI on Telegram
Teleton is an open-source Telegram AI Agent that operates as a real user account — not a bot. With 125+ built-in tools, multi-model AI reasoning, persistent memory, native TON blockchain integration, and a plugin SDK, it's the most capable way to automate anything on Telegram.
Table of Contents
- What Is a Telegram AI Agent?
- Bot vs. Agent vs. Userbot: Key Differences
- MTProto Architecture: How It Works
- 125+ Built-in Tools
- Multi-Model AI: 15 LLM Providers, 70+ Models
- Persistent Memory System
- Plugin SDK & Extensibility
- Use Cases
- How to Set Up Your Telegram AI Agent
- Comparison: Teleton vs n8n vs Make vs Relevance AI
- Frequently Asked Questions
What Is a Telegram AI Agent?
A Telegram AI Agent is an autonomous software program that operates within Telegram using artificial intelligence to understand and execute tasks. Unlike simple chatbots that follow pre-defined scripts, an AI agent reasons through problems, uses tools, maintains memory across sessions, and takes multi-step actions.
Think of the difference between a calculator (chatbot) and a human accountant (AI agent). The calculator can only do what you explicitly tell it. The accountant understands context, remembers your financial history, uses multiple tools (spreadsheets, tax software, banking portals), and proactively identifies issues.
Teleton is the first open-source Telegram AI Agent that operates as a real user account (not a bot) via the MTProto protocol. This gives it access to the full range of Telegram capabilities that bots cannot reach — reading chat history, managing contacts, forwarding messages, handling groups and channels, and more.
Bot vs. Agent vs. Userbot: Key Differences
Understanding the distinction between these three types of Telegram automation is essential for choosing the right approach:
Telegram Bot (Bot API)
- Uses the Bot API — a simplified HTTP API maintained by Telegram
- Requires a bot token from @BotFather
- Cannot read chat history before the bot was added
- Cannot manage contacts, folders, or user-level settings
- Cannot join groups on its own — must be added by an admin
- Receives messages only when directly addressed (commands or mentions)
- Marked as "bot" in the UI — users know they're talking to a bot
Telegram Userbot (MTProto)
- Uses MTProto — the same protocol used by official Telegram apps
- Operates under a real user account
- Full access to all Telegram features: chat history, contacts, groups, channels, folders, stickers, gifts, stars, and more
- Can read all messages in conversations, not just those directed at it
- Appears as a regular user — no "bot" label
- Requires a Telegram account with phone number and API credentials from my.telegram.org
Telegram AI Agent (Teleton)
- A userbot powered by AI — combines MTProto access with LLM reasoning
- Understands natural language instead of just commands
- Reasons through multi-step problems using an agentic loop with tool calling
- Maintains persistent memory across restarts
- Supports 15 LLM providers and 70+ models (Claude, GPT-4, Gemini, Grok, Groq, OpenRouter, Ollama, DeepSeek, and more)
- Includes 125+ built-in tools and a Plugin SDK for custom extensions
- Integrates natively with the TON blockchain for DeFi, wallets, and NFTs
| Capability | Bot (Bot API) | Userbot (MTProto) | AI Agent (Teleton) |
|---|---|---|---|
| Protocol | Bot API | MTProto | MTProto |
| Read chat history | No | Yes | Yes |
| Manage contacts | No | Yes | Yes |
| Natural language | No | No | Yes (15 LLMs) |
| Persistent memory | Custom | Custom | Built-in (vector + FTS) |
| Tool calling | Custom | Custom | 125+ built-in |
| TON blockchain | No | No | Native integration |
| Plugin system | Custom | Custom | SDK + hot-reload |
| Web dashboard | No | No | Built-in WebUI |
MTProto Architecture: How It Works
Teleton connects to Telegram through GramJS, a JavaScript implementation of the MTProto protocol. This is the same protocol used by the official Telegram Desktop, Android, and iOS apps.
The architecture works in three layers:
1. Transport Layer (MTProto / GramJS)
GramJS handles the encrypted connection to Telegram's servers, session management, and the raw API calls. Your Telegram session is stored locally and persists across restarts.
2. Tool Layer (125+ Tools)
Teleton exposes Telegram's capabilities as structured tools that the AI can call. Each tool has a defined input schema, output format, and scope (DM-only, group-allowed, or admin-only). Examples:
- Messaging — send messages, reply, forward, edit, delete, pin, translate
- Media — send photos, videos, documents, voice messages, stickers
- Groups — create, manage members, set permissions, configure admin rights
- Channels — post, schedule, manage subscribers, get analytics
- Contacts — add, search, manage, export
- Folders — create, organize chats, filter by criteria
- Search — search messages across chats with filters
- TON — wallet, DeFi trading, DNS, NFTs (see TON AI Agent)
- Web — search the web, fetch and read URLs
- Files — read and manage workspace files
3. Reasoning Layer (Agentic Loop)
The AI model receives the user's message plus context (conversation history, memory, available tools) and decides what actions to take. It can chain multiple tool calls together to complete complex tasks. For example:
User: "Summarize the last 50 messages in @crypto_channel
and post a summary in our group chat"
Agent reasoning:
1. Call get_messages(chat: "@crypto_channel", limit: 50)
2. Analyze and summarize the messages
3. Call send_message(chat: "our group chat", text: summary)
4. Report completion to user
125+ Built-in Tools
Teleton ships with over 125 tools organized into categories:
Telegram Tools (53 methods)
Complete access to Telegram's user-level API: sending messages (text, media, formatted), reading chat history, managing contacts, groups, channels, folders, stickers, gifts, stars, and more. Every action a human can perform in Telegram is available as a tool.
TON Blockchain Tools (15+ methods)
Native wallet management, DeFi trading on STON.fi and DeDust, DNS auctions, NFT operations, and balance checking. Learn more in the TON AI Agent guide.
Memory Tools
Save and recall information across sessions. The agent can store facts, user preferences, and context that persists across restarts.
Web Tools
Search the web using Tavily (free tier available) and fetch readable content from any URL. The agent can research topics and bring external information into conversations.
System Tools
Scheduled tasks (cron-like), file management for the workspace directory, and admin commands for runtime configuration.
Tool RAG: Smart Tool Selection
With 125+ tools, sending all of them to the LLM every message would be expensive and slow. Teleton uses Tool RAG — semantic search over tool descriptions to select only the top 25 most relevant tools per message. This reduces token usage significantly and is essential for providers with tool count limits.
Multi-Model AI: 15 LLM Providers, 70+ Models
Teleton supports fifteen LLM providers, each with different strengths:
| Provider | Models | Best For |
|---|---|---|
| Anthropic | Claude 4 Opus, Sonnet, Haiku | Complex reasoning, safety, long context |
| OpenAI | GPT-4o, GPT-4 Turbo | General purpose, code generation |
| Gemini 2.5 Pro, Flash | Multimodal, long documents | |
| xAI | Grok | Real-time information, creative tasks |
| Groq | Llama 3 | Ultra-fast inference, cost-effective |
| OpenRouter | Multiple | Multi-model gateway, flexibility |
Switch providers with a single config change (provider: anthropic) or at runtime using the /model admin command. No code changes needed.
Persistent Memory System
Unlike stateless chatbots that forget everything between sessions, Teleton implements a hybrid retrieval memory system:
- Vector search — 384-dimensional local ONNX embeddings for semantic similarity (no external API calls)
- Full-text search — SQLite FTS5 with BM25 ranking for keyword matching
- Reciprocal Rank Fusion — Combines both search methods for optimal recall
The memory system indexes:
- Persistent memory entries (facts, preferences, instructions)
- Daily session logs (summarized conversation history)
- Telegram messages from conversations
- Workspace markdown files
When conversation context approaches the token limit, auto-compaction kicks in: the agent summarizes the conversation using a utility model, archives the full transcript, and continues with fresh context. Observation masking compresses old tool results, saving ~90% of context space.
Plugin SDK & Extensibility
Teleton's Plugin SDK lets you build custom tools as JavaScript (ESM) modules:
// plugins/weather/index.js
export const tools = [{
name: 'get_weather',
description: 'Get current weather for a city',
parameters: {
type: 'object',
properties: {
city: { type: 'string', description: 'City name' }
},
required: ['city']
},
execute: async ({ city }, sdk) => {
const data = await fetch(`https://api.weather.com/${city}`);
return { temperature: data.temp, conditions: data.weather };
}
}];
The SDK provides namespaced access to:
sdk.telegram— 53 messaging methodssdk.ton— wallet, payments, NFT operationssdk.secrets— 3-tier secret resolution (env, file, config)sdk.storage— key-value store with TTL supportsdk.db— isolated SQLite database per pluginsdk.log— prefixed logger with dashboard streaming
Enable dev.hot_reload: true for automatic plugin reloading during development. Browse the plugin directory for 34 community plugins with 172+ tools.
Use Cases
Personal Assistant
Set up reminders, schedule messages, summarize long conversations, translate messages in real-time, and manage your Telegram inbox through natural language.
Community Management
Automate group moderation, welcome new members, answer recurring questions using persistent memory, manage admin permissions, and schedule channel posts.
DeFi & Crypto Trading
Execute token swaps on STON.fi and DeDust, monitor prices, manage your TON wallet, and automate trading strategies. See the TON AI Agent guide for details.
Customer Support
Build an AI-powered support agent that remembers customer history, uses knowledge base tools, and escalates complex issues to human agents.
Content Automation
Schedule and post content across multiple channels, aggregate news from sources, generate summaries, and manage editorial calendars.
Development & DevOps
Receive deployment notifications, query monitoring systems, trigger CI/CD pipelines, and manage infrastructure — all from your Telegram.
How to Set Up Your Telegram AI Agent
Step 1: Install Teleton
# Via npm (recommended)
npm install -g teleton@latest
# Via Docker
docker pull ghcr.io/tonresistor/teleton-agent:latest
# From source
git clone https://github.com/TONresistor/teleton-agent.git
cd teleton-agent && npm install && npm run build
Step 2: Get Telegram API Credentials
- Go to my.telegram.org/apps
- Log in with your phone number
- Navigate to "API development tools"
- Create an application
- Save your
api_idandapi_hash(these are permanent)
Step 3: Run the Setup Wizard
teleton setup
The wizard configures:
- LLM provider and API key
- Telegram authentication (phone number, login code, optional 2FA)
- Access policies (who can DM the agent, which groups it can participate in)
- Admin user ID (your Telegram user ID for admin commands)
- TON wallet generation
Step 4: Start the Agent
teleton start
The agent connects to Telegram and begins processing messages. Send it a message from your admin account to test:
"Hello! What can you do?"
"Summarize the last 20 messages in this chat"
"Remind me to check the markets in 2 hours"
Comparison: Teleton vs n8n vs Make vs Relevance AI
| Feature | Teleton | n8n | Make.com | Relevance AI |
|---|---|---|---|---|
| Telegram protocol | MTProto (userbot) | Bot API | Bot API | Bot API |
| Read chat history | Yes | No | No | No |
| AI reasoning | Multi-model agentic loop | Via AI nodes | Via AI modules | Built-in |
| TON blockchain | Native (15+ tools) | No | No | No |
| Persistent memory | Vector + FTS hybrid | Database nodes | Data stores | Built-in |
| Open source | MIT license | Fair-code (n8n license) | No | No |
| Self-hosted | Yes | Yes | No | No |
| Plugin SDK | JS/ESM + hot-reload | Community nodes | Custom apps | Tool builder |
| Pricing | Free + LLM costs | Free tier + paid plans | Subscription | Subscription |
| Setup complexity | ~10 minutes | 15-30 minutes | 10-20 minutes | 5-15 minutes |
Frequently Asked Questions
What is a Telegram AI Agent?
A Telegram AI Agent is an autonomous software program that operates within Telegram using artificial intelligence to understand and execute tasks. Unlike simple chatbots that follow pre-defined scripts, an AI agent reasons through problems, uses tools, maintains memory across sessions, and takes multi-step actions like sending messages, managing groups, executing trades, and automating workflows.
How is a Telegram AI Agent different from a Telegram bot?
Telegram bots use the Bot API which limits them to responding to commands, receiving messages only when directly addressed, and accessing a subset of Telegram features. A Telegram AI Agent like Teleton uses the MTProto protocol (the same protocol used by official Telegram apps) to operate as a real user account with full access: reading chat history, managing contacts, handling groups and channels, forwarding messages, managing folders, and performing every action a human user can.
Is Teleton a Telegram userbot?
Yes. Teleton is a Telegram userbot powered by AI. It connects to your personal Telegram account via MTProto (using GramJS) and operates with the same capabilities as a human user. The key difference from traditional userbots is that Teleton uses LLM-powered reasoning with tool calling to autonomously handle complex tasks.
Will using a Telegram AI Agent get my account banned?
Teleton uses the official MTProto protocol, the same one used by all Telegram clients including the official apps. A dedicated Telegram account is recommended. As long as you don't spam or abuse the platform, your account remains safe. Teleton includes built-in rate limiting and access policies to prevent misuse.
What AI models can the Telegram AI Agent use?
Teleton supports 15 LLM providers (70+ models): Anthropic (Claude), OpenAI (GPT-4), Google (Gemini), xAI (Grok), Groq (Llama), and OpenRouter (multi-model gateway). You can switch between providers with a single config change or at runtime. Each provider brings different strengths for reasoning, coding, and creative tasks.
Can I build my own tools for the Telegram AI Agent?
Yes. Teleton provides a Plugin SDK that lets you create custom tools as JavaScript (ESM) modules. Drop a file in the plugins folder and restart. The SDK provides access to Telegram methods, TON wallet operations, a key-value store, an isolated database, secrets management, and a logging system. Hot-reload is supported for development.
How does the Telegram AI Agent compare to n8n or Make.com?
n8n and Make.com are workflow automation platforms that connect to Telegram via the Bot API. Teleton operates as a real Telegram user via MTProto, giving it access to features these platforms cannot reach (reading chat history, managing contacts, group admin actions, folders, etc.). Teleton also includes native TON blockchain integration, persistent memory, and AI reasoning — capabilities that would require extensive custom nodes in n8n or Make.
Is the Telegram AI Agent open source?
Yes. Teleton is fully open source under the MIT license, hosted on GitHub at github.com/TONresistor/teleton-agent. You can inspect the code, contribute, fork, and self-host. You only pay for the LLM provider API you choose.
Get Started with Your Telegram AI Agent
Install Teleton in under 5 minutes and start automating Telegram with AI:
npm install -g teleton@latest
teleton setup
teleton start
Join the Telegram community for support, or explore the source code on GitHub.
Learn more about TON blockchain automation or browse the plugin directory for 34 community plugins with 172+ tools.