Skip to main content
The Media Trend Analysis Agent Example demonstrates a sophisticated AI-powered tool designed to analyze media trends, track digital conversations, and provide actionable insights across various online platforms. This agent combines web search capabilities with content scraping to deliver comprehensive trend analysis reports.

What It Does

This agent specializes in:
  • Trend Identification: Detects emerging patterns and shifts in media coverage
  • Source Analysis: Identifies key influencers and authoritative sources
  • Data Extraction: Gathers information from news sites, social platforms, and digital media
  • Insight Generation: Provides actionable recommendations based on trend analysis
  • Future Forecasting: Predicts potential developments based on current patterns

Key Features

  • Multi-Source Analysis: Combines Exa search tools with Firecrawl scraping capabilities
  • Intelligent Filtering: Uses keyword-based searches with date filtering for relevant results
  • Smart Scraping: Only scrapes content when search results are insufficient
  • Structured Reporting: Generates comprehensive markdown reports with executive summaries
  • Real-time Data: Analyzes current trends with configurable time windows

Code

cookbook/examples/agents/media_trend_analysis_agent.py

Usage

1

Create a virtual environment

Open the Terminal and create a python virtual environment.
2

Set your API key

3

Install libraries

4

Run Agent

Customization Options

You can customize the agent’s behavior by:
  • Adjusting Time Windows: Modify the calculate_start_date() function to analyze different time periods
  • Adding Sources: Include additional websites or platforms in your analysis prompts
  • Modifying Keywords: Change search terms to focus on specific topics or industries
  • Customizing Output: Modify the expected_output template to match your reporting needs

Example Prompts

Here are some additional prompt examples you can try: