logo-darkPipe0

LangChain

@pipe0/langchain gives agents built with LangChain.js three tools: one finds people, two enrich people and companies. Your agent calls them like any other tool, and pipe0 queries dozens of data providers behind one API key.

ToolWhat it does
find_peopleRuns a search for people by job title, employer, seniority, job function, company size, and location.
enrich_personRuns waterfall pipes that find a work email, mobile number, and profile from a LinkedIn URL, an email, or a name and company domain.
enrich_companyRuns a pipe that adds firmographics for a company domain: description, industry, headcount, revenue, and founding year.

Install

npm install @pipe0/langchain @langchain/core

The package works with @langchain/core 0.3 or later and needs zod as a peer dependency.

Set your API key

The tools read your pipe0 API key from PIPE0_API_KEY. See Authentication to create one.

.env
PIPE0_API_KEY=your-api-key

To pass the key in code instead, use the apiKey option.

Give your agent the tools

pipe0Tools() returns all three tools as an array. Pass them to createAgent:

Find a person and their work email
import { createAgent } from "langchain";
import { pipe0Tools } from "@pipe0/langchain";

const agent = createAgent({
  model: "openai:gpt-5-mini",
  tools: pipe0Tools(),
});

const result = await agent.invoke({
  messages: [{ role: "user", content: "Find the CTO of Linear and get their work email." }],
});

The model calls find_people to find the person, then passes their LinkedIn URL to enrich_person to get the work email. When a search returns no one, the tool tells the model which filter to drop, so it can widen the search and try again.

Each tool returns a JSON string, so the tools also work in LangGraph graphs and with any chat model that supports tool calling. To use only some tools, create them one by one:

Pick individual tools
import { enrichCompany, enrichPerson } from "@pipe0/langchain";

const tools = [enrichPerson(), enrichCompany()];

Options

Every tool and pipe0Tools take the same options:

OptionTypeDescription
apiKeystringYour pipe0 API key. Defaults to process.env.PIPE0_API_KEY.
environment"production" | "sandbox"sandbox returns free placeholder data while you build. Defaults to production.
clientPipe0A configured client from the TypeScript client.

Credits

In production, every tool call spends credits. find_people costs about 0.1 credits per person returned. enrich_person starts at 0.5 credits per value found, and its waterfalls only bill the provider that returned a result. Build against sandbox, which is free.

Approve calls before they run

In agents where users trigger the calls, pause before a tool spends credits. Add LangChain's human-in-the-loop middleware and a checkpointer:

Ask before enriching a person
import { createAgent, humanInTheLoopMiddleware } from "langchain";
import { MemorySaver } from "@langchain/langgraph";
import { pipe0Tools } from "@pipe0/langchain";

const agent = createAgent({
  model: "openai:gpt-5-mini",
  tools: pipe0Tools(),
  middleware: [humanInTheLoopMiddleware({ interruptOn: { enrich_person: true } })],
  checkpointer: new MemorySaver(),
});

find_people still runs on its own. When the model calls enrich_person, the agent stops and returns an interrupt instead of running the tool. The call runs after you resume the agent with the user's decision. See Human-in-the-loop in the LangChain docs.

Keep your key and results safe

Run the tools on your server. Keep PIPE0_API_KEY out of browser bundles, because anyone with the key can spend your credits.

find_people and enrich_person return personal contact data. Use it in line with the privacy and marketing rules that apply to you, such as GDPR or CAN-SPAM, and only show results to users who are allowed to see them.

Next steps

These tools cover search and enrichment. For the full catalog, including buying signals and CRM routing, use the TypeScript client or connect your agent to the MCP server.

On this page