Skip to content

unRekable/Autonomous-Reddit-Agent

Repository files navigation

Autonomous Reddit Agent v2.4

Welcome to the Autonomous Reddit Agent v2.4, a highly sophisticated, strategy-driven bot engineered for intelligent, adaptive, and stealthy interaction on Reddit. Powered by Google's Gemini API and built upon a robust, modular Python architecture, this agent transcends basic automation. It's designed to learn, adapt its communication style, proactively engage with relevant content, and even manage its own knowledge base for nuanced, value-driven interactions.

Version 2.4 introduces a dynamic "Burst Mode" for more human-like activity patterns and integrates a real-time cryptocurrency price API (CoinGecko) to enhance the contextual relevance of its AI-generated content in financial discussions.

How It Works: The Agent's Approach to Reddit

The Autonomous Reddit Agent operates in cycles, making strategic decisions to engage with Reddit communities effectively and naturally:

  1. Operational Cycle & Action Selection:

    • The bot starts an operational cycle, selecting a Reddit account from its configured list.
    • Burst Mode Check: It first determines if the current cycle will be a "Burst Mode" session based on a configurable probability (BURST_MODE_PROBABILITY).
      • If Burst Mode: The bot will attempt a series of actions (up to ACTIONS_PER_BURST) with shorter, randomized cooldowns between each action within the burst. This simulates periods of higher user activity.
      • If Normal Mode: The bot chooses a primary action (like commenting, creating a new post, or deploying knowledge) based on pre-configured probabilities (ACTION_WEIGHTS).
    • Fallback Logic: In a normal cycle, if the primary chosen action doesn't result in a productive outcome (e.g., no suitable post found), the bot attempts a secondary, different action before initiating its main cooldown.
  2. Intelligent Content Engagement (Commenting & Knowledge Deployment):

    • Finding the Right Conversation: The bot identifies relevant discussions by either scanning "hot" posts in target subreddits or by proactively searching across Reddit for specific keywords related to its "Knowledge Base" topics. This allows it to join new trends or contribute to existing, relevant conversations.
    • Contextual Understanding & Rule Adherence: Before engaging, it assesses the thread's sentiment (avoiding undesirable discussions if configured via the Sentiment Guardrail) and considers subreddit-specific rules (like link permissions or active_hours_utc).
    • Persona-Driven Communication: The bot adopts a suitable "Persona" (e.g., expert, enthusiast, crypto_analyst) tailored to the subreddit's culture.
    • Real-Time Data Integration (Crypto Prices): If the discussion context (topics, keywords) suggests a cryptocurrency theme, the bot can fetch live price data from the configured API (e.g., CoinGecko) for relevant coins. This data is then provided to the AI.
    • Value-First AI Content Generation: Using the Gemini API, it generates a genuine, insightful, and contextually relevant comment that adds value. If live crypto prices were fetched, the AI is subtly guided to incorporate this information naturally.
    • Subtle Resource Sharing (Postscript): If the bot has relevant information in its "Knowledge Base" (knowledge.json) and the AI determines it would be a valuable, non-spammy addition to the generated comment (and links are permitted), it may append this resource as a helpful "P.S."
  3. Proactive Thread Creation: The bot can create new posts, either autonomously (AI generates topic/content based on trends and persona, potentially using live crypto data) or from predefined templates.

  4. Conversational Engagement (Bundled Replies): After successfully posting a comment or creating a thread, the bot will, after a short delay, check for any immediate replies to its recent activity. If replies are found, it uses its AI and persona to formulate and post natural-sounding responses.

  5. Human-like Behavior & Cooldown: Throughout its operations, the bot incorporates randomized delays, mimics real browser user-agents, and adheres to a single top-level comment per thread. After a normal cycle or a full burst session, it enters a longer, randomized cooldown period.

This strategic, multi-layered approach, now enhanced with burst activity and real-time data, allows the bot to build karma, engage authentically, and subtly share information with even greater relevance.

Key Features (v2.4)

🧠 Strategy & Intelligence

  • Autonomous Topic Discovery: Dynamically identifies trending topics.
  • Dynamic Persona Engine: Adapts communication style per subreddit.
  • Advanced Sentiment Guardrail: Pre-scans threads, with per-subreddit overrides and "Intelligent Contrarian" capability.
  • Targeted Knowledge Deployment: Proactively searches Reddit for relevant discussions to place "Knowledge Base" content.
  • Value-First Promotion: Integrates external links organically as helpful postscripts.
  • Intelligent Thread Creation: Generates new threads autonomously or from templates.
  • NEW: Real-Time Crypto Price Integration: Fetches live crypto prices (e.g., via CoinGecko) to inform AI content generation for relevant discussions.

🤫 Stealth & Humanization

  • Bundled Conversational Reply-Chains: Checks for and responds to replies immediately after its own successful actions.
  • NEW: Burst Mode Operation: Simulates periods of higher user activity by performing multiple actions with shorter internal cooldowns, based on a configurable probability.
  • Dynamic & Variable Timings: Employs randomized main cooldowns, reading delays, and intra-burst delays.
  • Realistic User-Agents: Configurable to use random or a fixed user-agent.
  • Single Top-Level Comment per Thread: Prevents spammy behavior.

⚙️ Architecture & Control

  • Database-Powered Memory (SQLite): Logs all interactions and application events.
  • Modular src Structure: Clean separation of concerns.
  • Secure Configuration: Uses config.py.example and .gitignore.
  • Robust Logging System: DB-based with optional Discord forwarding.
  • Action Fallback Logic: Attempts a secondary action if the primary one is unproductive in a normal cycle.
  • Flexible Per-Subreddit Rule Engine: Configure can_create_new_posts, allow_external_links, active_hours_utc, sentiment overrides, etc.

Possibilities & Use Cases

The Autonomous Reddit Agent v2.4 is a versatile platform capable of:

  • Highly Contextual Content Marketing: Introduce articles or project information into discussions with enhanced relevance, especially in financial/crypto topics, by leveraging real-time data.
  • Dynamic Community Engagement: Build reputation through authentic interactions, now with more varied activity patterns due to Burst Mode.
  • Automated, Informed Information Dissemination: Share specific, data-enhanced information where it's most impactful.
  • Adaptive Brand Monitoring: Engage with brand mentions using up-to-date context.
  • Sophisticated Social Media Experiments: Test diverse strategies with varying activity levels and data integration.

Utility Scripts

  • scripts/research_assistant.py: AI-powered tool to generate structured JSON entries for knowledge.json from topics, URLs, and text.
  • scripts/db_analyzer.py: Connects to bot_data.db to generate various statistics on bot activity and performance.
  • scripts/db_backup.py: Creates timestamped backups of the bot_data.db file.
  • scripts/knowledge_validator.py: Checks the structural integrity of your knowledge.json file.
  • log_forwarder.py: Database-driven script to monitor logs and forward them to a Discord webhook.

Project Structure

reddit-bot/
├── .gitignore
├── config.py.example     # Configuration template (RENAME to config.py)
├── knowledge.json        # Bot's knowledge base for promotional content
├── main.py               # Application entry point
├── log_forwarder.py      # Optional: Forwards DB logs to Discord
├── requirements.txt
├── scripts/
│   ├── research_assistant.py
│   ├── db_analyzer.py
│   ├── db_backup.py
│   └── knowledge_validator.py
└── src/
    ├── bot/
    │   └── controller.py
    ├── services/
    │   ├── gemini_client.py
    │   └── crypto_price_client.py # New
    ├── database/
    │   └── manager.py
    └── utils/
        └── logger.py

Setup & Installation

  1. Clone/Download: Get the project files.
  2. Virtual Environment (Recommended):
    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  3. Install Dependencies:
    pip install -r requirements.txt
  4. Configure:
    • Copy config.py.example to config.py.
    • Edit config.py with your API keys, Reddit account(s), Discord webhook (optional), and desired strategies (including new Burst Mode and Crypto Price API settings).
  5. Knowledge Base: Create/edit knowledge.json (use research_assistant.py for help).

Running the Bot

  1. Main Bot:
    python main.py
  2. Optional Discord Log Forwarder (in a second terminal):
    python log_forwarder.py

Disclaimer

This application is intended for educational and experimental purposes only. Automating Reddit accounts can be against Reddit's Terms of Service and specific subreddit rules. Use this tool responsibly, ethically, and at your own risk. The developer assumes no liability for any consequences arising from the use or misuse of this software, including but not limited to account suspension or banning. Always respect the communities you interact with and ensure any financial information discussed by the bot (even with API integration) is not construed as financial advice.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages