A multi-agent workflow that evaluates how well a product or brand is exposed on Perplexity AI.
Given a domain name, the system automatically:
- Researches the brand (web search + homepage scraping → LLM extraction)
- Generates realistic user prompts (user-configurable count) a real person might ask Perplexity
- Queries Perplexity with all prompts in parallel
- Produces a structured exposure report with metrics, examples, sources, and a narrative summary
The project includes a FastAPI backend and a minimalist React frontend.
graph TD
A[START] --> B[Brand Researcher]
B --> C[Prompt Generator]
C --> D[Perplexity Runner]
D --> E[Report Generator]
E --> F[END]
subgraph Details
B -- Firecrawl Search + Scrape --> B
C -- LLM Generates Prompts --> C
D -- Concurrent API Calls --> D
E -- Calculate Metrics --> E
end
- Python 3.11+
- Node.js 18+
- Poetry
-
Install dependencies:
poetry install
-
Configure Environment:
cp .env.example .env # Edit .env with your API keys (OPENAI_API_KEY, PERPLEXITY_API_KEY, FIRECRAWL_API_KEY) -
Run the Server:
poetry run uvicorn app.main:app --reload
The API will be available at
http://localhost:8000.
-
Navigate to frontend directory:
cd frontend -
Install dependencies:
npm install
-
Run the Development Server:
npm run dev
The UI will be available at
http://localhost:5173.
- Open the frontend at
http://localhost:5173. - Enter a domain name (e.g.,
perplexity.ai,linear.app). - Adjust the number of prompts to generate (1-20).
- Click Analyze Brand.
- View the report:
- Exposure Rate: Percentage of times the brand was mentioned.
- Summary: Qualitative analysis of the brand's presence.
- Examples: Detailed breakdown of prompts where the brand appeared vs. missed, including sources used by Perplexity.
| Variable | Description | Required |
|---|---|---|
OPENAI_API_KEY |
OpenAI API Key for GPT-4o. | ✅ |
FIRECRAWL_API_KEY |
Firecrawl API Key for web search & scraping. | ✅ |
PERPLEXITY_API_KEY |
Perplexity API Key for running queries. | ✅ |
LLM_MODEL |
LLM model name (default: gpt-4o). |
❌ |
LOG_LEVEL |
Logging level (default: INFO). |
❌ |
PERPLEXITY_MAX_WORKERS |
Max concurrent requests to Perplexity (default: 5). |
❌ |
WORKFLOW_TIMEOUT |
Max execution time in seconds (default: 300). |
❌ |
SUPABASE_URL |
Supabase Project URL. | ❌ |
SUPABASE_KEY |
Supabase Service Role Key (or Anon Key if configured). | ❌ |
POST /api/v1/evaluate: Run the full evaluation workflow.- Body:
{"domain": "example.com", "prompts_count": 5}
- Body:
GET /api/v1/health: Check API status.
-
Build the image:
docker build -t spoon . -
Run the container:
docker run -p 8000:8000 --env-file .env spoon
Run backend tests with:
poetry run pytest