LangChain tools for
632 live web-data APIs
pip install -U langchain-reefapilangchain-reefapi is a Python package, maintained by ReefAPI, that gives a LangChain or LangGraph agent three tools covering 632 live web-data APIs behind one ReefAPI key. The APIs (“engines”) cover Amazon, eBay, Zillow, Reddit, Google Maps, Trustpilot, LinkedIn Jobs, Booking and hundreds more; each one fetches its website when called and returns JSON. The agent finds the engine, reads its parameters, then calls it, so no engine has to be hard-coded into your prompt. Failed calls are not charged.
Install and set your key
Install the package, then put your ReefAPI key in the environment. You can also pass it to the constructor, ReefAPIToolkit(api_key="..."). The key is held as a SecretStr and left out of repr(), logs and serialized tool state. The two discovery tools work without a key.
pip install -U langchain-reefapi
export REEFAPI_API_KEY="your-key" # REEFAPI_KEY works too
No key yet? Create a free account for 1,000 credits, no card.
Three tools and a toolkit
ReefAPISearchEnginesreefapi_search_engineskeylessFinds the engine for a website or a data need: a keyword search over the live catalog. Takes query (English keywords or a site name) and an optional max_results.
ReefAPIGetSchemareefapi_get_schemakeylessShows an engine's actions, or one action's parameters, allowed values and an example. Takes engine and an optional action; without action it lists every action of the engine.
ReefAPICallreefapi_callneeds your keyRuns engine / action with params (a JSON object) and returns the response data as JSON. The text the model reads is cut at max_output_chars (default 50,000); the tool artifact keeps the full data and meta.
ReefAPIToolkit returns all three with one shared configuration: ReefAPIToolkit().get_tools(). The tools are built on the reefapi Python SDK, so retries for retryable errors and the client-side rate limit (30 requests per 3 seconds per key) come with them. Every tool has a sync and an async path.
An agent that picks the engine itself
Any chat model with tool calling works; this one uses Anthropic through langchain[anthropic].
pip install -U langchain-reefapi "langchain[anthropic]"
from langchain.agents import create_agent
from langchain_reefapi import ReefAPIToolkit
agent = create_agent(
model="claude-sonnet-4-6", # any chat model with tool calling
tools=ReefAPIToolkit().get_tools(),
system_prompt="Use the ReefAPI tools for live data from websites. "
"Find the engine first, read its schema, then call it.",
)
result = agent.invoke(
{"messages": [{"role": "user", "content": "What are the 3 cheapest iPhone 13 Pro listings on eBay right now?"}]}
)
print(result["messages"][-1].content)A typical run: the model calls reefapi_search_engines (for example with “ebay listings”), then reefapi_get_schema("ebay", "search"), then reefapi_call with the parameters it read.
The tools one by one
Steps 1 and 2 need no key. The same parameters are on each engine's docs page, for example /docs/ebay.
import json
from langchain_reefapi import ReefAPICall, ReefAPIGetSchema, ReefAPISearchEngines
# 1. which engine? (no key needed)
found = json.loads(ReefAPISearchEngines().invoke({"query": "sold prices on ebay", "max_results": 3}))
print([e["engine"] for e in found["engines"]]) # ['ebay', 'cardladder', 'ebay-sold']
# 2. which parameters? (no key needed)
schema = json.loads(ReefAPIGetSchema().invoke({"engine": "ebay", "action": "search"}))
print(schema["required_params"], schema["example_params"]) # ['query'] {'query': 'iphone 13 pro'}
# 3. call it (uses your key)
data = json.loads(ReefAPICall().invoke(
{"engine": "ebay", "action": "search", "params": {"query": "iphone 13 pro", "max_results": 5}}
))
for item in data["results"]:
print(item["title"], item["price"]["value"], item["price"].get("currency"))Errors go back to the agent; failures cost nothing
Discovery is free
reefapi_search_engines and reefapi_get_schema read the public catalog and spend no credits.
Failed calls cost 0
Each successful reefapi_call costs credits on your ReefAPI account. A call that errors is not charged.
The agent can fix itself
With the default handle_tool_error=True, the error text is the tool result, so the model can correct a bad parameter and retry.
Every error becomes a ToolException whose text carries the error code (INVALID_PARAM, UNKNOWN_API, RATE_LIMITED, QUOTA_EXCEEDED, TARGET_BLOCKED, UPSTREAM_TIMEOUT, ...), whether a retry can help, the HTTP status and the request id:
ReefAPI error INVALID_PARAM: sort must be one of ... retryable=false. http_status=400. request_id=... Check the parameter names and allowed values with reefapi_get_schema. Failed calls are not charged.
Set handle_tool_error=False to get the exception instead; it has .code, .retryable and .request_id. Plans and credit prices: pricing.
Constructor arguments
All three tools and the toolkit accept:
| Argument | Default | Meaning |
|---|---|---|
| api_key | REEFAPI_API_KEY, then REEFAPI_KEY | Your ReefAPI key |
| base_url | https://api.reefapi.com (or REEFAPI_BASE_URL) | Gateway URL |
| timeout | 180 | Seconds per request. Some engines render pages in a real browser and take over a minute |
| max_retries | 2 | Automatic retries for errors marked retryable and for HTTP 429 |
| max_output_chars | 50000 | (ReefAPICall, toolkit) Cut the model-facing text here; None never cuts |
Not using LangChain?
MCP clients
Claude, ChatGPT, Cursor and other MCP clients can connect the hosted ReefAPI MCP server instead of installing this package. MCP setup
Plain SDK
The reefapi SDK calls any engine from your own code: Python (PyPI) and JavaScript / TypeScript (npm).
REST
Every engine is POST https://api.reefapi.com/<engine>/v1/<action>. Docs · API catalog