ScavioScavio
ProductPricingDocs
Sign InGet Started
  1. Home
  2. Tutorials
  3. How to Build a Link-Building Agent
Tutorial

How to Build a Link-Building Agent

Automate link-building prospecting with an agent that finds broken links, guest post targets, and unlinked brand mentions via Scavio SERP.

Get Free API KeyAPI Docs

Link building in 2026 is an agent problem, not a VA problem. This tutorial builds a link-building agent that finds three opportunity types nightly: broken link prospects, guest post targets, and unlinked brand mentions. All signals come from Scavio SERP.

Prerequisites

  • Python 3.10+
  • A Scavio API key
  • Your target keywords and brand name
  • An LLM credential for outreach draft

Walkthrough

Step 1: Find guest post targets

Search for 'write for us' on target topic blogs.

Python
import requests, os
API_KEY = os.environ['SCAVIO_API_KEY']

def guest_targets(topic):
    r = requests.post('https://api.scavio.dev/api/v1/search',
        headers={'x-api-key': API_KEY},
        json={'query': f'{topic} "write for us" OR "contribute"', 'num_results': 50})
    return r.json().get('organic_results', [])

Step 2: Find broken link opportunities

Search for 'resources' pages on target topic and check link health.

Python
def resource_pages(topic):
    r = requests.post('https://api.scavio.dev/api/v1/search',
        headers={'x-api-key': API_KEY},
        json={'query': f'{topic} "resources" OR "useful links"'})
    return r.json().get('organic_results', [])

Step 3: Find unlinked brand mentions

Search mentions of your brand that do not link back.

Python
def unlinked(brand):
    r = requests.post('https://api.scavio.dev/api/v1/search',
        headers={'x-api-key': API_KEY},
        json={'query': f'"{brand}" -site:{brand}.com'})
    return r.json().get('organic_results', [])

Step 4: Score each prospect

Authority signals from domain age, backlinks (inferred from SERP rank).

Python
def score(prospect):
    rank = prospect.get('position', 100)
    return max(0, 100 - rank)

Step 5: Draft outreach with an LLM

Feed prospect context to Claude for a personalized email.

Python
def draft(prospect):
    prompt = f'Write a 3-sentence outreach email to {prospect["link"]} about guest posting.'
    # call your LLM here
    return prompt

Python Example

Python
import os, requests

API_KEY = os.environ['SCAVIO_API_KEY']

def link_building(topic, brand):
    queries = [
        f'{topic} "write for us"',
        f'{topic} "resources" OR "useful links"',
        f'"{brand}" -site:{brand}.com'
    ]
    prospects = []
    for q in queries:
        r = requests.post('https://api.scavio.dev/api/v1/search',
            headers={'x-api-key': API_KEY}, json={'query': q, 'num_results': 20})
        prospects += r.json().get('organic_results', [])
    return prospects[:30]

print(len(link_building('ai agents', 'scavio')))

JavaScript Example

JavaScript
const API_KEY = process.env.SCAVIO_API_KEY;
export async function linkBuilding(topic, brand) {
  const queries = [
    `${topic} "write for us"`,
    `${topic} "resources"`,
    `"${brand}" -site:${brand}.com`
  ];
  const prospects = [];
  for (const q of queries) {
    const r = await fetch('https://api.scavio.dev/api/v1/search', {
      method: 'POST',
      headers: { 'x-api-key': API_KEY, 'Content-Type': 'application/json' },
      body: JSON.stringify({ query: q, num_results: 20 })
    });
    const d = await r.json();
    prospects.push(...(d.organic_results || []));
  }
  return prospects.slice(0, 30);
}

Expected Output

JSON
Nightly output of 30-60 link prospects categorized by type. Typical conversion: 3-8% reply rate with LLM-drafted personalized outreach.

Related Tutorials

  • How to Build an SEO Audit Tool with SERP and Competitor Analysis
  • How to Build an SDR Research Agent
  • How to Track SEO Rankings Daily with the Scavio API

Frequently Asked Questions

Most developers complete this tutorial in 15 to 30 minutes. You will need a Scavio API key (free tier works) and a working Python or JavaScript environment.

Python 3.10+. A Scavio API key. Your target keywords and brand name. An LLM credential for outreach draft. A Scavio API key gives you 50 free credits on signup.

Yes. The free tier includes 50 credits on signup, which is more than enough to complete this tutorial and prototype a working solution.

Scavio has a native LangChain package (langchain-scavio), an MCP server, and a plain REST API that works with any HTTP client. This tutorial uses the raw REST API, but you can adapt to your framework of choice.

Related Resources

Glossary

Link-Building Agent

Read more
Best Of

Best SEO Tools After Google I/O 2026

Read more
Use Case

Daily SEO Monitoring Agent

Read more
Best Of

Best API for Link-Building Agents in 2026

Read more
Use Case

Link Building Agent

Read more
Solution

Beginner AI Agent Stack (No-Code)

Read more

Start Building

Automate link-building prospecting with an agent that finds broken links, guest post targets, and unlinked brand mentions via Scavio SERP.

Get Free API KeyRead the Docs
ScavioScavio

Real-time search API for AI agents. Search every platform, not just Google.

Product

  • Features
  • Pricing
  • Dashboard
  • Affiliates

Developers

  • Documentation
  • API Reference
  • Quickstart
  • MCP Integration
  • Python SDK

Alternatives

  • Tavily Alternative
  • SerpAPI Alternative
  • Firecrawl Alternative
  • Exa Alternative

Tools

  • JSON Formatter
  • cURL to Code
  • Token Counter
  • All Tools

© 2026 Scavio. All rights reserved.

Featured on TAAFT
Terms of ServicePrivacy Policy