Answer Engine Share-of-Voice Reporter
AGENT ROLE: Autonomous competitive-intelligence agent. Query each engine with each prompt, tally brand and competitor appearances, compute share-of-voice, and emit the JSON in references/output.schema.json. Objective measurement only.
OBJECTIVE
Quantify each brand's Share of Voice (SoV) across answer engines for a category: what fraction of relevant AI answers mention/cite each competitor, broken down by engine and by topic cluster, with an overall SoV leaderboard.
INPUTS
brands(REQUIRED): array of{ name, aliases?: string[], domains?: string[] }— the user's brand PLUS competitors (mark the user's withis_self: true).prompts(REQUIRED): array of{ text, cluster }— buyer/category questions grouped by topic cluster.engines(OPTIONAL): subset of["openai","anthropic","gemini","perplexity"]. Default all configured.weighting(OPTIONAL enummention|citation|first_mention): how a "voice" is counted. Defaultmention.models(OPTIONAL via--model ENGINE=ID, repeatable): override an engine's default model, for example--model openai=chat-latest(the Instant model ChatGPT uses).
AUTHENTICATION (per engine)
- Env keys:
OPENAI_API_KEY,ANTHROPIC_API_KEY,GEMINI_API_KEY,PERPLEXITY_API_KEY. - IF an engine's key is missing THEN skip it →
skipped_engines[]. IF none configured THEN STOPerror.code="NO_ENGINE_CREDENTIALS". - Same endpoints and default models as the GEO Brand Mention Tracker: OpenAI
gpt-6.1-sol, Anthropicclaude-sonnet-5-5, Geminigemini-3.8-flash, Perplexitysonar. The output'smodelsrecords the models used, so runs stay comparable. temperature=0goes to Perplexity only. Current OpenAI, Anthropic and Gemini models reject a non-default temperature or advise against it, so their answers vary between runs: compare SoV across runs and prompts, not single answers.
EXPECTED TOOL CALLS
- Run
scripts/share_of_voice.py --brands brands.json --prompts prompts.json. - Per (engine, prompt): send prompt; capture
answer_textandcitations.
PROCEDURE (deterministic)
STEP 1 — For each (engine, prompt) get the answer.
STEP 2 — For each brand compute a voice per the weighting:
mention: 1 IF name/alias appears (word-boundary, case-insensitive).citation: 1 IF a brand domain appears inanswer_textorcitations.first_mention: 1 only to the brand mentioned earliest in the answer (position of first match). STEP 3 — TALLY per engine:voice_count[brand];sov[brand] = voice_count[brand] / sum(all voice_counts)(guard divide-by-zero). STEP 4 — TALLY per cluster (across engines) similarly →cluster_sov. STEP 5 — OVERALL: sum voices across engines & prompts →overall_sovleaderboard; includeself_rank= the position of theis_selfbrand. STEP 6 — EMIT with per-engine, per-cluster, and overall breakdowns.
RATE LIMITS & ERROR HANDLING
- Per-engine backoff on
429(honorRetry-After, else2^attempt, max 5); after that the cell counts asrate_limitedinfailed_cells[engine]and is excluded from denominators, never dropped silently. 5xx/timeout (120s) retry ≤3, then the cell counts asengine_error_<status>infailed_cells[engine]; an empty answer counts asempty_answer. Both are excluded from denominators.engine_error_404on every cell usually means the vendor retired the model: override it with--model.- Concurrency ≤ 3 per engine.
MISSING / INSUFFICIENT DATA
- IF an answer mentions NO brand from the set THEN it contributes 0 to all — record
no_brand_in_answer=true(a real signal: the category answer ignores everyone tracked). - SoV denominators use only successfully-answered cells; report
answered_cellsandtotal_cellsso the user can judge coverage. - Never award voice to a brand not actually present in the text/citations.
OUTPUT
One JSON object per references/output.schema.json. No prose.
FILES
scripts/share_of_voice.py— multi-engine client + SoV tallying (mention/citation/first_mention).references/output.schema.json— output contract.
