Here is the text format for your project story, ready to copy and paste directly into your submission form:

Inspiration

In the fast-paced world of social media, a single negative tweet or Reddit thread can spiral into a PR crisis before a support team even logs in for the day. I noticed that many customer support teams are stuck in a reactive loop—waiting for a ticket to be filed while the conversation online has already turned toxic.

I wanted to build something proactive.

I asked myself: What if an intelligent agent could listen to the internet 24/7, understand the emotion behind the words, and tap a support agent on the shoulder only when it really matters?

That was the birth of Agent Saad—an automated sentinel designed to filter the noise and surface critical customer sentiment in real-time.

What it does

Agent Saad is an autonomous AI agent that continuously monitors social media platforms (currently Twitter/X and Reddit) for brand mentions. Instead of just looking for keywords, it uses natural language processing to understand the sentiment behind the text.

Here is the core workflow:

  1. Listens: It scans for brand keywords across multiple platforms simultaneously.
  2. Analyzes: It runs every post through a fine-tuned AI model to detect negativity.
  3. Prioritizes: It calculates an "Urgency Score" based on sentiment intensity and viral potential (engagement).
  4. Alerts: If a post is critical, it instantly notifies the team via Slack and Email with a recommended response strategy.
  5. Visualizes: It aggregates all data into a live, dark-mode dashboard for trend analysis.

How we built it

We approached this as a full-stack engineering challenge with a heavy emphasis on efficient AI integration.

The Stack

  • Core: Python 3.8+ and Flask 3.0
  • AI/ML: Hugging Face Transformers (PyTorch)
  • Data: SQLite
  • Frontend: Vanilla JavaScript (ES6+) and CSS3 variables

The Architecture

We designed a modular system with three distinct layers:

  1. Monitors: Specialized classes (TwitterMonitor, RedditMonitor) handle API authentication and pagination.
  2. The Brain: We leveraged transfer learning, using the DistilBERT model fine-tuned on the SST-2 dataset. This allows us to get state-of-the-art accuracy without the massive compute cost of larger LLMs.
  3. The Nervous System: An alerting engine that routes notifications based on priority.

The Math Behind the Magic

To filter noise, we implemented a custom heuristic for Urgency.

$$ Urgency(s, e) = \begin{cases} \text{CRITICAL} & \text{if } s \leq -0.7 \text{ and } e > 100 \ \text{HIGH} & \text{if } s \leq -0.3 \text{ and } e > 50 \ \text{MEDIUM} & \text{if } s \leq -0.3 \ \text{LOW} & \text{otherwise} \end{cases} $$

Where $s$ is the normalized sentiment score ($-1.0$ to $+1.0$) and $e$ is the engagement metric (likes + retweets + comments).

Challenges we ran into

1. API Rate Limits & Scheduling

Social media APIs are strict. We couldn't just hammer the endpoints continuously.

  • Solution: We implemented APScheduler to orchestrate background jobs. This allowed us to decouple the data fetching from the user interface, ensuring the dashboard remains responsive even when the backend is waiting on API rate limits.

2. Contextual Recommendations

Detecting a negative post is useful, but suggesting what to do is better. A generic AI model doesn't know company policy.

  • Solution: We built a hybrid rule-based engine on top of the AI layer. By scanning for semantic triggers like "bug," "refund," or "slow," the agent categorizes the issue and generates specific advice (e.g., "Escalate to Engineering" vs. "Offer Refund").

3. Frontend Real-Time State

We wanted a dashboard that felt alive without the overhead of a heavy SPA framework like React or Vue.

  • Solution: We utilized modern Vanilla JS with a robust polling mechanism and CSS animations. This kept the deployment footprint small while still providing that "command center" feel.

Accomplishments that we're proud of

  • Efficient AI Inference: We managed to get inference times down to ~100ms on a standard CPU, meaning Agent Saad doesn't require expensive GPUs to run.
  • The Urgency Algorithm: It successfully differentiates between a grumpy user with 0 followers and a viral complaint, solving the "alert fatigue" problem common in monitoring tools.
  • Clean Architecture: The codebase is highly modular. Adding a new platform like Discord or Instagram is as simple as extending a base Monitor class.

What we learned

  • AI is a component, not the product: The DistilBERT model is powerful, but it's the wrapper—the database caching, the retry logic, the alert routing, and the user interface—that turns a raw model into a useful product.
  • Thread Safety Matters: Managing SQLite connections across Flask requests and background scheduler threads was tricky. We learned to be meticulous about closing connections and using thread-local storage.
  • The Power of Transfer Learning: We didn't need to reinvent the wheel. Fine-tuned small models often outperform zero-shot large models for specific classification tasks like this.

Built With

Share this project:

Updates