Skip to main content

langchain-storerouter

LangChain tools for StoreRouter: live, structured product data from real merchant catalogs. Agents can search products across hundreds of stores, turn a product URL into a complete record, find stores that sell something, and discover brands.

Installation

pip install -U langchain-storerouter

Credentials

Create an API key at platform.storerouter.ai and export it:

export STOREROUTER_API_KEY="..."

Every tool and the toolkit also take api_key= directly. When STOREROUTER_API_KEY is unset, OCTOGEN_PLATFORM_API_KEY is read instead.

Tools

Tool Class Use it when
storerouter_product_search StoreRouterProductSearch The user describes something to buy
storerouter_product_lookup StoreRouterProductLookup The user has a product page URL
storerouter_store_search StoreRouterStoreSearch The user asks which stores sell something
storerouter_brand_search StoreRouterBrandSearch The user wants brands that fit a taste or a reference

StoreRouterToolkit().get_tools() returns all four.

Use with an agent

from langchain.agents import create_agent
from langchain_storerouter import StoreRouterToolkit

agent = create_agent(
    "anthropic:claude-sonnet-5-5",
    tools=StoreRouterToolkit().get_tools(),
    system_prompt="You are a shopping assistant. Link every product you recommend.",
)

result = agent.invoke(
    {"messages": [{"role": "user", "content": "A linen midi dress under $200?"}]}
)
print(result["messages"][-1].content)

Invoke a tool directly

from langchain_storerouter import StoreRouterProductSearch

search = StoreRouterProductSearch()
print(search.invoke({"query": "linen midi dress", "max_price": 200, "limit": 5}))
{
  "products": [
    {
      "title": "…",
      "brand": "…",
      "store": "…",
      "price": 178.0,
      "currency": "USD",
      "in_stock": true,
      "product_url": "https://…",
      "image_url": "https://…",
      "uuid": "…"
    }
  ],
  "next_cursor": "…"
}

StoreRouterProductSearch arguments: query, plus optional min_price, max_price, stores (domains such as ["thereformation.com"]), limit (1-50, default 10) and cursor for the next page.

StoreRouterProductLookup takes a url and returns the product as Markdown: prices, every variant's color, size and stock, images, materials and description.

Content and artifacts

Each tool uses response_format="content_and_artifact". The model sees a compact rendering; the full API response is on the ToolMessage.artifact for your code:

message = search.invoke(
    {
        "type": "tool_call",
        "id": "1",
        "name": "storerouter_product_search",
        "args": {"query": "linen dress"},
    }
)
message.content  # compact JSON for the model
message.artifact  # the full search page: images, variants' colors and sizes, scores

Errors

Errors the model can act on, such as no match, an invalid filter or a rate limit, come back as a ToolMessage so the agent can adjust. Errors that need a human are raised: an invalid key, a key without API access, or exhausted credit.

Prices and stock

Prices and stock reflect the last catalog refresh, not a live check. Send users to the returned product_url, unchanged, to buy.

Configuration

Argument Environment variable Default
api_key STOREROUTER_API_KEY, then OCTOGEN_PLATFORM_API_KEY required
base_url STOREROUTER_BASE_URL https://api.storerouter.ai/v1
timeout 30.0 seconds

MCP

StoreRouter also runs a remote MCP server at https://mcp.storerouter.ai/mcp, authenticated with OAuth. It suits interactive clients. For agents running headless, this package with an API key is simpler.

Development

cd integrations/langchain
uv sync
uv run pytest                                  # unit and standard tests, no network
STOREROUTER_API_KEY=... uv run pytest tests/integration_tests   # live API

Tests run against the SDK in sdks/python, so an SDK change that breaks a tool fails in the same pull request.

License

Apache-2.0

Metadata

Release files for langchain-storerouter 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langchain-storerouter 0.1.0
File Size Uploaded Provenance Actions
langchain_storerouter-0.1.0.tar.gz 9.8 kB With provenance Details for langchain_storerouter-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for langchain-storerouter 0.1.0
File Interpreter ABI Platform Actions
langchain_storerouter-0.1.0-py3-none-any.whl Python 3 none any Details for langchain_storerouter-0.1.0-py3-none-any.whl

Total release size: 20.9 kB

Release files / langchain_storerouter-0.1.0.tar.gz

Download URL langchain_storerouter-0.1.0.tar.gz
Size 9.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4c2d51530fbef4c5446a90a2f8500dacfa2aeb2b312127b1332321b4a038b6c3
BLAKE2b-256 checksum
How to use checksums
ca6c4d9c5f077ac251231f12fae0723c9fef57e1c9b03fddba4d715be5d3b5d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

Release files / langchain_storerouter-0.1.0-py3-none-any.whl

Download URL langchain_storerouter-0.1.0-py3-none-any.whl
Size 11.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d7ca4d3bf73881b170f1fc3829069c499277134acfb3e7a1de29a89fa992be17
BLAKE2b-256 checksum
How to use checksums
0cfa5aa1e5d6abe55801c1051edf7b5527512f7962bb005776f2e73c09f1eb6b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

Security for langchain-storerouter 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for langchain_storerouter-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page