Langchain Dependencies

作者 langchain-ai16a992f09ab3無授權條款1.2K 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫2 天前更新

INVOKE THIS SKILL when setting up a new project or when asked about package versions, installation, or dependency management for LangChain, LangGraph, LangSmith, or Deep Agents. Covers required packages, minimum versions, environment requirements, versioning best practices, and common community tool packages for both Python and TypeScript.

AI 產生的概覽

關於 LangChain 生態系套件、版本與 Python/TypeScript 專案環境設定的參考指南。

功能
提供在 Python 與 TypeScript 中選擇及管理 LangChain、LangGraph、LangSmith 與 Deep Agents 套件版本的參考。內容涵蓋必要套件、最低版本、執行環境需求、模型與工具整合、環境變數以及最小相依性範本。也說明版本策略、升級策略與常見相依性錯誤。
適用情境
適用於建立新的 LangChain、LangGraph、LangSmith 或 Deep Agents 專案時,或被詢問套件版本、安裝或相依性管理時。也適合排查版本衝突或選擇 LangGraph 與 Deep Agents 時使用。
執行需求
沒有指令碼,僅為說明性內容。指南針對 Python 3.10+ 或 Node.js 20+ 專案,並提及 LANGSMITH_API_KEY 及模型供應商金鑰等環境變數,但技能本身除代理外無需其他相依項目。

<overview>

The LangChain ecosystem is split into focused, independently-versioned packages. Understanding which packages you need — and their version constraints — prevents incompatibilities and keeps upgrades predictable.

Key principles:

  • LangChain 1.0 is the current LTS release. Always start new projects on 1.0+. LangChain 0.3 is legacy maintenance-only — do not use it for new work.
  • langchain-core is the shared foundation: always install it explicitly alongside any other package.
  • langchain-community (Python only) does NOT follow semantic versioning; pin it conservatively.
  • LangGraph vs Deep Agents: choose one orchestration approach based on your use case — they are alternatives, not a required stack (see Framework Choice below).
  • Provider integrations (model, vector store, tools) are installed separately so you only pull in what you use.

</overview>


Environment Requirements

<environment-requirements>

RequirementPythonTypeScript / Node
Runtime minimumPython 3.10+Node.js 20+
LangChain1.0+ (LTS)1.0+ (LTS)
LangSmith SDK>= 0.3.0>= 0.3.0

</environment-requirements>


Framework Choice

<framework-choice>

Pick one agent orchestration layer. You do not need both.

FrameworkWhen to useCore extra package
LangGraphNeed fine-grained graph control, custom workflows, loops, or branchinglanggraph / @langchain/langgraph
Deep AgentsWant batteries-included planning, memory, file context, and skills out of the boxdeepagents (depends on LangGraph; installs it as a transitive dep)

Both sit on top of langchain + langchain-core + langsmith.

</framework-choice>


Core Packages

<python-packages>

Python — always required

PackageRoleMin version
langchainAgents, chains, retrieval1.0
langchain-coreBase types & interfaces (peer dep)1.0
langsmithTracing, evaluation, datasets0.3.0

Python — orchestration (pick one)

PackageUse whenMin version
langgraphBuilding custom graphs directly1.0
deepagentsUsing the Deep Agents frameworklatest

Python — model providers (pick the one(s) you use)

PackageProvider
langchain-openaiOpenAI (GPT-4o, o3, …)
langchain-anthropicAnthropic (Claude)
langchain-google-genaiGoogle (Gemini)
langchain-mistralaiMistral
langchain-groqGroq (fast inference)
langchain-cohereCohere
langchain-fireworksFireworks AI
langchain-togetherTogether AI
langchain-huggingfaceHugging Face Hub
langchain-ollamaOllama (local models)
langchain-awsAWS Bedrock
langchain-azure-aiAzure AI Foundry

Python — common tool & retrieval packages

These packages have tighter compatibility requirements — use the latest available version unless you have a specific reason not to.

PackageAddsNotes
langchain-tavilyTavily web search (TavilySearch)Dedicated integration package; prefer latest
langchain-text-splittersText chunking utilitiesSemver, keep current
langchain-community1000+ integrations (fallback)NOT semver — pin to minor series
faiss-cpuFAISS vector store (local)Via langchain-community; use latest
langchain-chromaChroma vector storeDedicated integration package; prefer latest
langchain-pineconePinecone vector storeDedicated integration package; prefer latest
langchain-qdrantQdrant vector storeDedicated integration package; prefer latest
langchain-weaviateWeaviate vector storeDedicated integration package; prefer latest
langsmith[pytest]pytest plugin for LangSmithRequires langsmith >= 0.3.4

langchain-community stability note: This package is NOT on semantic versioning. Minor releases can contain breaking changes. Prefer dedicated integration packages (e.g. langchain-chroma, langchain-tavily) when they exist — they are independently versioned and more stable.

</python-packages>

<typescript-packages>

TypeScript — always required

PackageRoleMin version
@langchain/coreBase types & interfaces (peer dep)1.0
langchainAgents, chains, retrieval1.0
langsmithTracing, evaluation, datasets0.3.0

TypeScript — orchestration (pick one)

PackageUse whenMin version
@langchain/langgraphBuilding custom graphs directly1.0
deepagentsUsing the Deep Agents frameworklatest

TypeScript — model providers (pick the one(s) you use)

PackageProvider
@langchain/openaiOpenAI (GPT-4o, o3, …)
@langchain/anthropicAnthropic (Claude)
@langchain/google-genaiGoogle (Gemini)
@langchain/mistralaiMistral
@langchain/groqGroq (fast inference)
@langchain/cohereCohere
@langchain/awsAWS Bedrock
@langchain/azure-openaiAzure OpenAI
@langchain/ollamaOllama (local models)

TypeScript — common tool & retrieval packages

PackageAddsNotes
@langchain/tavilyTavily web search (TavilySearch)Dedicated integration package; prefer latest
@langchain/communityBroad set of community integrationsUse sparingly; prefer dedicated packages
@langchain/pineconePinecone vector storeDedicated integration package; prefer latest
@langchain/qdrantQdrant vector storeDedicated integration package; prefer latest
@langchain/weaviateWeaviate vector storeDedicated integration package; prefer latest

@langchain/core must be installed explicitly in yarn workspaces and monorepos — it is a peer dependency and will not always be hoisted automatically.

</typescript-packages>


Minimal Project Templates

<ex-langgraph-python>

<python>

Minimal dependency set for a LangGraph project (provider-agnostic).

# requirements.txtlangchain>=1.0,<2.0langchain-core>=1.0,<2.0langgraph>=1.0,<2.0langsmith>=0.3.0
# Add your model provider, e.g.:# langchain-openai# langchain-anthropic# langchain-google-genai

</python>

</ex-langgraph-python>

<ex-langgraph-typescript>

<typescript>

Minimal package.json dependencies for a LangGraph project (provider-agnostic).

json
{  "dependencies": {    "@langchain/core": "^1.0.0",    "langchain": "^1.0.0",    "@langchain/langgraph": "^1.0.0",    "langsmith": "^0.3.0"  }}

</typescript>

</ex-langgraph-typescript>

<ex-deepagents-python>

<python>

Minimal dependency set for a Deep Agents project (provider-agnostic).

# requirements.txtdeepagents            # bundles langgraph internallylangchain>=1.0,<2.0langchain-core>=1.0,<2.0langsmith>=0.3.0
# Add your model provider, e.g.:# langchain-anthropic# langchain-openai

</python>

</ex-deepagents-python>

<ex-deepagents-typescript>

<typescript>

Minimal package.json dependencies for a Deep Agents project (provider-agnostic).

json
{  "dependencies": {    "deepagents": "latest",    "@langchain/core": "^1.0.0",    "langchain": "^1.0.0",    "langsmith": "^0.3.0"  }}

</typescript>

</ex-deepagents-typescript>

<ex-with-tools-python>

<python>

Adding Tavily search and a vector store to a LangGraph project.

# requirements.txtlangchain>=1.0,<2.0langchain-core>=1.0,<2.0langgraph>=1.0,<2.0langsmith>=0.3.0
# Web searchlangchain-tavily          # use latest; partner package, semver
# Vector store — pick one:langchain-chroma          # use latest; partner package, semver# langchain-pinecone      # use latest; partner package, semver# langchain-qdrant        # use latest; partner package, semver
# Text processinglangchain-text-splitters  # use latest; semver
# Your model provider:# langchain-openai / langchain-anthropic / etc.

</python>

</ex-with-tools-python>

<ex-with-tools-typescript>

<typescript>

Adding Tavily search and a vector store to a LangGraph project.

json
{  "dependencies": {    "@langchain/core": "^1.0.0",    "langchain": "^1.0.0",    "@langchain/langgraph": "^1.0.0",    "langsmith": "^0.3.0",    "@langchain/tavily": "latest",    "@langchain/pinecone": "latest"  }}

</typescript>

</ex-with-tools-typescript>


Versioning Policy & Upgrade Strategy

<versioning-policy>

Package groupVersioningSafe upgrade strategy
langchain, langchain-coreStrict semver (1.0 LTS)Allow minor: >=1.0,<2.0
langgraph / @langchain/langgraphStrict semver (v1 LTS)Allow minor: >=1.0,<2.0
langsmithStrict semverAllow minor: >=0.3.0
Dedicated integration packages (e.g. langchain-tavily, langchain-chroma)Independently versionedAllow minor updates; use latest
langchain-communityNOT semverPin exact minor: >=0.4.0,<0.5.0
deepagentsFollow project releasesPin to tested version in production

Breaking changes only happen in major versions (1.x → 2.x) for all semver-compliant packages. Deprecated features remain functional across the entire 1.x series with warnings.

Prefer dedicated integration packages over langchain-community. When a dedicated package exists (e.g. langchain-chroma instead of langchain-community's Chroma integration), use it — dedicated packages are independently versioned and better tested.

Community tool packages (Tavily, vector stores, etc.) should be kept at latest unless your project requires a locked environment. These packages frequently release compatibility fixes alongside LangChain/LangGraph updates.

</versioning-policy>


Environment Variables

<environment-variables>

All keys are read from the environment at runtime. Set only the keys for services you actually use.

bash
# LangSmith (always recommended for observability)LANGSMITH_API_KEY=<your-key>LANGSMITH_PROJECT=<project-name>   # optional, defaults to "default"
# Model provider — set the one(s) you useOPENAI_API_KEY=<your-key>ANTHROPIC_API_KEY=<your-key>GOOGLE_API_KEY=<your-key>MISTRAL_API_KEY=<your-key>GROQ_API_KEY=<your-key>COHERE_API_KEY=<your-key>FIREWORKS_API_KEY=<your-key>TOGETHER_API_KEY=<your-key>HUGGINGFACEHUB_API_TOKEN=<your-key>
# Common tool/retrieval servicesTAVILY_API_KEY=<your-key>          # for Tavily searchPINECONE_API_KEY=<your-key>        # for Pinecone

</environment-variables>


Common Mistakes

<fix-legacy-version>

Never start a new project on LangChain 0.3. It is maintenance-only until December 2026.

# WRONG: legacy, no new features, security patches onlylangchain>=0.3,<0.4
# CORRECT: LangChain 1.0 LTSlangchain>=1.0,<2.0

</fix-legacy-version>

<fix-community-unpinned>

langchain-community can break on minor version bumps — it does not follow semver.

# WRONG: allows minor-version updates that may be breakinglangchain-community>=0.4
# CORRECT: pin to exact minor serieslangchain-community>=0.4.0,<0.5.0

Also consider switching to the equivalent dedicated integration package if one exists (e.g. langchain-chroma instead of the community Chroma integration).

</fix-community-unpinned>

<fix-community-tool-outdated>

Community tool packages like langchain-tavily and vector store integrations release compatibility fixes alongside LangChain updates. Using an old pinned version can cause import errors or broken tool schemas.

# RISKY: old pin may be incompatible with LangChain 1.0langchain-tavily==0.0.1
# BETTER: allow latest within the current majorlangchain-tavily>=0.1

</fix-community-tool-outdated>

<fix-community-import-deprecated>

Many tools that used to live in langchain-community now have dedicated packages with updated import paths. Always prefer the dedicated package import.

python
# WRONG — deprecated community import pathfrom langchain_community.tools.tavily_search import TavilySearchResultsfrom langchain_community.tools import WikipediaQueryRunfrom langchain_community.vectorstores import Chromafrom langchain_community.vectorstores import Pinecone
# CORRECT — use dedicated package importsfrom langchain_tavily import TavilySearch                  # pip: langchain-tavily (TavilySearchResults is deprecated)from langchain_community.tools import WikipediaQueryRun  # no dedicated pkg yetfrom langchain_chroma import Chroma                       # pip: langchain-chromafrom langchain_pinecone import PineconeVectorStore        # pip: langchain-pinecone

To find the current canonical import for any integration, search the integrations directory: https://python.langchain.com/docs/integrations/tools/

Each entry shows the correct package and import path. If a dedicated package exists, use it — the community path may still work but is considered legacy.

</fix-community-import-deprecated>

<fix-core-not-installed>

<typescript>

@langchain/core is a peer dependency — it must be in your package.json, especially in monorepos.

json
// WRONG: missing @langchain/core (breaks in yarn workspaces / strict hoisting){  "dependencies": {    "@langchain/langgraph": "^1.0.0"  }}
// CORRECT: always list @langchain/core explicitly{  "dependencies": {    "@langchain/core": "^1.0.0",    "@langchain/langgraph": "^1.0.0"  }}

</typescript>

</fix-core-not-installed>

<fix-python-version>

<python>

Python 3.9 and below are not supported by LangChain 1.0.

python
# Verify before installingimport sysassert sys.version_info >= (3, 10), "Python 3.10+ required for LangChain 1.0"

</python>

</fix-python-version>

<fix-node-version>

<typescript>

Node.js below 20 is not officially supported.

bash
# Verify before installingnode --version   # must be v20.x or higher

</typescript>

</fix-node-version>

來源與署名

來源:langchain-ai/langchain-skills位於config/skills/langchain-dependencies提交16a992f

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架