LangChain is an open source framework with a prebuilt agent architecture and integrations for any model or tool—so you can build agents that adapt as fast as the ecosystem evolves
Use this file to discover all available pages before exploring further.
Build completely custom agents and applications powered by LLMs in under 10 lines of code, with integrations for OpenAI, Anthropic, Google, and more.
LangChain provides a prebuilt agent architecture and model integrations to help you get started quickly and seamlessly incorporate LLMs into your agents and applications.
LangChain vs. LangGraph vs. Deep AgentsStart with Deep Agents for a “batteries-included” agent with features like automatic context compression, a virtual filesystem, and subagent-spawning. Deep Agents are built on LangChain agents which you can also use LangChain directly.Use LangGraph, our low-level orchestration framework, for advanced needs combining deterministic and agentic workflows.Use LangSmith to trace, debug, and evaluate agents built with any of these frameworks. Follow the tracing quickstart to get set up.
The LangSmith Engine detects issues in your LangChain agent traces and proposes fixes. You can open a pull request with the proposed fix directly from the Issues tab.
// First install: npm install langchain zod @langchain/openaiimport { createAgent, tool } from "langchain";import * as z from "zod";const getWeather = tool( (input) => `It's always sunny in ${input.city}!`, { name: "get_weather", description: "Get the weather for a given city", schema: z.object({ city: z.string().describe("The city to get the weather for"), }), });const agent = createAgent({ model: "gpt-5.4", tools: [getWeather],});console.log( await agent.invoke({ messages: [{ role: "user", content: "What's the weather in San Francisco?" }], }));
Different providers have unique APIs for interacting with models, including the format of responses. LangChain standardizes how you interact with models so that you can seamlessly swap providers and avoid lock-in.
Easy to use, highly flexible agent
LangChain’s agent abstraction is designed to be easy to get started with, letting you build a simple agent in under 10 lines of code. But it also provides enough flexibility to allow you to do all the context engineering your heart desires.
Built on top of LangGraph
LangChain’s agents are built on top of LangGraph. This allows us to take advantage of LangGraph’s durable execution, human-in-the-loop support, persistence, and more.
Debug with LangSmith
Gain deep visibility into complex agent behavior with visualization tools that trace execution paths, capture state transitions, and provide detailed runtime metrics.
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.