Skip to main content
Nia 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

Setup

The integration lives in the @nozomioai/langchain-nia package:
npm install @nozomioai/langchain-nia @langchain/core

Credentials

Sign up at trynia.ai to get an API key.
process.env.NIA_API_KEY = "nk_...";
It’s also helpful (but not needed) to set up LangSmith for best-in-class observability:
process.env.LANGSMITH_TRACING = "true";
process.env.LANGSMITH_API_KEY = "your-api-key";

Instantiation

Using the toolkit

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

import { NiaSearch } from "@nozomioai/langchain-nia";

const tool = new NiaSearch();

Invocation

Search across indexed sources

import { NiaSearch } from "@nozomioai/langchain-nia";

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

Search the web

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

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

ToolDescription
NiaSearchSemantic search across indexed repos, docs, and data sources
NiaWebSearchWeb search with category filtering and date range
NiaDeepResearchMulti-step comprehensive research
NiaUniversalSearchSearch all sources simultaneously
NiaAdvisorAnalyze code against indexed documentation
NiaIndexIndex new sources (repos, docs, papers, datasets)
NiaSourceListList indexed sources with filtering
NiaSourceSubscribeSubscribe to pre-indexed public sources
NiaSourceSyncRe-sync sources to pull latest changes
NiaReadRead files/pages from indexed sources
NiaGrepRegex search within indexed sources
NiaExploreBrowse file tree of indexed sources
NiaGitHubSearchSearch code in GitHub repositories
NiaGitHubReadRead files from GitHub repos
NiaGitHubGlobFind files matching glob patterns
NiaGitHubTreeBrowse repo file tree
NiaContextSaveSave context for cross-agent sharing
NiaContextSearchSemantic search over saved contexts
NiaDependencySubscribeAuto-subscribe to docs for project dependencies
NiaDependencyAnalyzePreview indexable dependencies from a manifest

API reference

For detailed documentation, see the langchain-nia GitHub repository.