> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

# LangChain

> Give a LangChain agent product search and live retailer offers, in Python or JavaScript.

Channel3 provides the same two tools as the [Channel3 MCP](/docs/mcp-overview.md), `search_products` and `get_products`, for LangChain in Python (`langchain-channel3`) and JavaScript (`@channel3/agent-toolkit/langchain`).

Set `CHANNEL3_API_KEY` in your environment. [Create a free API key](https://channel3.ai/sign-up/developer) if you don't have one yet.

## Python

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
pip install -U langchain langchain-anthropic langchain-channel3
```

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
from langchain.agents import create_agent
from langchain_channel3 import channel3_tools

agent = create_agent(
    model="anthropic:claude-sonnet-5-5",
    tools=channel3_tools(),
)

result = agent.invoke(
    {"messages": [{"role": "user", "content": "Find me a leather golf glove under $40 and tell me which retailer has it cheapest."}]}
)
```

`channel3_tools()` returns `Channel3SearchProducts` and `Channel3GetProducts`. Both support sync and async calls.

## JavaScript

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
npm install langchain @langchain/core @langchain/anthropic @channel3/agent-toolkit
```

```typescript theme={"theme":{"light":"github-light","dark":"github-dark"}}
import { createAgent } from "langchain";
import { channel3Tools } from "@channel3/agent-toolkit/langchain";

const agent = createAgent({
  model: "anthropic:claude-sonnet-5-5",
  tools: channel3Tools(),
});

const result = await agent.invoke({
  messages: [
    {
      role: "user",
      content: "Find me a leather golf glove under $40 and tell me which retailer has it cheapest.",
    },
  ],
});
```

`channel3Tools()` returns both tools as an array. You can also pass them to `model.bindTools()`.

## Tools

| Tool | Input | Returns | Credits |
| - | - | - | - |
| `search_products` | `query` and/or `image_url` | Up to 8 in-stock products with images and every retailer's offer | 1 per search |
| `get_products` | Up to 40 product IDs or retailer URLs | Full product data, plus any inputs it couldn't resolve | Free by ID, 1 per retailer URL |

Both tools return `content_and_artifact`. For `search_products`, the model sees a one-line summary per product, and for `get_products` it sees JSON. The full structured result is on the `ToolMessage` as `artifact`, so your UI can render product cards from it.

Offer URLs are Channel3 buy links. Purchases through them earn [commission](/docs/commissions.md) for your account.

## Options

| Option | Python | JavaScript |
| - | - | - |
| API key (defaults to `CHANNEL3_API_KEY`) | `api_key` | `apiKey` |
| Group one chat's calls in your analytics | `conversation_id` | `conversationId` |
| Products per search (1–30, default 8) | `limit` | `limit` |
| Override the API base URL | `base_url` | `baseUrl` |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.