LangGraph is a framework for building stateful, multi-step agent applications as graphs. It gives you fine-grained control over agent behavior — tool routing, state management, cycles, and human-in-the-loop patterns — while staying compatible with the LangChain ecosystem.
The langchain-youdotcom package provides YouSearchTool and YouContentsTool, which plug directly into LangGraph agents to give them real-time web access.
Get your You.com API key at you.com/platform.
The fastest way to get started is create_agent, a prebuilt LangGraph agent that handles tool calling and message routing automatically.
Pass an api_wrapper to control search behavior:
LangGraph supports token-level streaming out of the box. Use astream_events to stream agent responses as they’re generated:
For more control, build a custom StateGraph. This example creates a simple search-then-summarize pipeline where the agent searches the web, then synthesizes an answer from the results:
Combine YouSearchAPIWrapper methods in a multi-step graph that searches the web, extracts full page content from the top results, and generates a comprehensive answer. The search step returns snippets and URLs (without livecrawl), then the extract step calls the Contents API to fetch full page content for the top results. This avoids fetching full content for every search result—only the most relevant URLs get crawled:
Both tools accept a YouSearchAPIWrapper via the api_wrapper parameter. Here are the key options:
YouContentsTool accepts urls: list[str] at invocation. To control the output format or crawl timeout, call api_wrapper.contents() directly:
For full parameter details, see the Search API reference and Contents API reference.