I Built a Telegram AI Agent That Can Actually Use Tools O.O
DEV Community

I Built a Telegram AI Agent That Can Actually Use Tools O.O

Hexzie (HexTelegram) is a Telegram-based AI assistant that goes beyond sending text back and forth. The idea was simple: what if an AI assistant inside Telegram could actually use tools, inspect files, execute commands, search the web, and interact with Telegram itself? So I built it.

HexZoNetwork / HexTelegram
Hexzie HexTelegram (HTG) - AI Telegram bot by HexzoNetwork
โš ๏ธ Project in active development, some features may still be in progress.

Hexzie is built with:

  • โœ… Telegraf + Node.js (bot framework)
  • ๐Ÿ“Œ OpenAI-compatible API for chat + function-calling tools (active development)
  • โœ… Go tool runner (tools-go) - shell, files, web, screenshots, sysinfo
  • โœ… Full filesystem control from / - no workspace jail
  • โœ… ChatGPT-style streaming replies with live progress labels

Features

  • ๐Ÿ’ฌ Chat - streaming answers, auto-summary memory, per-chat history
  • ๐Ÿ’ป Shell + files - shell_exec (any command), file_read / file_write / file_list from /
  • ๐ŸŒ Web - web_search (Bing), web_fetch, web_check (site recon), web_screenshot (chromium → PNG)
  • โœ‰๏ธ Telegram tools - send message/photo/document, inline buttons, edit, delete, forward, pin, chat actions, get_chat
  • ๐Ÿ–ผ๏ธ Vision + files - send photo/document, reply-to-file summarization, PDF text extraction
  • ๐Ÿ” Access … View on GitHub

What is Hexzie?

Hexzie is an AI Telegram assistant built with Node.js + Telegraf, with a Go-based tool runner underneath. The AI communicates through an OpenAI-compatible API, allowing the model to decide when it needs to call a tool.

Telegram
 │
 โ–ผ Telegraf
 │
 โ–ผ Authentication
 │
 โ–ผ Prompt / Context Builder
 │
 โ–ผ Agent Loop
     ├──โ–บ AI API
     │    └── tool_calls
     ├──โ–บ Go Tool Runner
     │    ├── shell
     │    ├── files
     │    ├── web
     │    ├── screenshots
     │    ├── calculator
     │    └── system info
     └──โ–บ Telegram Tools
          ├── send / edit / delete
          ├── photo / document / buttons
          ├── forward / pin
          └── get_chat

The important part is that the AI isn't limited to generating text. It can act.

Why Node.js + Go?

The Telegram side is written in Node.js using Telegraf, making handling updates, messages, callbacks, photos, documents, and streaming straightforward. The Go runner handles lower-level tools:

  • shell_exec
  • file_read
  • file_write
  • file_list
  • web_fetch
  • web_search
  • web_check
  • web_screenshot
  • get_time
  • calc
  • sysinfo

Separation of concerns:

  • Node.js ─── AI + Telegram + agent orchestration
  • Go ──────── System / filesystem / web tools

The Agent Loop

A simplified version:

User message
 │
 โ–ผ Build context
 │
 โ–ผ Send messages + tools to model
 │
 โ–ผ Does the model request a tool?
    ┌─┴─┐
   YES NO
    │   │
    โ–ผ   โ–ผ
  Run  Final answer
  tool
    │
    โ–ผ Add tool result
    โ–ผ Ask model again

Hexzie allows up to 8 agent rounds. For example:

User: "Check this website and tell me what server it's running on."
AI: → web_check()
Tool: → returns HTTP/server/technology information
AI: → analyzes result
Telegram: → final response

The model isn't just answering from training data. It's interacting with the environment through structured tools.

Progress Updates

Instead of waiting for a huge response, Hexzie keeps a single progress message and edits it while the agent

Read on DEV Community ↗ ← Back to News

Comments

No comments yet. Start the discussion.