Python, CrewAI, LangChain, OpenAI & Claude B2B Lead Agents Cookbook (2026)
Wire CrewAI, LangChain, OpenAI Tool-Calling, and Anthropic Claude MCP straight into live B2B market intelligence and RAG endpoints — without headless browser clusters or residential proxies. Every runnable script in examples/python-agents/ executes live zero-key probes out of the box and scales via our zero-dep b2b-market-intel-python SDK or Apify's built-in $5/month free tier.
examples/python-agents/
Python SDK: b2b-market-intel-python
Agensi 3 Free Skills ($0)
Order $29 CSV Packs & Custom Scrapers
Make.com Blueprints (8)
Fastest Launch Options (Managed Skills, Zero-Key STDIO MCP & $29 CSV Hub)
Run Inside Claude / Cursor via Agensi.io
Skip Python boilerplate with 3 Free Skills (Google News Decoder, Reed UK Hiring, App Store Bug Spy) or unlock 20%–35% off multi-tool Bundles (Card / Solana USDC).
$29 CSV Packs & $199–$350 Custom Builds
Need clean 500–1,000 row B2B CSV/Google Sheets lead packs ($29) or a bespoke Python / Apify / Make / n8n scraper built in 24–48h (20-row free proof first)?
Instant Local CLI & Tool Schemas
Attach zero-key Google News, UK Tenders & ClinicalTrials tools to Claude/Cursor via npx, or install our stdlib Python SDK:
1. Interactive 4-Framework Code Switcher
Switch between CrewAI, LangChain, OpenAI Tool-Calling, and Anthropic Claude MCP to inspect exact integration patterns, copy runnable snippets, or run the full script from examples/python-agents/.
from crewai import Agent, Crew, Task
from crewai.tools import BaseTool
import os, requests
class ShopifyChurnSpyTool(BaseTool):
name: str = "shopify_app_churn_spy"
description: str = "Mine 1-2 star Shopify app churn reviews, complaining merchant domains, and dev emails."
def _run(self, query: str) -> list[dict]:
resp = requests.post(
"https://api.apify.com/v2/acts/ttyan0111~shopify-app-store-churn-spy/run-sync-get-dataset-items",
params={"token": os.environ["APIFY_TOKEN"], "fields": "name,developerEmail,mentionedDomains,painSignalSummary,agentSummary"},
json={"queries": [query], "starRatings": ["1", "2"], "maxAppsPerQuery": 3, "maxReviewsPerApp": 15},
timeout=90,
)
return resp.json()
analyst = Agent(
role="B2B Churn Intelligence Analyst",
goal="Identify merchants leaving 1-star app reviews for targeted outreach.",
backstory="Extracts verified product-led outbound triggers from public app reviews.",
tools=[ShopifyChurnSpyTool()],
)
task = Task(description="Audit 1-star churn around 'klaviyo-email-marketing'.", expected_output="JSON lead brief.", agent=analyst)
print(Crew(agents=[analyst], tasks=[task]).kickoff())
from langchain_core.tools import StructuredTool
from langchain_openai import ChatOpenAI
from uk_tenders_procurement_agent import search_uk_gov_tenders_zero_key
uk_tenders_tool = StructuredTool.from_function(
func=search_uk_gov_tenders_zero_key,
name="search_uk_gov_tenders",
description="Search UK Contracts Finder notices returning buyer name, .gov.uk email, GBP value & deadline (zero keys).",
)
llm = ChatOpenAI(model="gpt-4o-mini", temperature=0).bind_tools([uk_tenders_tool])
ai_msg = llm.invoke("Find 3 open UK public sector cloud tenders with buyer contact emails.")
for call in ai_msg.tool_calls:
print(search_uk_gov_tenders_zero_key(**call["args"]))
import json
from openai import OpenAI
from google_news_rag_agent import OPENAI_TOOLS, dispatch_tool
client = OpenAI()
messages = [
{"role": "system", "content": "Resolve opaque Google News links before summarizing."},
{"role": "user", "content": "Decode https://news.google.com/rss/articles/... and cite the real publisher."},
]
resp = client.chat.completions.create(model="gpt-4o-mini", messages=messages, tools=OPENAI_TOOLS)
for call in resp.choices[0].message.tool_calls or []:
decoded = dispatch_tool(call.function.name, json.loads(call.function.arguments))
print(decoded["decoded_url"], "via", decoded["method"])
import anthropic, os
client = anthropic.Anthropic()
resp = client.beta.messages.create(
model="claude-sonnet-4-5",
max_tokens=1024,
betas=["mcp-client-2025-04-04"],
mcp_servers=[{
"type": "url",
"url": "https://mcp.apify.com?actors=ttyan0111/clinical-trials-biotech-leads",
"name": "clinical_trials_biotech_mcp",
"authorization_token": os.environ["APIFY_TOKEN"],
}],
messages=[{"role": "user", "content": "Find 5 recruiting Industry oncology trials with sponsor emails."}],
)
print(resp.content)
2. All 4 Cookbook Scripts & Endpoints
google_news_rag_agent.py
Decodes legacy CBMi protobuf links and modern AU_yqL Google News wrappers via live DotsSplashUi Fbv4je batchexecute, plus optional Apify RAG Markdown extraction.
clinical_trials_biotech_agent.py
Queries clinicaltrials.gov/api/v2/studies with zero API keys for Phase 1–3 Industry sponsor contacts, and connects Claude Messages API directly to mcp.apify.com.
uk_tenders_procurement_agent.py
Wraps UK Contracts Finder REST v2 + OCDS endpoints into LangChain StructuredTool to pull live open tenders, GBP values, and .gov.uk buyer emails.
shopify_competitor_churn_agent.py
Builds a CrewAI BaseTool + analyst Agent extracting Shopify App Store 1★–2★ churn & dev emails, with a zero-key WordPress.org Plugins 1.2 probe built in.
3. Choose Your Execution Layer
| Layer | Auth / Cost | Best For | Quickstart |
|---|---|---|---|
| Zero-Key Python Demo / SDK | $0 (No API keys) |
Live testing Google News decode, UK Gov Tenders & ClinicalTrials.gov in Python 3.10+ | b2b-market-intel-python |
Agensi Managed MCP (3 Free) |
$0 Free tier / $5–$12.99 |
Zero-key hosted execution inside Claude Code, Codex, Cursor, or ChatGPT | agensi.io/r/GIANGTRNGTRNG |
| Zero-Key STDIO MCP (Node 18+) | $0 Local STDIO |
Connecting Claude Desktop / Cursor / n8n STDIO Bridge locally | npx -y github:truonggiang0111/b2b-market-intel-mcp |
| Apify Cloud Batch (15 Actors) | $5/mo Built-in Free Credit |
Scaled multi-page Shopify, Substack, Reed/Seek, VS Code, Chrome & Ads runs | apify.com/ttyan0111 |
| Done-For-You CSV & Custom Builds | $29 CSV / $199–$350 Custom |
Ready-to-email 500–1,000 row CSV packs or 24–48h custom pipelines |
Direct B2B Storefront |
Prefer No-Code Spreadsheets, Make.com, or n8n? Grab our Google Sheets Apps Script Add-on (=DECODE_GNEWS_URL(), =CLINICAL_TRIALS_LEADS()), 8 Make.com Blueprints, or 16 n8n Workflows — or start instantly with 3 Free Skills on Agensi.io.
Frequently Asked Questions
Can I run these Python examples without OpenAI, CrewAI, or LangChain installed?
Yes. All four scripts under examples/python-agents/ default to zero-key Python 3.10+ standard-library demo mode so you can fetch live data immediately before installing optional agent frameworks.
How do the scripts scale beyond single zero-key queries?
Pass --apify-live with your APIFY_TOKEN (every Apify account includes $5/month free usage at apify.com/ttyan0111), or connect Claude/Cursor directly to https://mcp.apify.com or Agensi.io.
Can I buy cleaned B2B lead CSVs or hire custom scraper builds directly?
Yes. Visit the Direct B2B Data Storefront for $29 500–1,000 row CSV lead packs or $199–$350 fixed-price custom scrapers (20-row free proof first).