Metadata-Version: 2.5
Name: langchain-asin
Version: 0.1.0
Summary: LangChain tools for Asin: search Amazon, read a product's price history and compare its sellers' offers.
Project-URL: Homepage, https://www.asin.dev
Project-URL: Documentation, https://github.com/asindotdev/langchain-asin#readme
Project-URL: Repository, https://github.com/asindotdev/langchain-asin
Project-URL: Issues, https://github.com/asindotdev/langchain-asin/issues
Author-email: Asin <contact@asin.dev>
License-Expression: MIT
License-File: LICENSE
Keywords: agents,amazon,asin,ecommerce,langchain,price-history,price-tracking,tools
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: httpx<1,>=0.27
Requires-Dist: langchain-core<2,>=0.3.15
Provides-Extra: test
Requires-Dist: langchain-tests>=0.3.5; extra == 'test'
Requires-Dist: pytest-asyncio>=0.24; extra == 'test'
Requires-Dist: pytest>=8.3; extra == 'test'
Requires-Dist: ruff<1,>=0.8; extra == 'test'
Description-Content-Type: text/markdown

# langchain-asin

[LangChain](https://www.langchain.com) integration for [Asin](https://www.asin.dev): search Amazon, read a product's price history and compare its sellers' offers.

## Installation

```bash
pip install -U langchain-asin
export ASIN_API_KEY="your-api-key"
```

Get an API key at [www.asin.dev/app](https://www.asin.dev/app).

## Tools

| Class | Tool name | What it does |
| --- | --- | --- |
| `AsinAmazonSearch` | `asin_amazon_search` | Search an Amazon store through Asin. |
| `AsinPriceHistory` | `asin_price_history` | Read the price history of an Amazon product through Asin. |
| `AsinOffers` | `asin_offers` | Read the sellers' offers for an Amazon product through Asin. |

Each tool takes `api_key` (defaults to `ASIN_API_KEY`), `base_url` and `timeout`, plus the settings shown in its docstring. Errors (invalid key, no credits, rate limit, timeout) come back to the model as a `ToolException` message, without the API key. Every tool has an async version.

```python
from langchain_asin import AsinAmazonSearch

tool = AsinAmazonSearch()
print(tool.invoke({"query": "kindle"}))
```

### In an agent

```python
from langchain.agents import create_agent
from langchain_asin import AsinAmazonSearch, AsinPriceHistory, AsinOffers

agent = create_agent("openai:gpt-4.1-mini", tools=[AsinAmazonSearch(), AsinPriceHistory(), AsinOffers()])
result = agent.invoke({"messages": [{"role": "user", "content": "..."}]})
```

## Development

```bash
pip install -e ".[test]"
pytest tests/unit_tests
```

## License

MIT
