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.
The @youdotcom-oss/langchain package provides three DynamicStructuredTool instances for web search and content extraction, built for LangChain.js agents.
Setup
Install the package with your preferred package manager:
npm install @youdotcom-oss/langchain
Set your You.com API key. Get your API key at you.com/platform.
process.env.YDC_API_KEY = "your-api-key";
youSearch
Web and news search with advanced filtering (dates, sites, file types).
import { youSearch } from "@youdotcom-oss/langchain";
const searchTool = youSearch({ apiKey: process.env.YDC_API_KEY });
const result = await searchTool.invoke({ query: "latest AI developments", count: 5 });
youResearch
Comprehensive answers with cited sources. Supports configurable effort levels: lite, standard, deep, and exhaustive.
import { youResearch } from "@youdotcom-oss/langchain";
const researchTool = youResearch({ apiKey: process.env.YDC_API_KEY });
const result = await researchTool.invoke({ query: "WebAssembly vs JavaScript performance" });
youContents
Extract full page content from URLs in markdown or HTML format.
import { youContents } from "@youdotcom-oss/langchain";
const contentsTool = youContents({ apiKey: process.env.YDC_API_KEY });
const result = await contentsTool.invoke({ urls: ["https://example.com/article"] });
Use with an agent
import { createAgent, initChatModel } from "langchain";
import { youSearch, youResearch, youContents } from "@youdotcom-oss/langchain";
const model = await initChatModel("claude-haiku-4-5", { temperature: 0 });
const agent = createAgent({
model,
tools: [
youSearch(),
youResearch(),
youContents(),
],
systemPrompt: "You are a helpful research assistant. Always cite your sources.",
});
const result = await agent.invoke({
messages: [{ role: "user", content: "What are the latest developments in AI?" }],
});
For more details, see the You.com LangChain package README.