Skip to content

About

An AI-powered agent that automates vendor adverse media investigations using Bright Data's web scraping infrastructure, OpenAI for risk analysis, and OpenHands SDK for intelligent monitoring script generation.

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

Vendor Risk Agent with Bright Data: Automated adverse media checks on vendors with SERP API and Web Unlocker

Vendor Risk Agent with Bright Data

Automated adverse media checks on vendors with SERP API and Web Unlocker

A FastAPI service that searches for vendor red flags with the Bright Data SERP API, reads pages through Web Unlocker, scores risk with OpenAI, and generates monitoring scripts with the OpenHands SDK.


Built by Studio1 Built with Bright Data

Bright Data docs  ·  Bright Data  ·  More examples  ·  studio1hq.com


Overview

An agent for third-party risk management. Give it a vendor name and it searches for adverse media, reads the pages it finds, scores the risk, and can generate monitoring scripts that keep checking the vendor's sources.

It uses three Bright Data products: the SERP API to search Google for red flags, Web Unlocker to read pages behind paywalls and CAPTCHAs, and an optional Browser API for JavaScript-heavy sites. OpenAI scores the risk, and the OpenHands SDK writes the monitoring scripts. A FastAPI service exposes it over REST.

Features

  • Adverse media search: Litigation, fraud, financial, regulatory and operational risk categories.
  • SERP API discovery: Searches Google for red flags per category.
  • Web Unlocker access: Extracts content from protected pages.
  • AI risk analysis: OpenAI returns severity (low, medium, high, critical), findings and recommended actions.
  • Generated monitors: OpenHands SDK writes Python scripts into scripts/generated/.
  • REST API: FastAPI endpoints with interactive docs.
  • Browser API (optional): Form filling and extraction for complex sites.

Tech stack

Layer Tool
Search Bright Data SERP API
Page access Bright Data Web Unlocker
Browser (optional) Bright Data Browser API with Playwright
Risk analysis OpenAI
Script generation OpenHands SDK
API FastAPI
Deployment Railway (Procfile)

Getting started

Prerequisites

Installation

git clone https://github.com/Studio1HQ/tprm-agent.git
cd tprm-agent
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate
pip install -r requirements.txt

Environment variables

Create a .env file in the project root.

Variable Description
BRIGHT_DATA_API_TOKEN Bright Data API token.
BRIGHT_DATA_SERP_ZONE SERP API zone name.
BRIGHT_DATA_UNLOCKER_ZONE Web Unlocker zone name.
BRIGHT_DATA_CUSTOMER_ID Customer ID for Web Unlocker (in config.py).
BRIGHT_DATA_UNLOCKER_PASSWORD Web Unlocker zone password (in config.py).
BRIGHT_DATA_BROWSER_USER Optional. Browser API username.
BRIGHT_DATA_BROWSER_PASSWORD Optional. Browser API password.
OPENAI_API_KEY OpenAI key for risk analysis.
LLM_API_KEY API key for OpenHands script generation.
LLM_MODEL Model for OpenHands, for example openai/gpt-4o.

Zones are created in the Bright Data dashboard under Proxies and Scraping Infrastructure: add a SERP API zone, a Web Unlocker zone and, optionally, a Scraping Browser.

Run

Start the API:

python -m uvicorn api.main:app --reload

Open http://localhost:8000/docs for interactive API docs. To run one investigation directly:

python src/agent.py

How it works

DISCOVERY (SERP API) -> ACCESS (Web Unlocker) -> ACTION (OpenAI + OpenHands SDK)
  search Google          bypass paywalls          analyze risks
  for red flags          and CAPTCHAs             generate scripts
tprm-agent/
├── src/
│   ├── config.py      # settings
│   ├── discovery.py   # SERP API
│   ├── access.py      # Web Unlocker
│   ├── actions.py     # OpenAI + OpenHands SDK
│   ├── agent.py       # orchestration
│   └── browser.py     # Browser API (optional)
├── api/main.py        # FastAPI endpoints
├── scripts/generated/ # generated monitors
├── run_investigation.py
└── Procfile

Risk categories live in RISK_CATEGORIES in src/discovery.py; add your own keywords there.

API

Start an investigation:

curl -X POST "http://localhost:8000/investigate" \
  -H "Content-Type: application/json" \
  -d '{"vendor_name": "Acme Corp", "categories": ["litigation", "fraud"], "generate_monitors": true}'

Other endpoints: GET /investigate/{investigation_id} for results, GET /reports/{vendor_name}, and GET /health.

Request fields: vendor_name (required), categories (optional), generate_monitors (optional, default true). A result includes total_sources_found, total_sources_accessed, risk_assessments (category, severity, summary, key findings, sources, recommended actions), monitoring_scripts and errors.

Python use:

from src.agent import TPRMAgent

agent = TPRMAgent()
result = agent.investigate(
    vendor_name="Acme Corp",
    categories=["litigation", "financial", "fraud"],
    generate_monitors=True,
)

Run or schedule a generated monitor:

cd scripts/generated
python monitor_acme_corp.py
# cron: 0 9 * * * cd /path/to/tprm-agent/scripts/generated && python3 monitor_acme_corp.py

Deploy to Railway

npm i -g @railway/cli
railway login
railway init
railway up

Add the environment variables in the Railway dashboard under Variables, then generate a domain. The Procfile runs uvicorn api.main:app --host 0.0.0.0 --port $PORT.

Troubleshooting

  • Bright Data auth errors: Check the token and zone names, zone status and available bandwidth.
  • OpenAI rate limits: Add retries or reduce concurrency.
  • Generated scripts skip Bright Data: Check the Web Unlocker instructions in the prompt in actions.py.
  • Deployment failures: Check dependency size and the Procfile.

Security: do not commit .env, use platform variables in production, rotate keys, and add authentication to the API before exposing it.

Resources



Studio1

Built by Studio1, the technical content and DevRel partner for devtool teams. Made with Bright Data.
Browse more open-source examples at github.com/Studio1HQ.

Website Book a call X LinkedIn

studio1hq.com · Technical content, docs, video and DevRel for devtools

About

An AI-powered agent that automates vendor adverse media investigations using Bright Data's web scraping infrastructure, OpenAI for risk analysis, and OpenHands SDK for intelligent monitoring script generation.

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Used by

Contributors

Languages