RU

AI Agent in Telegram: Tool Statuses, Animations, and a Stop Button

Published: 2026-10-05 · Author: AI Release · @ai_releaseorg
AI Agent in Telegram: Tool Statuses, Animations, and a Stop Button

⚡ The gist in 5 seconds

🔍 What was found

In an article on Habr, Ivan Magda breaks down the operation of the swift-claw agent, which searches for headphone reviews, reads pages, and checks microphone feedback. So that users can see the progress, the bot uses sendRichMessageDraft with a <tg-thinking> tag in rich_message.html. Statuses are updated by sending a request with the same draft_id — this way Telegram replaces the contents of the existing draft. The Stop button is activated by the can_stop parameter. To tie statuses to tool calls, start and finish events are needed: on start, a step with a clear label is added; on finish, the result is recorded. Several events are combined into a single draft update. All dynamic text (search queries, page titles) is escaped before being inserted into the HTML. When the agent has finished its work, the final response is sent via sendRichMessage — the <tg-thinking> block is not used there, since it is only allowed in drafts. This preserves the final message in the chat history.

💡 Why it matters

This approach turns an empty chat with a "typing…" label into a visual status panel. The user sees what stage the agent is at: searching, reading a source, processing the result. Animated emoji from the AIActions set complement the text statuses, and the Stop button lets you halt the task if it goes off track. The examples in the article use HTTP and pseudocode, so the implementation can be ported to a bot in any language or framework.

🧩 Context

The article references previous breakdowns on Habr: streaming via sendMessageDraft and the Rich Messages format. Here, these capabilities are combined into a single interface for an agent that performs several actions before the final answer. It's important to remember the timer: if a tool runs longer than 30 seconds, the draft must be periodically refreshed, even when the status text hasn't changed. Otherwise, the status block will disappear while the agent is still working.

🔗 Read on habr.com

🤖 AI summary
  • Date: 2026-10-05
  • Source: habr.com
  • Tags: Telegram, AI agent, Bot
  • Key facts:
    • Telegram has a built-in interface for displaying an AI agent's progress: a temporary draft with a status block and animated icons.
    • The sendRichMessageDraft method lets you show tool statuses, and the can_stop parameter enables a Stop button.
    • Without updates, the draft disappears after 30 seconds, so it needs to be refreshed via events and a timer.
    • In an article on Habr, Ivan Magda breaks down the operation of the swift-claw agent, which searches for headphone reviews, reads pages, and checks microphone feedback.
    • So that users can see the progress, the bot uses sendRichMessageDraft with a tag in rich_message.html .
    • Statuses are updated by sending a request with the same draft_id — this way Telegram replaces the contents of the existing draft.
    • The Stop button is activated by the can_stop parameter.
    • To tie statuses to tool calls, start and finish events are needed: on start, a step with a clear label is added; on finish, the result is recorded.
TelegramAI agentBot
📖
Read the guide on this topic
Read →
← Previoushermes-mobile-app: the Hermes Android Agent Runs Entirely on Your PhoneNext →Notepad — the Program Microsoft Was Afraid to Touch for Forty Years

Source: habr.com · post in Telegram