Skip to main content

Documentation Index

Fetch the complete documentation index at: https://langchain-5e9cc07a-preview-naomid-1779801766-572e290.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Agent = Model + Harness. LangChain provides create_agent: a minimal, highly configurable harness. The harness is everything around the model loop: the prompt, the tools, and any middleware that shapes behavior. Start with the primitives and compose exactly what your use case needs. Supports OpenAI, Anthropic, Google, and more.
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 directly.Use LangChain (create_agent) for a highly customizable harness, easily tailored to your use case and data.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 Engine tab.

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.4",
  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.

Highly configurable harness

create_agent is a minimal harness: model, tools, prompt, loop. Extend it with middleware: each piece handles one concern and composes freely. Build exactly the agent your use case needs, nothing more.
https://mintcdn.com/langchain-5e9cc07a-preview-naomid-1779801766-572e290/6RbEWE7Do9dF_T0O/images/brand/langgraph-icon.png?fit=max&auto=format&n=6RbEWE7Do9dF_T0O&q=85&s=aff8be39802806235f911600947fdeb6

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-naomid-1779801766-572e290/6RbEWE7Do9dF_T0O/images/brand/observability-icon-dark.png?fit=max&auto=format&n=6RbEWE7Do9dF_T0O&q=85&s=3ab00f11da6c5e80aa0c6bb5d1a61abb

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.