TanStack AI
@pipe0/tanstack-ai gives chats built with TanStack AI three server 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.
| Tool | What it does |
|---|---|
find_people | Runs a search for people by job title, employer, seniority, job function, company size, and location. |
enrich_person | Runs waterfall pipes that find a work email, mobile number, and profile from a LinkedIn URL, an email, or a name and company domain. |
enrich_company | Runs a pipe that adds firmographics for a company domain: description, industry, headcount, revenue, and founding year. |
Install
npm install @pipe0/tanstack-ai @tanstack/ai zodThe package needs @tanstack/ai 0.63 or later and zod 4 as peer dependencies.
Set your API key
The tools read your pipe0 API key from PIPE0_API_KEY. See Authentication to create one.
PIPE0_API_KEY=your-api-keyTo pass the key in code instead, use the apiKey option.
Give your chat the tools
pipe0Tools() returns all three tools as an array. Pass them to chat() in your server route:
import { chat, toServerSentEventsResponse } from "@tanstack/ai";
import { openaiText } from "@tanstack/ai-openai";
import { pipe0Tools } from "@pipe0/tanstack-ai";
export async function POST(request: Request) {
const { messages } = await request.json();
const stream = chat({
adapter: openaiText("gpt-5-mini"),
messages,
tools: pipe0Tools(),
});
return toServerSentEventsResponse(stream);
}The model calls find_people to find the person, then passes their LinkedIn URL to enrich_person to get the
work email. The tools run on your server, and TanStack AI feeds each result back to the model. When a search
returns no one, the tool tells the model which filter to drop, so it can widen the search and try again.
To use only some tools, create them one by one:
import { enrichCompany, enrichPerson } from "@pipe0/tanstack-ai";
const tools = [enrichPerson(), enrichCompany()];Options
Every tool and pipe0Tools take the same options:
| Option | Type | Description |
|---|---|---|
apiKey | string | Your pipe0 API key. Defaults to process.env.PIPE0_API_KEY. |
environment | "production" | "sandbox" | sandbox returns free placeholder data while you build. Defaults to production. |
needsApproval | boolean | Pauses the run for user approval before the tool executes. Defaults to false. |
client | Pipe0 | A 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. Set needsApproval on the tools
that need it:
const stream = chat({
adapter: openaiText("gpt-5-mini"),
messages,
tools: [findPeople(), enrichPerson({ needsApproval: true })],
});find_people still runs on its own. When the model calls enrich_person, the run pauses with an approval
request instead of running the tool. The call runs after the client sends back the user's approval. See
Tool Approval Flow in the TanStack AI 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.