Skip to Content
AgentsAgents — Master Index

Agents — Master Index

Leadmetrics v3 uses a single-function agent design: every agent does exactly one thing, has one input schema, one output schema, and one system prompt short enough to fit on a page. The Activity Planner chains them into pipelines. Agents stay small and testable.


Architecture at a Glance

SETUP CHAIN (once per tenant) Client Researcher ──┐ ├──► Context File Writer ──► Client Context File Competitor Researcher ──┘ STRATEGY CHAIN (once, on context approval) Strategy Writer ──► Deliverable Planner ──► Goals + Monthly Plan ORCHESTRATION (each deliverable period) Activity Planner ──► dispatches tasks to workers below SEO CHAIN Keyword Researcher ──► Content Brief Writer Site Auditor Backlink Researcher ──► Backlink Outreach Writer CONTENT CHAIN Blog Writer · GBP Post Writer · Social Post Writer Email Writer · Landing Page Writer Google Ads Writer · Meta Ads Writer Content Repurposer · Blog Image Generator PLANNING & ANALYSIS Social Calendar Planner · Ads Analyst Report Writer · Anomaly Detector RESEARCH (Ollama/local — cost-free) Topic Researcher ──► Research Note Writer CONTENT QUALITY Content Auditor REACTIVE (event-triggered) Review Response Writer SYSTEM / LIVE Blog AI Agent · Billing Agent

Agent Index

Setup Chain

AgentDocInput → OutputQueueModelPlan
Client Researcherclient-researcher.mdDomain URL → client research notesagent__client-researcherSonnet 4.6Free+
Competitor Researchercompetitor-researcher.mdCompetitor domains → competitor analysisagent__competitor-researcherSonnet 4.6Free+
Context File Writercontext-file-writer.mdResearch notes → Client Context Fileagent__context-file-writerSonnet 4.6Free+

Strategy Chain

AgentDocInput → OutputQueueModelPlan
Strategy Writerstrategy-writer.mdContext File → strategy documentagent__strategy-writerSonnet 4.6Free+
Deliverable Plannerdeliverable-planner/index.mdStrategy → goals + deliverable volumesagent__deliverable-plannerSonnet 4.6Free+

Orchestration

AgentDocInput → OutputQueueModelPlan
Activity Planneractivity-planner/index.mdDeliverable plan → activity pipelineagent__activity-plannerSonnet 4.6Free+

SEO Chain

AgentDocInput → OutputQueueModelPlan
Keyword Researcherkeyword-researcher.mdDomain/industry → keyword clustersagent__keyword-researcherSonnet 4.6Free+
Content Brief Writercontent-brief-writer.mdKeyword cluster → SEO content briefagent__content-brief-writerSonnet 4.6Free+
Site Auditorsite-auditor.mdDomain URL → technical SEO audit reportagent__site-auditorSonnet 4.6Pro+
SEO OptimizerBlog post → 10-dim SEO score + AEO recommendationsagent__seo-optimizerSonnet 4.6Pro+
Backlink Researcherbacklink-researcher.mdNiche + existing links → prospect listagent__backlink-researcherSonnet 4.6Pro+
Backlink Outreach Writerbacklink-outreach-writer.mdSingle prospect → outreach emailagent__backlink-outreach-writerSonnet 4.6Pro+
Directory SubmitterBacklink opportunity → Playwright form submissionagent__directory-submitterPlaywrightPro+

Content Chain

AgentDocInput → OutputQueueModelPlan
Blog Writerblog-writer.mdSEO brief → full blog postagent__blog-writerSonnet 4.6Free+
GBP Post Writergbp-post-writer.mdBusiness info + topic → GBP postagent__gbp-post-writerSonnet 4.6Free+
Social Post Writersocial-post-writer.mdPlatform + brief → single postagent__social-post-writerSonnet 4.6Pro+
Email Writeremail-writer.mdCampaign brief → email newsletteragent__email-writerSonnet 4.6Pro+
Landing Page Writerlanding-page-writer.mdProduct brief → landing page copyagent__landing-page-writerSonnet 4.6Pro+
Google Ads Writergoogle-ads-writer.mdCampaign + keywords → RSA copy setagent__google-ads-writerSonnet 4.6Pro+
Meta Ads Writermeta-ads-writer.mdCampaign + audience → ad copy variantsagent__meta-ads-writerSonnet 4.6Pro+
Content Repurposercontent-repurposer.mdApproved content → derivative formats (social, email, ad copy, thread, carousel, landing page)agent__content-repurposerSonnet 4.6Pro+
Blog Image Generatorblog-image-generator.mdPost title + brand colours → hero/inline imagesagent__blog-image-generatorAzure GPT ImagePro+

Planning, Analysis & Reporting

AgentDocInput → OutputQueueModelPlan
Social Calendar Plannersocial-calendar-planner.mdStrategy + platforms → monthly calendaragent__social-calendar-plannerSonnet 4.6Pro+
Ads Analystads-analyst.mdAds performance data → analysis reportagent__ads-analystSonnet 4.6Pro+
Report Writerreport-writer.mdAll channel data + goals → monthly reportagent__report-writerSonnet 4.6Pro+
Custom Report WriterOn-demand user prompt → structured natural-language reportagent__custom-report-writerSonnet 4.6Pro+
Anomaly Detectoranomaly-detector.mdMetrics vs prior period → alertsagent__anomaly-detectorHaiku 4.5Pro+

Research (Ollama/local)

AgentDocInput → OutputQueueModelPlan
Topic Researchertopic-researcher.mdIndustry + recent topics → topic ideasagent__topic-researchergemma3:4bAgency+
Research Note Writerresearch-note-writer.mdTopic → stats + citations + notesagent__research-note-writergemma3:4bAgency+

Content Quality

AgentDocInput → OutputQueueModelPlan
Content Auditorcontent-auditor.mdPublished blog post → health score + refresh contextagent__content-auditorSonnet 4.6Pro+

Reactive

AgentDocInput → OutputQueueModelPlan
Review Response Writerreview-response-writer.mdSingle review → draft responseagent__review-response-writerSonnet 4.6Pro+

System Agents (Live)

AgentDocTrigger
Blog AI AgentNew BlogRequest record
Billing AgentBilling event

Runtime — Where Agents Run

All agents run as BullMQ workers inside a dedicated background process: apps/servers/agents.

[API / Next.js] ──enqueue job──► [Redis / BullMQ queue] [apps/servers/agents polls] [picks up job → calls adapter] [adapter spawns LLM subprocess] [result written back to DB]

Entry point: apps/servers/agents/src/index.ts

To start in dev:

cd apps/servers/agents && pnpm dev

Worker files (in packages/agents/src/workers/):

Worker fileAgents handled
setup.worker.tsclient-researcher → competitor-researcher → context-file-writer
strategy.worker.tsdeliverable-planner
activity.worker.tsactivity-planner
strategy-writer.worker.tsstrategy-writer
blog-writer.worker.tsblog-writer
blog-faq-writer.worker.tsblog-faq-writer (sub-step, no AgentConfig)
content.worker.tsgbp-post-writer, email-writer, and other content agents (generic dispatcher)
content-repurposer.worker.tscontent-repurposer
social-post-writer.worker.tssocial-post-writer
landing-page-writer.worker.tslanding-page-writer
backlink-outreach-writer.worker.tsbacklink-outreach-writer
directory-submitter.worker.tsdirectory-submitter (Playwright, no LLM)
seo-optimizer.worker.tsseo-optimizer (Anthropic SDK direct)
custom-report-writer.worker.tscustom-report-writer
performance-report-writer.worker.tsperformance-report-writer
website-crawler.worker.tswebsite-crawler (SEO/audit crawler)
tenant-website-crawler.worker.tstenant-web-crawler (tenant own-site → RAG ingestion)
opportunity-matcher.worker.tsopportunity-matcher
ai-visibility-seeder.worker.tsai-visibility-seeder
search-term-classifier.worker.tssearch-term-classifier
linkedin-ads-optimizer.worker.tslinkedin-ads-optimizer
meta-ads-optimizer.worker.tsmeta-ads-optimizer
insights/insight-worker-base.tsshared base for all 8 channel insight workers
insights/channel-score-explainer.worker.tschannel-score-explainer (no AgentConfig)
Infrastructure (no LLM, no AgentConfig)
rag-ingestion.worker.tsQdrant document ingestion
social-publisher.worker.tsSocial API publishing
newsletter-sender.worker.tsEmail sending via Resend
github-source-sync.worker.tsGitHub repo → RAG sync
search-term-sync.worker.tsGoogle Ads search term pull
tenant-delete.worker.tsMulti-step tenant deletion

Scaling: queues are shared across all tenants. Run multiple replicas of the server-agents container in production — BullMQ distributes jobs across all active instances automatically.

Agent Event Protocol (Apr 2026)

Every worker emits agent:started and agent:completed (or agent:failed) events via publishAgentEvent. These are persisted to the AgentRun DB table and broadcast via Redis pub/sub to the manage portal’s Execution Queue dashboard.

agent:started must include:

inputPrompt: prompt, // full prompt string

agent:completed must include:

inputTokens: result.usage?.inputTokens, // nested under .usage — NOT result.inputTokens outputTokens: result.usage?.outputTokens, transcript: result.transcript, // full AdapterExecutionResult transcript array

The transcript field captures every turn of the Claude Code session (assistant messages, tool_use, tool_result, system, user, error). All LLM-calling workers emit this as of Apr 2026. Runs before that date have transcript: null in the DB.


Standard Agent Doc Structure

Every agent doc follows the same sections:

  1. Overview — function, type, model, queue, cost, plan, status
  2. Input — TypeScript interface + field descriptions
  3. Output — TypeScript interface + sample output
  4. How It Works — numbered steps
  5. System Prompt — the actual prompt used
  6. Skills Injected — which skill files + their content
  7. Tools Required — external APIs and methods
  8. HITL Gates — where human review happens
  9. Guardrails — output validators
  10. Cost Profile — token estimates
  11. Error Handling — failure modes and responses

Superseded Agents — Replacement Map

The old multi-function agents have been deleted. For reference, here is how they mapped to the new single-function agents:

Old agent (deleted)Replaced by
Onboarding AgentClient Researcher + Competitor Researcher + Context File Writer
Strategy AgentStrategy Writer + Deliverable Planner
SEO SpecialistKeyword Researcher + Content Brief Writer + Site Auditor + Backlink Researcher
CopywriterBlog Writer + GBP Post Writer + Social Post Writer + Email Writer + Landing Page Writer
Social Media ManagerSocial Calendar Planner + Social Post Writer
Paid Ads ManagerGoogle Ads Writer + Meta Ads Writer + Ads Analyst
Data AnalystReport Writer + Anomaly Detector
Content ResearcherTopic Researcher + Research Note Writer
Review & Reputation AgentReview Response Writer

© 2026 Leadmetrics — Internal use only