Skip to main content
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.

Create an agent

// First install: npm install langchain zod @langchain/openai
import { 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.2",
  tools: [getWeather],
});

console.log(
  await agent.invoke({
    messages: [{ role: "user", content: "What's the weather in San Francisco?" }],
  })
);
See the Installation instructions and Quickstart guide to get started building your own agents and applications with LangChain.
Use LangSmith to trace requests, debug agent behavior, and evaluate outputs. Set LANGSMITH_TRACING=true and your API key to get started.

Core benefits

Standard model interface

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.
https://mintcdn.com/langchain-5e9cc07a-preview-ent229-1776902294-1e29e41/dVn6EtaDdcjS6s2O/images/brand/langgraph-icon.png?fit=max&auto=format&n=dVn6EtaDdcjS6s2O&q=85&s=429cf9d0800c89e2bb4d81974a3b7a36

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.
https://mintcdn.com/langchain-5e9cc07a-preview-ent229-1776902294-1e29e41/dVn6EtaDdcjS6s2O/images/brand/observability-icon-dark.png?fit=max&auto=format&n=dVn6EtaDdcjS6s2O&q=85&s=ebad11f5af7d9408b3e4a305517fbfad

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.