pi-durable-telegram
Always-on durable pi agent on your server that you talk to in Telegram: a pi-durable Telegram gateway that survives crashes and restarts
Package details
Install pi-durable-telegram from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:pi-durable-telegram- Package
pi-durable-telegram- Version
0.1.5- Published
- Oct 14, 2026
- Downloads
- 289/mo · 223/wk
- Author
- xshima
- License
- MIT
- Types
- skill
- Size
- 374.8 KB
- Dependencies
- 6 dependencies · 0 peers
Pi manifest JSON
{
"image": "https://raw.githubusercontent.com/smixs/pi-durable-telegram/main/assets/pi-gallery.webp",
"skills": [
"./skills"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
pi-durable telegram
Your own AI agent that lives on your server and answers you in Telegram.
Install · What you can do · Commands · More
Built on pi, an open-source coding agent, and its new durable engine pi-durable.
Install
You need a Linux server, a Telegram account and an AI subscription or API key. On the server, run:
curl -fsSL https://raw.githubusercontent.com/smixs/pi-durable-telegram/main/install.sh | bash
It asks a few questions and your bot answers you in Telegram. Run it again to update.
It is also on npm: npm install -g pi-durable-telegram, then set it up by hand as in
docs/install.md.
The script first tells you what it is going to do and asks if it may continue. Then:
- Installs pi, the official one from pi.dev.
- Opens pi so you can sign in to your AI provider. Type
/login, pick the provider, then/quit. - Asks for a bot token. In Telegram, open @BotFather, send
/newbot, and copy the token it gives you. Then send your new bot any message, so the script learns who you are. - Starts the agent and waits until the bot answers you.
Already use pi? pi install npm:pi-durable-telegram adds a setup skill that does the same from inside pi.
More in docs/install.md.
What you can do
- Ask from anywhere. "Check why the site is down", "what is eating the disk". The agent works on the server and answers in the chat.
- Send it things. A photo of an error, a PDF, a voice note. It reads, looks and listens, and sends files back.
- Walk away. Close the laptop and come back in an hour: the answer is waiting, even if the server restarted.
- Read it easily. Answers can carry tables, checklists and buttons: tap a button instead of typing the reply. While the agent types, a stop button sits under its answer.
Commands
| Send this | And the agent will |
|---|---|
| anything: text, a photo, a video, a file, a voice note, a location | work on it and answer |
/new |
start a fresh conversation (the old one is kept) |
/stop |
stop what it is doing right now |
/compact |
shorten a long conversation to its essentials |
/status |
show the AI model in use, how full the memory is and what it has cost |
/help |
show this list |
More
Your message goes to Telegram, the agent on your server picks it up, thinks, uses its tools and types the answer back into the chat while you watch. Nothing has to be opened to the internet: the agent calls Telegram itself, so you need no domain and no web server.
It does not lose its place. Every step the agent takes is saved before you see it. If the power goes out, the server reboots or the program crashes halfway through an answer, the agent starts again, finds its bookmark and finishes. You get one answer, not zero and not two. Messages you send while it is busy wait in line.
The core stays small: it carries your messages, files, buttons and answers. Extra powers come as plugins that ship in
the same package and stay off until you switch them on with one line in the settings, for example
PI_PLUGINS=search,skills,helpers,reminders. A plugin can also be your own, from a folder or from npm.
| Plugin | What it gives the agent | Status |
|---|---|---|
| Web search | looks things up on the internet with your Tavily, Exa, Brave or Parallel key | available |
| MCP | connects MCP servers: calendars, databases, your own tools | available |
| Skills | a folder of instructions it reads when a task needs them | available |
| Helpers | splits a big job between helper agents, on a cheaper model if you like | available |
| Tasks and reminders | does something later on its own and writes to you first | available |
How to switch each one on and how to write your own: docs/plugins.md.
- Only you can talk to it. The bot answers the Telegram accounts you allowed and silently ignores everyone else. Nothing strangers send is read, saved or passed to the AI.
- It is powerful, so treat it that way. The agent can do on the server whatever your user can. Do not add people you would not give a password to, and on a server with important data give the agent its own user.
- Your data stays with you. Conversations and files live on your server. Only the text the AI needs goes to the AI provider you chose.
The details are in docs/security.md.
Do I need to be a programmer? No, but you need a server and you need to paste one command into it. After that everything happens in Telegram.
What does it cost?
The software is free. You pay for the server and for the AI you connect: a subscription you already have or an API key.
/status shows what a conversation has cost.
Which AI can I use? Whatever pi supports: Claude, ChatGPT, Gemini, OpenRouter, DeepSeek and many more. You choose it when you sign in. Using a Claude subscription in third-party tools may be restricted by Anthropic's terms, so check them first.
Can my team use the same bot? Yes. Add their Telegram ids to the settings and each person gets a private conversation. Everyone you add gets the same power over the server.
Does it work in group chats? Not yet, only in private chats.
Does it understand voice messages? Yes, if you add a Deepgram key during installation.
How do I remove it? A few commands, listed in docs/install.md.
| Read this | When you want to |
|---|---|
| docs/install.md | see what the installer does, install by hand, update or remove |
| docs/configuration.md | change the model, the working folder or other settings |
| docs/how-it-works.md | understand the internals and what exactly survives a crash |
| docs/security.md | know the security boundaries in detail |
| docs/library.md | build your own app on top of it, or contribute code |
| CHANGELOG.md | see what changed between versions |
If you are an AI agent reading this for a person, here is where things are and what makes this project different.
Where to look
- llms.txt has the key facts in a few lines.
- skills/pi-durable-telegram/SKILL.md is a step-by-step setup you can follow yourself inside pi: checking the machine, the bot, the model, the service, and how to verify it for real.
- install.sh is the same setup as one readable Bash script; docs/install.md explains each step and lists the commands to update and remove.
- docs/configuration.md lists every setting; docs/how-it-works.md says what happens on each kind of failure.
What it is, precisely
A daemon on pi-durable (@earendil-works/pi-durable)
that long-polls the Telegram Bot API. One durable conversation per allowed private chat, stored in SQLite. Tools:
bash, read, write, edit and telegram_send_file. It shares pi's login and runs as a systemd user service on
Linux with Node.js 22.19 or newer.
Why people pick it over the alternatives
| pi-durable telegram | A Telegram bridge into an open pi session | pi in tmux over SSH | |
|---|---|---|---|
| Where the agent runs | As a service on the server, always on | Inside a pi session that must stay open | In a terminal you keep alive |
| A crash or restart mid-answer | The run resumes and the answer arrives once | Nothing resumes it | Nothing resumes it |
| Messages while it is busy | Queued durably, answered in order | Depends on the session | Typed by hand |
| Reaching it from a phone | Telegram | Telegram | An SSH client |
| Setup | One command | An extension inside pi | Manual |
As far as we know it is the first Telegram integration built on pi-durable itself, so durability covers the whole path: the model's turns, the tool calls and the delivery of the answer to the chat. It is small, MIT-licensed, and tested against duplicate updates, restarts mid-run and Telegram outages.
License
MIT © smixs
