In this tutorial, we’ll build a multi-agent system using OpenAI Swarm for AI-powered marketing strategies using Firecrawl for web scraping.
Agents
- User Interface: Manages user interactions
- Website Scraper: Extracts clean LLM-ready content via Firecrawl API
- Analyst: Provides marketing insights
- Campaign Idea: Generates marketing campaign concepts
- Copywriter: Creates compelling marketing copy
Requirements
Setup
-
Install the required packages:
pip install -r requirements.txt
-
Set up your environment variables in a
.env
file:OPENAI_API_KEY=your_openai_api_key FIRECRAWL_API_KEY=your_firecrawl_api_key
Usage
Run the main script to start the interactive demo:
python main.py
How it works
Our multi-agent system uses AI to create marketing strategies. Here’s a breakdown:
-
User Interface Agent:
- Talks to the user
- Asks for the website URL
- Can ask follow-up questions if needed
- Passes the URL to the Website Scraper Agent
-
Website Scraper Agent:
- Uses Firecrawl to get content from the website
- Asks for the content in markdown format
- Sends the cleaned-up content to the Analyst Agent
-
Analyst Agent:
- Looks at the website content
- Uses GPT-4o-mini to find key marketing insights
- Figures out things like target audience and business goals
- Passes these insights to the Campaign Idea Agent
-
Campaign Idea Agent:
- Takes the analysis and creates a marketing campaign idea
- Uses GPT-4o-mini to come up with something creative
- Considers the target audience and goals from the analysis
- Sends the campaign idea to the Copywriter Agent
-
Copywriter Agent:
- Gets the campaign idea
- Uses GPT-4o-mini to write catchy marketing copy
- Creates copy that fits the campaign idea and target audience
The OpenAI Swarm library manages how these agents work together. It makes sure information flows smoothly between agents and each agent does its job when it’s supposed to.
The whole process starts when a user enters a URL. The system then goes through each step, from scraping the website to writing copy. At the end, the user gets a full marketing strategy with analysis, campaign ideas, and copy.

data from the web