Deploy and manage AI agents directly from Telegram without needing a terminal or website. This guide will walk you through the commands and architecture necessary to utilize this feature.Documentation Index
Fetch the complete documentation index at: https://docs.lucid.foundation/llms.txt
Use this file to discover all available pages before exploring further.
Commands
Here are the available commands you can use to interact with your AI agents via Telegram:| Command | Description | Requires DB |
|---|---|---|
/launch [slug] | Start an interactive agent deployment wizard. | No (catalog from Layer API) |
/start <passport_id> | Connect the chat to an existing agent. | Yes |
/start link_TOKEN | Link your Telegram account to your web account using a token from the dashboard. | MergedDb |
/status | Check the current status of your agent. | Yes |
/list | List all agents associated with your account. | Yes |
/plan | Display your current plan and usage statistics. | MergedDb |
/upgrade | Show available upgrade options and initiate a Stripe checkout. | MergedDb |
/help | Display all available commands. | No |
Architecture
The architecture for deploying and managing AI agents from Telegram is as follows:User Identity
There are two primary flows for user identity management:- Telegram-only: Automatically provision a profile, organization, and free plan using
ensureUser()andcreate_telegram_user()RPC. - Web→Telegram: Generate a link token from the dashboard, use
t.me/bot?start=link_TOKEN, and the bot will link to your existing account.
Billing Gate
Before deploying with/launch, the system checks if deployment is allowed by comparing the plan’s agents_deployed limit with usage_metrics. After a successful deployment, trackAgentDeploy() increments the usage count.
Module Structure
The following is the structure of the Telegram bot module:Environment Variables
Configure the following environment variables in your.env file:
LucidMerged Migrations
The following migrations are applied to manage Telegram user links and plan limits:079_telegram_user_links.sql— Creates thetelegram_user_linkstable and sets agent deployment plan limits.080_telegram_user_provisioning.sql— Implements thecreate_telegram_user()RPC.081_telegram_account_link_tokens.sql— Manages link tokens and their creation/consumption through RPCs.
.png?fit=max&auto=format&n=VsjUqn6fLqEhBiuI&q=85&s=8b4c7e6431e9a6af1ef23b77bb4ff5fd)
.png?fit=max&auto=format&n=VsjUqn6fLqEhBiuI&q=85&s=d5651a45e4bfbabc33f74e146af3f94a)