# LangChain + Tabstack

> Give your LangChain agents reliable web access. Schema-enforced extraction, multi-source research, and browser automation as native tools, in TypeScript and Python.

Category: Agent Frameworks
Language: TypeScript, Python
Package: `@tabstack/langchain`
Canonical URL: https://tabstack.ai/integrations/langchain

## Why LangChain + Tabstack

LangChain's built-in loaders (`WebBaseLoader`, `PlaywrightURLLoader`) are fine for prototypes and brittle in production: unpredictable parsing, Playwright binaries to maintain, and behavior that drifts across releases. The Tabstack adapters replace them with a hosted API exposed as native LangChain tools: schema-enforced output, server-side rendering of JS-heavy pages, and one key for extraction, research, generation, and automation. It's an SDK call, not a loader coupled to your LangChain version.

Two officially-maintained packages track the same tool surface:

- **TypeScript**: [`@tabstack/langchain`](https://www.npmjs.com/package/@tabstack/langchain) for LangChain.js
- **Python**: [`langchain-tabstack`](https://pypi.org/project/langchain-tabstack/) for LangChain (Python)

## Quickstart

Install the adapter and set your key:

```bash
# TypeScript
npm install @tabstack/langchain @langchain/core zod

# Python
pip install langchain-tabstack

export TABSTACK_API_KEY="your-key-here"
```

Drop the tool set into an agent. TypeScript:

```ts
import { createAgent } from "langchain";
import { tabstackTools } from "@tabstack/langchain";

const agent = createAgent({
  model: "openai:gpt-4o",
  tools: tabstackTools,
  systemPrompt: "You are a research assistant with web intelligence tools.",
});

const result = await agent.invoke({
  messages: [{ role: "user", content: "What are Vercel's pricing plans?" }],
});

console.log(result.messages.at(-1)?.content);
```

The same set in Python:

```python
from langchain.agents import create_agent
from langchain_tabstack import TABSTACK_TOOLS

agent = create_agent("openai:gpt-4o", tools=TABSTACK_TOOLS)

result = agent.invoke(
    {"messages": [{"role": "user", "content": "What are Vercel's pricing plans?"}]}
)
print(result["messages"][-1].content)
```

`tabstackTools` / `TABSTACK_TOOLS` read `TABSTACK_API_KEY` from the environment. Every tool is also exported individually, so you can hand a single one to a chain without an agent.

## The tools

| Tool | What it does |
| --- | --- |
| `extract_structured_data` | Pull specific fields from a URL into a JSON shape you define. |
| `extract_page_content` | Fetch a page as clean markdown. |
| `research_question` | Synthesized answer with cited sources across multiple pages. |
| `generate_structured_data` | Fetch a page, then AI-transform it into derived or reshaped JSON. |
| `automate_browser_task` | Run a multi-step, natural-language browser task. |

## Common use cases

- Give a research agent cited, multi-source answers instead of a single fragile scrape.
- Extract typed records (pricing, listings, docs) from any URL straight into your chain state.
- Reshape a live page into derived JSON with `generate_structured_data`.
- Run natural-language browser tasks from inside an agent step.

## Next steps

- [TypeScript adapter on GitHub](https://github.com/Mozilla-Ocho/tabstack-integrations-typescript)
- [Python adapter on GitHub](https://github.com/Mozilla-Ocho/tabstack-langchain-python)
- [Get an API key](https://console.tabstack.ai/signup)

---

- All integrations: https://tabstack.ai/integrations
- Agent quickstart, every endpoint in one file: https://tabstack.ai/agents.md
- Full documentation: https://docs.tabstack.ai/
