Back to home

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.

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)

Telegram Userbot (MTProto)

Telegram AI Agent (Teleton)

Capability Bot (Bot API) Userbot (MTProto) AI Agent (Teleton)
ProtocolBot APIMTProtoMTProto
Read chat historyNoYesYes
Manage contactsNoYesYes
Natural languageNoNoYes (15 LLMs)
Persistent memoryCustomCustomBuilt-in (vector + FTS)
Tool callingCustomCustom125+ built-in
TON blockchainNoNoNative integration
Plugin systemCustomCustomSDK + hot-reload
Web dashboardNoNoBuilt-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:

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:

ProviderModelsBest For
AnthropicClaude 4 Opus, Sonnet, HaikuComplex reasoning, safety, long context
OpenAIGPT-4o, GPT-4 TurboGeneral purpose, code generation
GoogleGemini 2.5 Pro, FlashMultimodal, long documents
xAIGrokReal-time information, creative tasks
GroqLlama 3Ultra-fast inference, cost-effective
OpenRouterMultipleMulti-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:

The memory system indexes:

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:

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

  1. Go to my.telegram.org/apps
  2. Log in with your phone number
  3. Navigate to "API development tools"
  4. Create an application
  5. Save your api_id and api_hash (these are permanent)

Step 3: Run the Setup Wizard

teleton setup

The wizard configures:

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.