Ultron

AEO Tracker

Track how often your brand surfaces in answers from Perplexity, Gemini, ChatGPT, and Claude with mention rate, position, sentiment, and competitor data.

Next.jsTypeScriptCloudflare AI GatewayZod

Capabilities

Query 6 AI search engines through a single Cloudflare AI Gateway endpoint
Detect brand mentions, position, sentiment, and competitor co-occurrence
Build per-query and aggregate visibility reports with citations
Alert when a competitor overtakes the brand on a tracked query
System Prompt
You are an Answer Engine Optimization (AEO) analyst. You measure brand visibility across AI search engines and tell the user how to improve it.

WORKFLOW:
1. Call query_ai_engine for each (provider, query) pair the user wants tracked.
2. For each raw response, call detect_mention to extract mention rate, position, sentiment, competitors mentioned, and citations.
3. Aggregate results with build_report into a structured visibility scorecard.
4. If a competitor overtakes the user's brand on a tracked query, call send_alert.

RULES:
- Always run queries through Cloudflare AI Gateway, never the provider directly.
- Cache by (provider, query) for 24h to control cost.
- Report mention rate as a percentage rounded to one decimal.
- When sentiment is mixed, classify as "neutral" rather than guessing.
- Never claim a brand is "winning" without comparing against at least 3 competitors.
Agent Source
import { agent, tool } from "@agent-sdk"
import { z } from "zod"

const queryEngineInput = z.object({
  provider: z.enum(["perplexity", "gemini", "deepseek", "openai", "anthropic", "grok"]),
  query: z.string().min(5).max(300),
})

const detectMentionInput = z.object({
  raw: z.string(),
  brand: z.string(),
  competitors: z.array(z.string()).default([]),
})

export default agent({
  model: "claude-sonnet-4-6",
  permissionMode: "bypassPermissions",
  maxTurns: 30,
  systemPrompt: `...`, // see System Prompt section above
  tools: {
    query_ai_engine: tool({
      description: "Run a query against an AI search engine via CF AI Gateway",
      inputSchema: queryEngineInput,
      execute: async ({ provider, query }) => {
        const url = `https://gateway.ai.cloudflare.com/v1/${process.env.CF_ACCOUNT_ID}/${process.env.CF_GATEWAY_ID}/${provider}/chat/completions`
        // POST { model, messages: [{ role: "user", content: query }] }
      },
    }),
    detect_mention: tool({
      description: "Extract brand mention metadata from a raw model response",
      inputSchema: detectMentionInput,
      execute: async ({ raw, brand, competitors }) => {
        // returns { mentioned, position, sentiment, competitorsMentioned, citations }
      },
    }),
    build_report: tool({
      description: "Aggregate detections into a visibility scorecard",
      inputSchema: z.object({ runs: z.array(z.any()) }),
      execute: async ({ runs }) => {
        // returns { mentionRate, avgPosition, sentimentBreakdown, competitorMatrix }
      },
    }),
    send_alert: tool({
      description: "Send alert when a competitor overtakes the brand",
      inputSchema: z.object({ text: z.string() }),
      execute: async ({ text }) => {
        // POST to ALERT_WEBHOOK_URL
      },
    }),
  },
})

File Structure

agents/
aeo-tracker.ts
lib/aeo/
providers.ts
mention-detector.ts
report.ts
app/api/aeo/
route.ts
Setup
$ npm install
$ cp .env.example .env.local
# Provision a Cloudflare AI Gateway, paste account ID and gateway ID
# Add provider API keys (Perplexity, Gemini, DeepSeek minimum)
$ npm run dev

Environment Variables

CF_ACCOUNT_IDCloudflare account ID
CF_GATEWAY_IDCloudflare AI Gateway slug
PERPLEXITY_API_KEYPerplexity API key (sonar models)
GOOGLE_GENAI_KEYGoogle AI Studio key for Gemini

Sell This Agent

AI search now drives 30% of brand discovery and nobody is measuring it. AEO tracking is the new SEO console — first mover advantage is real.

Setup fee
$3,500
Monthly retainer
$500/mo
Target marketB2B SaaS, Agencies, Content brands

Included

Full agent source code
Provider clients via AI Gateway
Mention detection logic
Connect to Ultron pipelineUnlock
Weekly auto-refresh + email digestUnlock
Turn views into income.Drop your video link, get paid as the view count climbs.
Submit a video