agentsb2bresearch

Pain-Scanning Pipelines: Finding B2B Problems from Court Filings

Using search APIs to build automated pipelines that discover B2B pain points from public court filings and news sources.

8 min read

The best B2B opportunities come from real problems, not market reports. Companies that are being sued, fined, or publicly criticized have urgent, budget-backed problems they need to solve. Court filings, regulatory actions, and news articles about operational failures are public signals that a company is actively in pain. This post covers how to build automated pipelines that find these signals using search APIs.

What Pain Scanning Means

Pain scanning is systematically searching for public evidence that a company has a specific problem. A data breach lawsuit means they need security help. An OSHA violation means compliance help. A class-action over product defects means quality control. Court filings, SEC actions, FTC complaints -- all searchable, all public. The challenge is doing it at scale.

Building the Search Layer

Scavio's Google search endpoint is the core of the pipeline. You run targeted queries designed to surface pain signals for specific industries:

Python
import requests

def search_pain_signals(industry: str, signal_type: str, api_key: str) -> list:
    queries = {
        "lawsuit": f"{industry} companies lawsuit filed 2026",
        "fine": f"{industry} company fined regulatory action 2026",
        "breach": f"{industry} data breach disclosed 2026",
        "recall": f"{industry} product recall 2026",
        "complaint": f"{industry} FTC complaint consumer protection 2026"
    }
    query = queries.get(signal_type, queries["lawsuit"])
    resp = requests.post(
        "https://api.scavio.dev/api/v1/search",
        headers={"x-api-key": api_key},
        json={
            "platform": "google",
            "query": query,
            "type": "search",
            "mode": "full"
        }
    )
    data = resp.json()
    return data.get("organic_results", [])

Extracting Company Names and Problems

Raw search results give you articles and snippets. An LLM extracts structured data -- which company, what problem, when it happened, and how severe it is:

Python
from anthropic import Anthropic

client = Anthropic()

def extract_pain_signals(results: list) -> list:
    context = ""
    for r in results[:10]:
        context += f"Title: {r.get('title')}\nSnippet: {r.get('snippet')}\nURL: {r.get('link')}\n\n"

    msg = client.messages.create(
        model="claude-sonnet-4-20250514",
        max_tokens=1024,
        messages=[{
            "role": "user",
            "content": f"""Extract pain signals from these search results.
For each signal, return:
- company_name
- problem_type (lawsuit, fine, breach, recall, complaint)
- summary (one sentence)
- source_url
- severity (high, medium, low)

Return as JSON array.

Results:
{context}"""
        }]
    )
    return msg.content[0].text

Filtering for Actionable Signals

Not every pain signal is actionable. You need to filter based on your specific offering. Here are practical filters:

  • Company size -- small companies in pain rarely have budget to hire, focus on mid-market and enterprise
  • Recency -- a lawsuit from three years ago is old news, target signals from the last 90 days
  • Severity -- regulatory fines over a certain threshold indicate serious, budget-worthy problems
  • Relevance to your offering -- a data breach is only useful if you sell cybersecurity services

Automating the Pipeline

Run this pipeline daily across your target industries. Each run searches for new signals, deduplicates against previous results, and outputs a list of companies with fresh, documented problems:

Python
import json

INDUSTRIES = ["healthcare", "fintech", "logistics", "manufacturing"]
SIGNALS = ["lawsuit", "fine", "breach", "recall"]

def daily_scan(api_key: str) -> list:
    all_signals = []
    for industry in INDUSTRIES:
        for signal in SIGNALS:
            results = search_pain_signals(industry, signal, api_key)
            if results:
                extracted = extract_pain_signals(results)
                all_signals.append({
                    "industry": industry,
                    "signal_type": signal,
                    "findings": extracted
                })
    return all_signals

From Signals to Outreach

The output is a list of companies with verified, public problems. Every entry has a specific reason to reach out -- you can reference the exact lawsuit, fine, or incident. That specificity separates cold emails that get replies from ones that get deleted.