Docs menu

Docs Reference

LangChain

Give a LangChain agent residential, datacenter or mobile IPs: a page-reading tool and a document loader.

Last verified: October 2026

What it does

The langchain-proxmint package connects LangChain to your Proxmint proxies. It has two parts:

  • ProxmintFetchTool, an agent tool. The agent passes a URL and, if it wants, a country, and gets back the final URL, the status, the title and the page as readable text.
  • ProxmintLoader, a document loader that fetches a list of URLs into Documents for indexing or summarising.

Requests go straight from your code to the gateway, from the IPs and location you pick, and use the bandwidth of your own product. The source is on GitHub and the package on PyPI.

Install and connect

Install the package and create an API key under Settings in the dashboard (the same read-only key the customer API uses):

Shell
pip install langchain-proxmint
export PROXMINT_API_KEY="pmk_YOUR_KEY"

The key looks up the proxy login of the product you choose, so there is nothing else to copy. If you would rather not use a key, set PROXMINT_USERNAME and PROXMINT_PASSWORD to the proxy login from your product page, or pass username and password.

Use it in an agent

Give the tool to any agent that calls tools:

Python
from langchain.agents import create_agent
from langchain_proxmint import ProxmintFetchTool

tool = ProxmintFetchTool(product="residential")

agent = create_agent("anthropic:claude-sonnet-5-5", tools=[tool])
agent.invoke({"messages": [{"role": "user",
    "content": "What does the front page of example.com say when visited from Germany?"}]})
Or call it directly
print(tool.invoke({"url": "https://example.com", "country": "de"}))

# URL: https://example.com/
# Status: 200
# Title: Example Domain
#
# Example Domain
# This domain is for use in documentation examples ...

When the gateway refuses a request, for example because the product is out of bandwidth or no IP matches the targeting, the agent gets a one-line reason and what to change instead of a stack trace. The error codes page lists them all.

Load pages into Documents

Python
from langchain_proxmint import ProxmintLoader

loader = ProxmintLoader(
    ["https://example.com", "https://example.org"],
    country="us",
    city="New York",
    session_minutes=30,  # every page from one IP
)
docs = loader.load()
docs[0].metadata  # source, requested_url, status, title, content_type, country

Each URL gets a new IP unless session_minutes is set; then the whole run leaves from one IP, which suits pages that belong to one browsing session. A URL that fails is logged and skipped.

Options

OptionDefaultWhat it does
product"residential"residential, premium-residential, datacenter or mobile.
countryanyExit country as a two-letter code. On the tool it is the default when a call names none.
state, city, zip_code, asnnoneFiner targeting inside the country. Needs country.
session_minutesnoneKeep one exit IP for 1 to 120 minutes: across calls on the tool, across the whole run on the loader.
output"text"text returns readable text, html the raw page.
timeout60Seconds per request.
max_chars50000Tool only: longer pages are cut here.
continue_on_failureTrueLoader only: log and skip a URL that fails, instead of raising.

Good to know

  • State, city, ZIP and ASN targeting can meter at twice the bandwidth; the targeting page says which products.
  • Pages load over the destination ports the network forwards, which cover the usual web ports (see port access). A short list of sites is refused outright (see blocked websites).
  • Each product allows up to 2,000 concurrent connections, so loaders can run in parallel.
  • The tool does not run JavaScript. It reads what the server sends.