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

# Nia Toolkit integration

> Integrate with the Nia search and index API using LangChain JavaScript.

[Nia](https://trynia.ai) is a search and index API that continuously provides context from docs, research papers, datasets, codebases, and more—so agents never rely on stale data. Scalable, 5x cheaper, and reliable.

## Overview

### Integration details

| Class                                                         | Package                                                                              | [PY support](/oss/javascript/integrations/tools/nia) |                                                Version                                                |
| :------------------------------------------------------------ | :----------------------------------------------------------------------------------- | :--------------------------------------------------: | :---------------------------------------------------------------------------------------------------: |
| [`NiaToolkit`](https://github.com/nozomio-labs/nia-langchain) | [`@nozomioai/langchain-nia`](https://www.npmjs.com/package/@nozomioai/langchain-nia) |                           ✅                          | ![NPM - Version](https://img.shields.io/npm/v/@nozomioai/langchain-nia?style=flat-square\&label=%20&) |

## Setup

The integration lives in the `@nozomioai/langchain-nia` package:

<CodeGroup>
  ```bash npm theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
  npm install @nozomioai/langchain-nia @langchain/core
  ```

  ```bash yarn theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
  yarn add @nozomioai/langchain-nia @langchain/core
  ```

  ```bash pnpm theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
  pnpm add @nozomioai/langchain-nia @langchain/core
  ```
</CodeGroup>

### Credentials

Sign up at [trynia.ai](https://trynia.ai) to get an API key.

```typescript theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
process.env.NIA_API_KEY = "nk_...";
```

It's also helpful (but not needed) to set up [LangSmith](https://smith.langchain.com?utm_source=docs\&utm_medium=cta\&utm_campaign=langsmith-signup\&utm_content=oss-javascript-integrations-tools-nia) for best-in-class observability:

```typescript theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
process.env.LANGSMITH_TRACING = "true";
process.env.LANGSMITH_API_KEY = "your-api-key";
```

## Instantiation

### Using the toolkit

```typescript theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
import { NiaToolkit } from "@nozomioai/langchain-nia";

const toolkit = new NiaToolkit({
  includeSearch: true,        // 5 search tools
  includeSources: true,       // 7 source management tools
  includeGithub: true,        // 4 GitHub tools
  includeContexts: true,      // 2 context/memory tools
  includeDependencies: true,  // 2 dependency tools
});

const tools = toolkit.getTools(); // 20 tools
```

### Using individual tools

```typescript theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
import { NiaSearch } from "@nozomioai/langchain-nia";

const tool = new NiaSearch();
```

## Invocation

### Search across indexed sources

```typescript theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
import { NiaSearch } from "@nozomioai/langchain-nia";

const tool = new NiaSearch();
const result = await tool.invoke({ query: "how to use React hooks" });
```

### Search the web

```typescript theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
import { NiaWebSearch } from "@nozomioai/langchain-nia";

const tool = new NiaWebSearch();
const result = await tool.invoke({ query: "latest Node.js release", numResults: 5 });
```

### Within an agent

```typescript theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
import { NiaToolkit } from "@nozomioai/langchain-nia";
import { ChatOpenAI } from "@langchain/openai";

const toolkit = new NiaToolkit({ includeSearch: true });
const tools = toolkit.getTools();

const llm = new ChatOpenAI({ model: "gpt-4o" });
const llmWithTools = llm.bindTools(tools);

const result = await llmWithTools.invoke("Search for React hooks best practices");
```

## Available tools

| Tool                     | Description                                                  |
| ------------------------ | ------------------------------------------------------------ |
| `NiaSearch`              | Semantic search across indexed repos, docs, and data sources |
| `NiaWebSearch`           | Web search with category filtering and date range            |
| `NiaDeepResearch`        | Multi-step comprehensive research                            |
| `NiaUniversalSearch`     | Search all sources simultaneously                            |
| `NiaAdvisor`             | Analyze code against indexed documentation                   |
| `NiaIndex`               | Index new sources (repos, docs, papers, datasets)            |
| `NiaSourceList`          | List indexed sources with filtering                          |
| `NiaSourceSubscribe`     | Subscribe to pre-indexed public sources                      |
| `NiaSourceSync`          | Re-sync sources to pull latest changes                       |
| `NiaRead`                | Read files/pages from indexed sources                        |
| `NiaGrep`                | Regex search within indexed sources                          |
| `NiaExplore`             | Browse file tree of indexed sources                          |
| `NiaGitHubSearch`        | Search code in GitHub repositories                           |
| `NiaGitHubRead`          | Read files from GitHub repos                                 |
| `NiaGitHubGlob`          | Find files matching glob patterns                            |
| `NiaGitHubTree`          | Browse repo file tree                                        |
| `NiaContextSave`         | Save context for cross-agent sharing                         |
| `NiaContextSearch`       | Semantic search over saved contexts                          |
| `NiaDependencySubscribe` | Auto-subscribe to docs for project dependencies              |
| `NiaDependencyAnalyze`   | Preview indexable dependencies from a manifest               |

## API reference

For detailed documentation, see the [langchain-nia GitHub repository](https://github.com/nozomio-labs/nia-langchain).

***

<div className="source-links">
  <Callout icon="terminal-2">
    [Connect these docs](/use-these-docs) to Claude, VSCode, and more via MCP for real-time answers.
  </Callout>

  <Callout icon="edit">
    [Edit this page on GitHub](https://github.com/langchain-ai/docs/edit/main/src/oss/javascript/integrations/tools/nia.mdx) or [file an issue](https://github.com/langchain-ai/docs/issues/new/choose).
  </Callout>
</div>
