# LlamaIndex + Tabstack

> Give your LlamaIndex.TS agents reliable web access. Schema-enforced extraction, research, generation, and browser automation as native LlamaIndex tools.

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

## Why LlamaIndex + Tabstack

Wiring web access into an agent usually means hand-rolled fetches, HTML parsing, and prompt gymnastics to coax structured data out of messy text. [`@tabstack/llamaindex`](https://www.npmjs.com/package/@tabstack/llamaindex) replaces that with a hosted API exposed as native LlamaIndex tools: schema-enforced output, server-side rendering of JS-heavy pages, and one key for extraction, research, generation, and automation.

## Quickstart

Install the adapter and set your key:

```bash
npm install @tabstack/llamaindex llamaindex zod

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

`llamaindex` (v0.12 or later) and `zod` are peer dependencies. The tools come pre-built as an array, so pass them straight to an agent:

```ts
import { tabstackTools } from "@tabstack/llamaindex";
import { agent } from "@llamaindex/workflow";
import { openai } from "@llamaindex/openai";
import { Settings } from "llamaindex";

Settings.llm = openai({ model: "gpt-4o" });

const researcher = agent({ tools: tabstackTools });

const result = await researcher.run(
  "What are Vercel's current pricing plans? Cite your sources.",
);
console.log(result.data);
```

The tools resolve `TABSTACK_API_KEY` lazily on first call, so importing the package never requires a key.

For a custom key, base URL, or a shared client, build the tools explicitly:

```ts
import { createTabstackLlamaindexTools } from "@tabstack/llamaindex";

const tools = createTabstackLlamaindexTools({ apiKey: process.env.MY_KEY });
// or pass an SDK client you already have: createTabstackLlamaindexTools({ client })
```

## The tools

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

Import individual tools for a subset, or use the `tabstackTools` array for all of them. The names stay in lockstep with the `@tabstack/langchain`, `@tabstack/ai`, `@tabstack/eve`, and Python `langchain-tabstack` packages.

## Good to know

- **`automate_browser_task` runs non-interactively.** It does not pause for human-in-the-loop form input, so it never blocks. It returns the final answer plus the data it extracted and the pages it visited.
- Failed calls throw `TabstackToolError`, a normalized message plus an HTTP `status` for API errors. LlamaIndex surfaces this in the tool result.
- Inputs are validated against the core Zod schema, since LlamaIndex passes the schema straight through as the tool's `parameters`, so malformed model output is caught before the call runs.
- **Zod 3 and Zod 4 both work.** LlamaIndex's `tool()` is Zod-native and accepts either, and your app's own Zod version is used.

## Common use cases

- Replace a brittle web loader with a hosted API that returns the shape you asked for.
- Give a LlamaIndex agent cited, multi-source research over live pages.
- Read a specific URL as clean markdown for indexing or summarisation.
- Keep tool names consistent across your TypeScript and Python agents.

## Next steps

- [Adapter on GitHub](https://github.com/Mozilla-Ocho/tabstack-integrations-typescript)
- [@tabstack/llamaindex on npm](https://www.npmjs.com/package/@tabstack/llamaindex)
- [LlamaIndex.TS docs](https://developers.llamaindex.ai/typescript)
- [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/
