langchain

द्वारा langchain-ai

पूर्वनिर्मित आर्किटेक्चर और किसी भी मॉडल या टूल के लिए एकीकरण के साथ एजेंट बनाएं। टूल-कॉलिंग एजेंट बनाते समय, मॉडल प्रदाता बदलते समय, या जोड़ते समय उपयोग करें…

npx skills add https://github.com/langchain-ai/docs --skill langchain

LangChain

LangChain is an open-source framework with a prebuilt agent architecture and integrations for any model or tool. Build agents and LLM-powered applications in under 10 lines of code, with integrations for OpenAI, Anthropic, Google, and hundreds more.

When to use

Use LangChain when you need to:

  • Build tool-calling agents with create_agent() and a prebuilt agent loop
  • Switch model providers without changing application code via init_chat_model()
  • Add structured output to parse LLM responses into typed objects
  • Integrate with any model or tool using LangChain's provider packages
  • Use middleware for cross-cutting concerns like rate limiting and caching

When NOT to use

  • For complex multi-step workflows with custom control flow, use LangGraph instead
  • For a batteries-included agent with planning, subagents, and context management, use Deep Agents instead
  • LangChain provides the core building blocks; LangGraph adds orchestration; Deep Agents adds high-level capabilities on top

Install

# Python
pip install -U langchain

# JavaScript/TypeScript
npm install langchain @langchain/core

Install a provider integration:

# Python
pip install -U langchain-openai       # or langchain-anthropic, langchain-google-genai

# JavaScript/TypeScript
npm install @langchain/openai         # or @langchain/anthropic, @langchain/google-genai

Quick reference

Create an agent

from langchain.agents import create_agent

def get_weather(city: str) -> str:
    """Get weather for a given city."""
    return f"It's always sunny in {city}!"

agent = create_agent(
    model="openai:gpt-5.5",
    tools=[get_weather],
    system_prompt="You are a helpful assistant",
)

result = agent.invoke(
    {"messages": [{"role": "user", "content": "What is the weather in SF?"}]}
)

Initialize a chat model

from langchain.chat_models import init_chat_model

# Switch providers by changing the string
model = init_chat_model("openai:gpt-5.5")
model = init_chat_model("anthropic:claude-opus-4-8")
model = init_chat_model("google_genai:gemini-3.6-flash")

Define a tool

from langchain.tools import tool

@tool
def search(query: str) -> str:
    """Search the web for information."""
    return "search results"

Gotchas

  1. Snake_case tool names—Tool function names must be valid Python identifiers. Use get_weather, not get-weather.
  2. Reserved parameters—Do not name tool parameters type, name, or description as these conflict with the tool schema.
  3. Provider packages—Models live in separate packages (e.g., langchain-openai). The base langchain package does not include providers.
  4. Model string format—Use "provider:model-name" format with init_chat_model() (e.g., "openai:gpt-5.5").

Key documentation

API reference

For SDK class and method details, use the LangChain API Reference site:

  • Browse: https://reference.langchain.com/python/langchain-core
  • MCP server: https://reference.langchain.com/mcp

Related skills

  • langgraph—Low-level orchestration for stateful, durable agent workflows
  • deep-agents—Batteries-included agent harness built on LangChain
  • langsmith—Trace, evaluate, and deploy your LangChain agents

langchain-ai की और Skills

langgraph-docs
langchain-ai
LangGraph दस्तावेज़ीकरण तक पहुँचकर स्टेटफुल एजेंट और मल्टी-एजेंट वर्कफ़्लो बनाएँ। स्टेट मशीन, ग्राफ़-आधारित एजेंट डिज़ाइन और ह्यूमन-इन-द-लूप पैटर्न को कवर करने वाले आधिकारिक LangGraph Python दस्तावेज़ प्राप्त करता है। प्रश्न प्रकार के अनुसार प्रासंगिक दस्तावेज़ीकरण को प्राथमिकता देता है: कैसे-करें प्रश्नों के लिए कार्यान्वयन गाइड, सिद्धांत के लिए अवधारणा पृष्ठ, एंड-टू-एंड उदाहरण
official
langgraph-human-in-the-loop
langchain-ai
ग्राफ निष्पादन को मानव समीक्षा, अनुमोदन या सत्यापन के लिए रोकें, फिर उनके इनपुट के साथ पुनः शुरू करें। तीन घटकों की आवश्यकता है: एक चेकपॉइंटर (InMemorySaver या PostgresSaver), कॉन्फ़िग में एक थ्रेड आईडी, और JSON-सीरियलाइज़ेबल इंटरप्ट पेलोड। interrupt(value) रुकता है और डेटा सतह पर लाता है; Command(resume=value) पुनः शुरू करता है और उस मान को रुके हुए नोड पर लौटाता है। interrupt() से पहले का सारा कोड पुनः शुरू हो
official
web-research
langchain-ai
वेब अनुसंधान से संबंधित अनुरोधों के लिए इस कौशल का उपयोग करें; यह व्यापक वेब अनुसंधान करने के लिए एक संरचित दृष्टिकोण प्रदान करता है
official
langchain-oss-primer
langchain-ai
किसी भी LangChain, Deep Agents या LangGraph एजेंट निर्माण प्रोजेक्ट के लिए हमेशा यहाँ से शुरू करें। अन्य कौशल चुनने या कुछ भी लिखने से पहले आवश्यक प्रारंभिक बिंदु।
official
skill-creator
langchain-ai
प्रभावी कौशल बनाने के लिए मार्गदर्शिका जो विशेष ज्ञान, कार्यप्रवाह या उपकरण एकीकरण के साथ एजेंट क्षमताओं का विस्तार करते हैं। इस कौशल का उपयोग तब करें जब उपयोगकर्ता…
official
social-media
langchain-ai
प्लेटफ़ॉर्म-विशिष्ट सोशल मीडिया पोस्ट तैयार करता है, जिसमें शोध-समर्थित सामग्री और जनरेटेड सहायक चित्र शामिल होते हैं। लिंक्डइन पोस्ट (1,300 अक्षर, पेशेवर लहजे के साथ) और ट्विटर/एक्स थ्रेड (प्रति ट्वीट 280 अक्षर, 1/🧵 प्रारूप के साथ) का समर्थन करता है। लिखने से पहले एक उप-एजेंट को शोध सौंपने की आवश्यकता होती है, फिर सटीकता और प्रासंगिकता सुनिश्चित करने के लिए निष्कर्ष पढ़ता है। generate_social_image टूल का
official
deep-agents-memory
langchain-ai
डीप एजेंट्स के लिए प्लग करने योग्य मेमोरी और फ़ाइल बैकएंड, जिसमें एफेमरल, पर्सिस्टेंट और हाइब्रिड रूटिंग विकल्प हैं। चार बैकएंड प्रकार: स्टेटबैकएंड (थ्रेड-स्कोप्ड, एफेमरल), स्टोरबैकएंड (क्रॉस-सेशन पर्सिस्टेंट), फ़ाइलसिस्टमबैकएंड (स्थानीय डेव के लिए वास्तविक डिस्क एक्सेस), और कम्पोजिटबैकएंड (विभिन्न पथों को विभिन्न बैकएंड पर रूट करता है)। फ़
official
deep-agents-orchestration
langchain-ai
उप-एजेंटों का समन्वय करें, बहु-चरणीय कार्यों की योजना बनाएं, और संवेदनशील संचालन के लिए मानव अनुमोदन आवश्यक है। कार्य उपकरण के माध्यम से विशिष्ट उप-एजेंटों को कार्य सौंपें; कस्टम उप-एजेंट पृथक उपकरण सेट और सिस्टम प्रॉम्प्ट का समर्थन करते हैं, जबकि डिफ़ॉल्ट "सामान्य-उद्देश्य" उप-एजेंट मुख्य एजेंट कॉन्फ़िगरेशन प्राप्त करता है। write_todos के साथ जटिल वर्कफ़्लो की योजना ब
official