BuyWhere LangChain Integration
LangChain tools for the BuyWhere product catalog API. Add product search, price comparison, and affiliate links to any LangChain agent.
Installation
pip install buywhere-langchain
Quick Start
from langchain.agents import create_react_agent, AgentExecutor
from langchain_openai import ChatOpenAI
from buywhere_langchain import BuyWhereToolkit
toolkit = BuyWhereToolkit(api_key="bw_live_xxx")
tools = toolkit.get_tools()
llm = ChatOpenAI(model="gpt-4o")
agent = create_react_agent(llm, tools, prompt)
agent_executor = AgentExecutor(agent=agent, tools=tools)
result = agent_executor.invoke({"input": "find me a laptop under $1000 in Singapore"})
print(result["output"])
Available Tools
| Tool | Description |
|---|---|
buywhere_search |
Search products by name, brand, category, price range |
buywhere_get_product |
Get full details for a specific product |
buywhere_get_price |
Get pricing across all merchants |
buywhere_compare_prices |
Compare 2-5 products side by side |
buywhere_get_affiliate_link |
Get an affiliate-tracking URL for a product |
buywhere_get_catalog |
List all product categories |
buywhere_find_best_price |
Find the cheapest listing for a product across all platforms |
buywhere_get_deals |
Find discounted products sorted by discount depth |
LangGraph
from langgraph.prebuilt import ToolNode
tool_node = ToolNode(toolkit.get_tools())
Error Handling
Tools return typed errors for auth failures, rate limits, and not-found:
BuyWhereError— base exceptionRateLimitError— retry with backoffAuthenticationError— invalid API keyNotFoundError— product/resource not found
Get an API Key
Sign up at buywhere.ai to get your API key.
Metadata
Release files for buywhere-langchain 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| buywhere_langchain-0.1.0.tar.gz | 8.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| buywhere_langchain-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.8 kB
Release files / buywhere_langchain-0.1.0.tar.gz
| Download URL | buywhere_langchain-0.1.0.tar.gz |
|---|---|
| Size | 8.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ad333990303fb666bac89b458cf78d14fb6bbe9ecdc6258420f428e788acc9eb
|
|
BLAKE2b-256 checksum How to use checksums |
e87917d9d798c47097d1e860fad6ba6876c03573d88b266b3ae30ae8f16f630d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / buywhere_langchain-0.1.0-py3-none-any.whl
| Download URL | buywhere_langchain-0.1.0-py3-none-any.whl |
|---|---|
| Size | 11.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
15b83fd3112d5daa646d95e462e2385ffa3d6c956c57dd8274109002b89303d7
|
|
BLAKE2b-256 checksum How to use checksums |
827f0dbf3bbaec018a1cc02aaecb8c0df0d8d3839693b916d9999a5c5e07c15d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|