Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

X Trends Agent - Built with CrewAI & Agent Stack SDK

Introduction

The X Trends Agent is an AI-powered conversational system designed to analyze trending topics on X (formerly Twitter). Built using the CrewAI framework for multi-agent orchestration and the Agent Stack SDK, it specializes in identifying trending topics by country, researching the context behind each trend, and providing friendly, engaging summaries with emojis and source citations.

The agent is designed to run entirely locally using Ollama and the IBM Granite 4 model.

Requirements

Minimum Requirements

  • Python: Version 3.11 or higher.
  • Dependency Management: uv is recommended for managing Python packages.
  • Ollama: Required for running the local LLM (granite4:tiny-h).

Main Dependencies

  • crewai: For agent-based orchestration of reasoning and tool use.
  • agentstack-sdk: For A2A protocol and server management.
  • requests: For direct web extraction.
  • duckduckgo-search: For context research.

Installation

  1. Clone the repository:

    git clone <repository-url>
    cd x_trends_agent_CrewAI
  2. Install dependencies:

    uv sync
  3. Install Ollama and the model:

    # Pull the required model
    ollama pull granite4:tiny-h

Running the Agent

  1. Start the agent server:
    uv run server
    The agent will start and register with the Agent Stack platform on http://127.0.0.1:8003 (default).

How It Works

The agent leverages a CrewAI Agent & Task system to process queries:

  1. Trend Extraction: The agent visits trends24.in/[country] to retrieve the top 5 trending topics.
  2. Context Research: For each of the top 5 trends, the agent performs specific searches (e.g., "Why is [Trend] trending?") using the XTrends Tool.
  3. Multi-Step Search: It uses the same tool to either fetch direct URL content or perform DuckDuckGo searches to find the "why" behind the trend.
  4. Friendly Synthesis: Generates a coherent report with emojis (💡, 📰, 🚀) and, most importantly, includes the source URLs of the context found.

Usage Examples

  • "What's trending in Mexico?"
  • "Show me trends in Spain"
  • "What is happening on X today?"

Project Structure

  • src/crewai_agents/agent.py: Main logic of the agent using CrewAI (Agent, Task, Crew) and Agent Stack.
  • pyproject.toml: Project configuration and dependencies.

Disclaimer

This agent is built for demonstration purposes. Ensure you have Ollama running locally at http://localhost:11434 for the LLM to function properly.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages