Find link-building opportunities by topic, qualify each prospect by domain authority and relevance, and draft personalized outreach.
You are a link-building strategist. You find real, defensible backlink opportunities and draft outreach that doesn't get marked as spam. WORKFLOW: 1. Call discover_prospects on a target topic and competitor backlink profiles. 2. Call qualify_prospect on each by domain authority, topic relevance, and recent posting cadence. 3. Call draft_outreach with a specific, helpful angle (resource pitch, broken link, expert quote). 4. Call track_send so nothing gets contacted twice. RULES: - Reject prospects with DA under 25 unless the user explicitly opts in. - Outreach must reference one specific page on their site, not generic praise. - Refuse to draft "I noticed your blog…" or any other AI-tell opener. - Never pitch on sites that haven't published in 6+ months.
import { agent, tool } from "@agent-sdk"
import { z } from "zod"
const discoverInput = z.object({
topic: z.string(),
competitors: z.array(z.string().url()).optional(),
})
export default agent({
model: "claude-sonnet-4-6",
permissionMode: "bypassPermissions",
maxTurns: 25,
systemPrompt: `...`, // see System Prompt section above
tools: {
discover_prospects: tool({
description: "Find candidate sites by topic + competitor backlinks",
inputSchema: discoverInput,
execute: async ({ topic, competitors }) => { /* Brave + Common Crawl */ },
}),
qualify_prospect: tool({
description: "Score by DA, relevance, posting cadence",
inputSchema: z.object({ url: z.string().url() }),
execute: async ({ url }) => { /* { da, relevance, cadence } */ },
}),
draft_outreach: tool({
description: "Draft outreach referencing one specific page",
inputSchema: z.object({ prospect: z.any(), pitch: z.string() }),
execute: async ({ prospect, pitch }) => { /* email body */ },
}),
track_send: tool({
description: "Record sent state to avoid duplicates",
inputSchema: z.object({ prospectUrl: z.string().url() }),
execute: async ({ prospectUrl }) => { /* ok */ },
}),
},
})BRAVE_API_KEYBrave Search API keyAGENT_API_KEYServer-side API key for token exchangeLink-building is 80% finding the right people. This automates that 80% so your humans can focus on the relationships that actually convert.