Autonomous Twitter/X bot built with Python, Selenium, LangChain/LangGraph, ChromaDB memory, and a FastAPI dashboard (Jinja2 + HTMX + Alpine.js + Tailwind CSS).
- Generates autonomous tweets from a configurable personality
- Reads X timeline posts and scores interest with LLM evaluation
- Creates inspiration-based posts from queued interesting content
- Checks notifications and queues replies/mentions for processing
- Prevents duplicate content with ChromaDB similarity checks
- Exposes a web dashboard for status, analytics, logs, and settings
- Python
3.13+ uvpackage manager- Google Chrome installed
- Node.js + npm (for Tailwind CSS build)
uv sync
cp config/env.template config/.env
npm install
npm run tailwind:buildNote: The web dashboard loads environment variables from config/.env.
TWITTER_USERNAME=your_x_username
TWITTER_PASSWORD=your_x_password
# At least one is required
OPENAI_API_KEY=
OPENROUTER_API_KEY=
GOOGLE_API_KEY=
ANTHROPIC_API_KEY=LANGCHAIN_TRACING_V2=false
LANGCHAIN_API_KEY=
LANGCHAIN_PROJECT=
LOG_LEVEL=INFO
ENVIRONMENT=devAUTH_USERNAME=admin
AUTH_PASSWORD_HASH=$argon2id$...
AUTH_SECRET_KEY=change-this-to-a-long-random-secret
SESSION_COOKIE_NAME=xb_session
SESSION_MAX_AGE_SECONDS=28800
SESSION_HTTPS_ONLY=falseGenerate an Argon2 hash:
uv run python -c "from argon2 import PasswordHasher; print(PasswordHasher().hash('your-password'))"Use the generated hash as AUTH_PASSWORD_HASH in config/.env.
Runtime behavior is controlled in config/config.yaml:
llm: provider/model/fallback/temperature/embedding settingspersonality: tone/style/topics/tweet length boundsscheduler: posting/reading/notification/inspiration intervalsrate_limits: max posts/replies and UTC reset timeselenium: delays/headless/user-agent behavior
uv run python main.pyuv run python -m src.web.appDashboard URL:
http://localhost:8000
The project can run in Docker with two services:
bot: scheduler + posting/reading/reply jobsweb: FastAPI dashboard on port8000
- Docker
- Docker Compose (Docker Desktop includes it)
config/.envconfigured (same file as local setup)
cp config/env.template config/.env # if not created yet
docker compose up --buildThis starts:
- Bot scheduler in background mode
- Web dashboard at
http://localhost:8000
Persistent directories are mounted from the host:
./config(includescookie.json)./data./logs
docker compose up --build bot
docker compose up --build web- Set
selenium.headless: trueinconfig/config.yamlfor container usage. shm_size: 1gbis configured to reduce Chrome crashes in containers.- First start may take longer because dependencies and Chrome are installed during image build.
The dashboard UI is styled via Tailwind CSS and built to:
src/web/static/build.css
Useful commands:
npm run tailwind:build
npm run tailwind:watchNotes:
- The dashboard stylesheet is generated from
src/web/static/tailwind/input.css. - After changing templates or
src/web/static/tailwind/input.css, rebuild Tailwind (or run watch mode).
Run all tests:
uv run pytestRun a specific test file:
uv run pytest tests/test_evaluation.py -vdata/state.json: runtime state and queuesdata/bot.db: analytics databasedata/chroma/: vector memory storelogs/: runtime logsconfig/cookie.json: persisted X login cookies
Current status and planned work are documented in ROADMAP.md.