This tutorial shows how to set up a Python bot project in Replit using the Agent and get it ready for development.
Note: This tutorial covers the general setup for a Python-based bot. You need a Replit account to get started. Sign up at replit.com if you don't have one yet. You'll also need a bot token from your platform of choice - for example, the Discord Developer Portal or @BotFather on Telegram - before your bot can connect.
- Sign in to your account at replit.com. On the dashboard, click + Create Something New.
- In the prompt, describe what you want to build - for example, "A business assistant bot that answers questions, sends reminders, manages a group, and fetches data." Click the Arrow button to run. The Agent automatically sets up the environment.
- Retrieve the token from your chosen platform and copy it.
- When prompted, paste your token in the Agent workspace, then click Continue and + Add Account to Secrets to confirm. Alternatively, click the Secrets tab in the left sidebar, add a new key called TOKEN, and paste your token as the value.
- Wait for Replit to set up the environment, then click the Open Files icon in the top-right corner and click File tree.
- Review the generated project structure - Replit creates a main.py and a pyproject.toml by default. Click main.py to open it in the editor and review your bot logic.
- Write your bot logic in main.py or ask the Agent - for example, "Add a command that responds with a weekly sales summary when triggered."
- Check the Console for confirmation that the bot is online, or go to your bot channel and test it directly.
.gif)
