Building an AI startup?
You might be eligible for our Startup Program. Get fully funded access to the infrastructure you’re reading about right now (up to $20K value).
This cookbook gets you from zero to a working AI enrichment agent in under 10 minutes.
What You’ll Build
An AI agent that:- Takes a research topic and a JSON schema as input (e.g., “B2B enterprise CTOs from New York”, “Stripe payments company”, “history of renewable energy technologies”)
- Searches the web using Bright Data SERP API (real search results, geo-targeting)
- Scrapes websites using Bright Data Web Unlocker (bypasses anti-bot measures)
- Uses an LLM to extract and structure the data
- Validates and returns structured JSON matching your schema
Prerequisites
- A Bright Data account with API key from the dashboard
- An Anthropic or OpenAI API key
- Python 3.10+
Step 1: Install Dependencies
Step 2: Set Environment Variables
Get your API keys:- Bright Data API Key - Generate from your dashboard
- Anthropic API Key - Get from Console
Step 3: Create the Enrichment Agent
Create a file calledenrichment_agent.py and build it in three parts:
3.1: Imports and State Definition
Define the agent’s state to track the research topic, schema, messages, and extracted info.3.2: Tool Definitions
Configure Bright Data tools for web search and content scraping.3.3: Agent Graph and Execution
Build the LangGraph workflow that orchestrates search → scrape → extract.Step 4: Run the Agent
How It Works
- Agent receives topic and schema, decides what to search
- Search uses Bright Data SERP API for real search results
- Scrape uses Bright Data Web Unlocker to get page content
- Agent analyzes content and either continues researching or submits info
- Output is structured JSON matching your schema
How to customize the agent
Different Extraction Schema
How to target by geography
Use OpenAI Instead of Anthropic
Next Steps
LinkedIn Scraping
Add LinkedIn profile enrichment
LangChain Integration
Full langchain-brightdata documentation
Where to find the source code
GitHub Repository
Full source code and additional examples
You now have an AI-powered data enrichment agent! Customize the schema to extract any structured data you need.