Skip to content

Repository files navigation

competitor-intel

Daily competitor intelligence agent for ProAgentStore. Monitors a list of competitor URLs, detects content changes, and generates AI-written reports with trend analysis.

How it works

  1. Cron fires at 07:00 UTC every day
  2. For each configured competitor URL, the agent fetches the page and strips HTML
  3. Content is SHA-256 hashed and compared to the previous snapshot stored in the Durable Object
  4. When a change is detected, Workers AI (llama-3.3-70b) writes a 2-4 sentence change summary
  5. After all competitors are checked, AI writes an executive briefing covering all changes
  6. The full report (summary + per-competitor items) is saved in the DO, keeping the last 90 days

API

All write endpoints require Authorization: Bearer <ADMIN_TOKEN>. Reads are public.

MethodPathAuthDescription
POST/competitorsyesAdd a competitor URL
DELETE/competitors/:idyesRemove a competitor
GET/competitorsnoList all competitors
GET/reportsnoList report summaries (latest first, ?limit=N)
GET/reports/latestnoFull latest report with per-competitor items

Add a competitor

curl -X POST https://competitor-intel.proagentstore.online/competitors \
-H "Authorization: Bearer $ADMIN_TOKEN" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com", "label": "Example Co"}'

Get the latest report

curl https://competitor-intel.proagentstore.online/reports/latest

Setup

1. Create the Worker

pnpm install
wrangler deploy

2. Set secrets

wrangler secret put ADMIN_TOKEN
# then add to Doppler project pags:
doppler secrets set ADMIN_TOKEN=<value> --project pags --config prd

3. Add competitors via the API

Use the POST /competitors endpoint above. The cron runs automatically at 07:00 UTC.

Local dev

pnpm dev
# Trigger the cron manually:
curl "http://localhost:8787/__scheduled?cron=0+7+*+*+*"

Bindings

BindingTypePurpose
AIWorkers AIChange summaries + executive briefings
INTELDurable ObjectCompetitor list, hash state, snapshots, reports

Data model (DO storage keys)

KeyValueDescription
competitorsCompetitor[]All configured competitors
state:<id>CompetitorStateHash + fetch/change timestamps per competitor
snap:<id>string (truncated at 50KB)Previous text snapshot for AI diffing
report:<iso-ts>ReportEntryFull report; last 90 retained

About

Tracks competitor websites daily. Fetches configured URLs, detects content changes via hashing, and generates AI intelligence reports with trend analysis stored in a Durable Object.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages