Imagine having a fleet of specialized AI assistants living in your pocket—one that manages your calendar and emails, and another that conducts deep web research—all running on hardware you own and control.
The Simple Version
Most AI bots are like vending machines: you put in a prompt, and you get a response. But "always-on" agents are more like personal employees. They have their own desk (a workspace), their own set of tools (skills), and a way to contact you whenever they finish a task.
To make this work, you need a gateway. Think of the gateway as a digital switchboard operator. When you send a message on Telegram, the operator looks at who you are, decides which "employee" (agent) should handle the request, and routes the message to that agent's specific desk on your server.
How It Actually Works
Agent Workspaces as Directories
In this system, an agent isn't just a prompt; it is a physical directory on your server. Each agent has its own folder containing an agents.md file, which serves as the system prompt and provides the agent's identity and goals.
As the speaker explains, "Each agent is essentially its own directory with its specific tools, specific skills, and specific agents.md file." This means you can have a "Research Agent" folder and a "Personal Assistant" folder, each with entirely different personalities and capabilities.
Adding "Skills" via CLI
Agents become useful when they can interact with the real world. This is done through skills. Using a command like npx skills add, you can attach specific capabilities to an agent's workspace.
In the demo, the personal assistant agent is given access to the Google Workspace CLI. This allows the agent to read Gmail inboxes, summarize emails, and create calendar events. For the research agent, Firecrawl is used to enable web scraping and searching, allowing the AI to gather live data from the internet.
The Telegram Gateway
To avoid having to use a terminal or SSH every time you want to talk to your AI, the pi-gateway acts as the bridge. It runs as a background process on an always-on machine, such as a VPS (Virtual Private Server) or an NVIDIA DGX Spark workstation.
The gateway listens for incoming Telegram messages. When a message arrives, it uses a local SQLite database to route the conversation. It checks the source (Telegram), the agent name, and the session ID to ensure the message goes to the correct directory and maintains the conversation history.
Technical Deep Dive
The architecture described is a implementation of the Agentic Workflow pattern, where the LLM is decoupled from the interface and coupled instead to a filesystem-based context. This is inspired by projects like Hermes and OpenClaw.
Session Routing and State Management
The use of SQLite for session routing solves a major problem in bot development: statefulness. Because LLMs are stateless, the gateway must map a unique Telegram User ID to a specific Pi session ID. When a user sends a message, the gateway performs a lookup in SQLite; if no session exists, it initializes a new one in the corresponding agent directory.
This allows the user to trigger a /new command to wipe the current session and start fresh, which the gateway handles by creating a new entry in the database and a corresponding new session in the Pi harness.
The Harness: Pi and Tau
The core engine here is Pi, with Tau acting as a Python port of the Pi harness. These tools manage the loop of Thought → Action → Observation. When an agent decides to use a skill (like searching Gmail), the harness executes the CLI command, captures the output, and feeds it back into the LLM as a new observation.
For the models, the system utilizes OpenRouter to access high-performance models. The demo specifically uses Space Bunny Alpha (a stealth model) for the personal assistant and Kimi K3 for the research agent. This flexibility allows the user to swap models based on the task—using a faster, cheaper model for scheduling and a more reasoning-heavy model for research.
Filesystem-Based Context
By tying the agent to a directory, the system implements a primitive form of RAG (Retrieval-Augmented Generation) and long-term memory. Any files the agent writes to its workspace remain there. If the agent performs research and saves a summary to a text file in its folder, that file becomes part of its persistent environment, which it can reference in future sessions.
Why This Matters
This approach moves us away from the "Chatbot" paradigm and toward "Digital Agency." By hosting the gateway and agents on your own VPS, you maintain ownership of your data and your session history, rather than relying on a proprietary cloud provider's memory system.
Furthermore, the modularity of the pi-gateway means it can be extended. While the demo focuses on Telegram, the same logic can be applied to WhatsApp, Slack, or Email. This creates a unified AI interface that follows you across platforms while remaining anchored to a secure, private server.
Ultimately, this setup mimics the "dots" experience—specialized, always-on, and tool-capable—but does so using an open-source stack that developers can audit, modify, and scale according to their own needs.