LangChain integration for ProxyClaw - residential proxy network
Project description
LangChain ProxyClaw Integration
Official LangChain integration for ProxyClaw - a residential proxy network with 10M+ IPs across 111+ countries.
Overview
This package provides LangChain Tools for routing HTTP requests through ProxyClaw's residential proxy network, enabling AI agents to scrape websites with:
- 🌍 Global IP coverage - 111+ countries
- 🔄 Automatic rotation - Fresh IPs per request or sticky sessions
- 🛡️ Anti-detection - Built-in fingerprint spoofing
- ⚡ High success rate - Residential IPs bypass most blocks
Installation
pip install langchain-proxyclaw
For development:
pip install langchain-proxyclaw[dev]
Quick Start
from langchain_proxyclaw import ProxyClawTool
from langchain.agents import AgentType, initialize_agent
from langchain_openai import ChatOpenAI
# Initialize the tool
tool = ProxyClawTool(api_key="your_api_key")
# Use with an agent
llm = ChatOpenAI(temperature=0)
agent = initialize_agent(
[tool],
llm,
agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
verbose=True
)
# Ask the agent to scrape a website
agent.run("Get the content from https://example.com using a US proxy")
Tools
1. ProxyClawTool
Basic HTTP requests through ProxyClaw proxies.
from langchain_proxyclaw import ProxyClawTool
tool = ProxyClawTool(api_key="your_api_key")
# Simple GET request
result = tool.invoke({
"url": "https://example.com",
"country": "US"
})
# POST request with data
result = tool.invoke({
"url": "https://api.example.com/data",
"method": "POST",
"data": {"key": "value"},
"headers": {"Authorization": "Bearer token"},
"country": "GB"
})
Parameters:
url(str, required): Target URLmethod(str): HTTP method (GET, POST, PUT, DELETE) - default: GETheaders(dict): Optional HTTP headersdata(str/dict): Request body datacountry(str): Country code for proxy location (e.g., "US", "GB", "DE")session_id(str): Session ID for sticky sessions
2. ProxyClawSessionTool
Sticky proxy sessions for multi-step workflows.
from langchain_proxyclaw import ProxyClawSessionTool
tool = ProxyClawSessionTool(api_key="your_api_key")
# Scrape multiple pages with the same IP
result = tool.invoke({
"urls": [
"https://site.com/login",
"https://site.com/dashboard",
"https://site.com/profile"
],
"country": "US"
})
Parameters:
urls(list[str], required): List of URLs to fetchcountry(str): Country codesession_lifetime(int): Session duration in minutes - default: 30
3. ProxyClawScraperTool
Advanced scraper with retries and auto-rotation.
from langchain_proxyclaw import ProxyClawScraperTool
tool = ProxyClawScraperTool(api_key="your_api_key")
# Scrape with retries and link extraction
result = tool.invoke({
"url": "https://example.com/products",
"country": "US",
"retries": 3,
"timeout": 30,
"extract_links": True
})
Parameters:
url(str, required): Target URLcountry(str): Country coderetries(int): Number of retry attempts - default: 3timeout(int): Request timeout in seconds - default: 30extract_links(bool): Extract all links from the page - default: False
Authentication
Get your API key from ProxyClaw Dashboard:
api_key = "pk_live_xxxxxxxxxxxxxxxx"
Country Codes
Common country codes:
US- United StatesGB- United KingdomDE- GermanyFR- FranceJP- JapanIN- IndiaBR- Brazil
Full list: 111+ countries supported. Use ISO 3166-1 alpha-2 codes.
Use Cases
Web Scraping for AI Agents
from langchain_proxyclaw import ProxyClawScraperTool
from langchain.agents import AgentType, initialize_agent
scraper = ProxyClawScraperTool(api_key="your_api_key")
agent = initialize_agent(
[scraper],
llm,
agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION
)
# Agent can now scrape without being blocked
agent.run("Find pricing information from https://competitor.com/pricing")
E-commerce Monitoring
session_tool = ProxyClawSessionTool(api_key="your_api_key")
# Same IP for login + price check
result = session_tool.invoke({
"urls": [
"https://shop.com/login",
"https://shop.com/product/123"
],
"country": "US"
})
Market Research
from langchain_proxyclaw import ProxyClawTool
tool = ProxyClawTool(api_key="your_api_key")
# Check how a site appears from different countries
for country in ["US", "GB", "DE", "JP"]:
result = tool.invoke({
"url": "https://global-site.com",
"country": country
})
print(f"{country}: {result}")
LangChain Integration Tests
To run LangChain's standard integration tests:
pip install langchain-proxyclaw[dev]
pytest tests/ -v
Documentation
Full documentation: docs.proxyclaw.ai
LangChain docs: python.langchain.com
API Reference
See ProxyClaw API Docs for details on:
- Authentication formats
- Country targeting
- Session management
- Bandwidth tracking
Pricing
ProxyClaw uses pay-as-you-go pricing:
- $0.35/GB under 10TB
- $0.25/GB over 10TB
No minimums, no commitments. Sign up
Support
- 📧 Email: support@iploop.io
- 💬 Discord: discord.gg/clawd
- 📖 Docs: docs.proxyclaw.ai
License
MIT License - see LICENSE file.
Contributing
Contributions welcome! See CONTRIBUTING.md for guidelines.
Built with ❤️ by the IPLoop team.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file langchain_proxyclaw-0.1.0.tar.gz.
File metadata
- Download URL: langchain_proxyclaw-0.1.0.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b37e540798390be4f66e9e0a3f57a361629a1fc15acdcbb1de645829c4f6171c
|
|
| MD5 |
6506e0f2ba42a00f3d83afc79d3de0d5
|
|
| BLAKE2b-256 |
44cb6a078528e67a4a875a106819431dc8f6ab7a0dc9fbc246502e85e45c892a
|
File details
Details for the file langchain_proxyclaw-0.1.0-py3-none-any.whl.
File metadata
- Download URL: langchain_proxyclaw-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aef126afc199581950ef1d4108fd923512963c2c51422c563645d9da3d5c36fc
|
|
| MD5 |
f1592b4bbb3b71b2a755c0b0e537d6d0
|
|
| BLAKE2b-256 |
5ff4831c62bdf96ab6920aaa915ca686138f2300ccaf39087964b2ac2ef64475
|