Skip to content

thaolst/tara-bot

Repository files navigation

TARA BOT 🤖✈️🛒

Version GitHub stars GitHub forks

AI agent cá nhân trên Telegram — săn vé máy bay, so sánh giá, cào deal.

Deploy on Fly.io License: MIT Python 3.11+

Build bởi Lê Song Tiên Thảo · GitHub · LinkedIn · Facebook


✨ Tính năng

Tính năng Mô tả Trạng thái
💬 Chat tự nhiên Hỏi "tìm vé SG Đà Nẵng cuối tuần" — Claude hiểu ngữ cảnh, tự gọi đúng tool
✈️ Tìm vé máy bay Giá real-time từ Google Flights, top 5 chuyến, link Google Flights
🛒 So sánh giá sản phẩm Google Shopping — giá, rating, shop, link mua trực tiếp
🔔 Daily price monitor 9AM mỗi sáng tự động check giá 4 tuyến SGN↔HAN/DAD/PQC, gửi Telegram
🧠 Memory trong session Claude nhớ toàn bộ lịch sử chat, hỏi tiếp không cần nhắc lại
Prompt caching Cache system prompt từ turn 2 → tiết kiệm ~90% token cost
🧩 Adaptive thinking Claude tự bật extended thinking khi câu hỏi phức tạp
🔁 Multi-turn tool loop Một lượt hỏi có thể gọi nhiều tool liên tiếp, tối đa 5 vòng
🔗 Google Flights link Mỗi kết quả vé kèm link tìm thêm trên Google Flights
🛡️ Private mode ALLOWED_USER_ID — chỉ bạn mới dùng được bot
🔄 Commands /start /reset /uptime
🏥 Health check HTTP endpoint cho Fly.io keepalive
🆕 Shopee cào giá 🔜
🔔 Auto-deal alert Notify khi giá rẻ hơn ngưỡng đặt 🔜
👥 Multi-user 🔜

🎬 Demo

👤: tìm vé SG Hà Nội thứ 7 tuần này

🤖: ✈️ Sài Gòn → Hà Nội
    📅 2026-05-16 → 2026-05-21 (5 chuyến)

    🏆 1,450,000đ 06:00→08:05 (2h5)
       `Vietjet Air VJ123` · *Thẳng*

    🥈 1,890,000đ 09:30→11:35 (2h5)
       `Bamboo Airways QH201` · *Thẳng*

    🥉 2,100,000đ 08:30→10:30 (2h0)
       `Vietnam Airlines VN123` · *Thẳng*

    [🔍 Xem thêm trên Google Flights](https://google.com/travel/flights?...)
👤: iPhone 16 giá bao nhiêu

🤖: 🛒 iPhone 16 (6 kết quả)

    🥇 *22,990,000đ* 🔥 — CellphoneS
       ⭐⭐⭐⭐ 4.8 (2,341 đánh giá)
       🔗 https://cellphones.com.vn/...

    🥈 *23,500,000đ* — Thế Giới Di Động
       ⭐⭐⭐⭐ 4.7 (1,890 đánh giá)

🧱 Tech stack

┌──────────────┐     ┌──────────────────────────┐     ┌──────────────────┐
│   Telegram   │ ←→  │     Claude Sonnet 4.6     │ ←→  │     SerpAPI      │
│     Bot      │     │  · Multi-turn tool loop   │     │  · Google Flights│
│              │     │  · Prompt caching         │     │  · Google Shopping│
│  /start      │     │  · Adaptive thinking      │     └──────────────────┘
│  /reset      │     │  · Session memory         │
│  /uptime     │     └──────────────────────────┘
└──────────────┘
                      ┌──────────────────────────┐
                      │      GitHub Actions       │
                      │  · 9AM daily monitor      │
                      │  · 4 tuyến bay cố định    │
                      └──────────────────────────┘
Thành phần Chi tiết
AI Claude Sonnet 4.6 — Anthropic API
Bot python-telegram-bot v20+
Search SerpAPI — Google Flights + Google Shopping
Host Fly.io free tier, region Singapore
Scheduler GitHub Actions cron, 9AM Vietnam (UTC+7)
Language Python 3.11+

🚀 Deploy trong 5 phút

1. Chuẩn bị API keys

Key Lấy ở đâu Free quota
TELEGRAM_TOKEN @BotFather/newbot Không giới hạn
ALLOWED_USER_ID @userinfobot/start
TELEGRAM_CHAT_ID Giống ALLOWED_USER_ID
ANTHROPIC_API_KEY console.anthropic.com $5 free credit
SERPAPI_KEY serpapi.com 250 req/tháng

2. Deploy lên Fly.io

git clone https://github.com/thaolst/tara-bot
cd tara-bot

fly auth login
fly launch --from Dockerfile --name tara-bot-yourname

fly secrets set \
  TELEGRAM_TOKEN=xxx \
  ANTHROPIC_API_KEY=xxx \
  SERPAPI_KEY=xxx \
  ALLOWED_USER_ID=xxx \
  TELEGRAM_CHAT_ID=xxx

fly deploy

3. Bật daily monitor

  • GitHub repo → Settings → Secrets → Actions → thêm 3 secrets: SERPAPI_KEY, TELEGRAM_TOKEN, TELEGRAM_CHAT_ID
  • Actions tabFlight Monitor → Enable workflow

Chi tiết đầy đủ: DEPLOY.md


⚙️ Cấu hình

Env var Bắt buộc Mô tả
ANTHROPIC_API_KEY Anthropic API key
TELEGRAM_TOKEN Telegram Bot token từ @BotFather
ALLOWED_USER_ID Telegram user ID — chỉ ID này mới dùng được bot
SERPAPI_KEY SerpAPI key cho Flights + Shopping
TELEGRAM_CHAT_ID Chat ID nhận daily monitor (thường = ALLOWED_USER_ID)
AFFILIATE_TEMPLATE Template URL affiliate (coming soon)

📁 Cấu trúc

tara-bot/
├── src/
│   ├── bot.py          # Telegram bot — polling, session, /start /reset /uptime
│   ├── agents.py       # Claude agent — tool loop, prompt caching, adaptive thinking
│   ├── config.py       # Env config loader
│   └── tools/
│       └── serpapi.py  # Flight search + Shopping search
├── scripts/
│   └── monitor.py      # Daily price check — chạy bởi GitHub Actions
├── .github/workflows/
│   └── monitor.yml     # Cron 9AM Vietnam daily
├── Dockerfile
├── fly.toml            # Fly.io config — region Singapore, 1GB RAM
├── DEPLOY.md
└── CHANGELOG.md

💰 Chi phí

Service Cost Ghi chú
Fly.io $0 Free tier đủ dùng
SerpAPI $0 250 req/tháng free
Anthropic ~$0.50/tháng Prompt caching giảm ~90% cost
GitHub Actions $0 Public repo free
Tổng ~$0.50/tháng

🗺️ Roadmap

  • Flight search — top 5 chuyến, compact format, Google Flights link
  • Shopping search — giá, rating, shop, link mua
  • Daily price monitor 9AM (GitHub Actions)
  • 24/7 bot trên Fly.io (Singapore)
  • Prompt caching — tiết kiệm token cost
  • Adaptive thinking — extended thinking tự động
  • Multi-turn tool loop (max 5 iter)
  • Private mode (ALLOWED_USER_ID)
  • /reset /uptime commands
  • Affiliate link injection đầy đủ
  • Shopee price scraper
  • Auto-deal alert (notify khi giá rẻ hơn ngưỡng)
  • Multi-user support

📝 License

MIT — free to use, fork, modify.


Tara Bot — build public để chia sẻ và học hỏi, không phải product thương mại.

About

Tara Bot — AI Telegram agent: search flights, compare prices, inject affiliate links

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages