langchain

langchain is a skill for Claude Code, Codex from znlgis/opengis-skills. It costs 93 tokens per session (4,998 once invoked), scanned A, original, MIT.

A Python framework for connecting language models with prompts, tools, documents, and application logic. It provides reusable pipelines, tool-using agents, document retrieval, and short-term conversation state.

In plain words
What is it for?
Use it to build model pipelines, tool-calling agents, document question-answering systems, chat memory, and applications that query vector stores or databases.
Why use it?
It reduces the glue code needed to combine a model with data sources, Python functions, and multi-step actions. Retrieval-augmented generation (RAG) uses retrieved document sections to ground a model's answer.

Skill for Claude CodeCodex

Which agent this was written for is unclear — built for openclaw. Also seen: built for openclaw.

Good fit Use it to build model pipelines, tool-calling agents, document question-answering systems, chat memory, and applications that query vector stores or databases.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/znlgis/opengis-skills/langchain
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add znlgis/opengis-skills --skill langchain
Clone the repo
git clone --depth 1 https://github.com/znlgis/opengis-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for langchain

README.md
[![agentmods](https://agentmods.dev/badge/skills/znlgis/opengis-skills/langchain/github.svg)](https://agentmods.dev/skills/znlgis/opengis-skills/langchain)
Your own site
<a href="https://agentmods.dev/skills/znlgis/opengis-skills/langchain"><img src="https://agentmods.dev/badge/skills/znlgis/opengis-skills/langchain/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for langchain

Your own site · 80×15
<a href="https://agentmods.dev/skills/znlgis/opengis-skills/langchain"><img src="https://agentmods.dev/badge/skills/znlgis/opengis-skills/langchain.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 93 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,998 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00093 $0.04998
Opus 5.5 $0.00037 $0.01999
Sonnet 5.5 $0.00019 $0.01000
Haiku 4.5 $0.00009 $0.00500

Measured today against content hash 62f3bfd31234, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

langchain scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

proc = subprocess.run(args, capture_output=True, text=True, timeout=120)
ai/langchain/SKILL.md · 442 lines

How it starts

The opening of the file, as written. The whole thing — 442 lines — stays where its author put it; the contents beside it link to each section on GitHub.

项目地址: https://github.com/langchain-ai/langchain

官方文档: https://python.langchain.com/(现重定向至 https://docs.langchain.com/oss/python/langchain/overview)

许可证: MIT 最新版本: langchain 1.4.6、langchain-core 1.6.10(PyPI,2026-10;GitHub 最新 Release 标签为 langchain-core==1.6.10,LangChain 已按包独立发版)

概述

LangChain 是用于构建 LLM 应用的 Python 框架,1.x 起以 LangGraph 为运行时,官方推荐入口为 create_agent 与 LCEL 管道语法。

  • 模型层:init_chat_model 统一初始化 OpenAI / Anthropic / Google / DeepSeek / Ollama 等模型
  • LCEL:prompt | model | parser 声明式组合 Runnable,天然支持 invoke / batch / stream
  • Agents:create_agent 构建工具调用循环(Tool Calling Loop),基于 LangGraph 图执行
  • Tools:@tool 装饰器把 Python 函数暴露给模型
  • RAG:文档加载(langchain-community)→ 切分(langchain-text-splitters)→ 向量库 → 检索器
  • 记忆:短期会话用 checkpointer + thread_id;长期记忆用 store(均来自 LangGraph)
  • 包拆分:主包 langchain、接口层 langchain-core、社区集成 langchain-community、各 provider 独立包

包家族与版本(2026-10):

包 内容 当前版本
langchain 主包:agents、chat_models、tools 1.4.6
langchain-core Runnable/LCEL、消息、提示词、解析器、向量库接口 1.6.10
langgraph 运行时:checkpointer、store 1.2.15
langchain-community 社区集成:文档加载器、向量库 0.4.2
langchain-openai OpenAI / Azure 集成 1.7.2
langchain-text-splitters 文本切分器 1.1.3
langchain-classic 旧版链与 memory(兼容维护) 1.0.8

环境准备

安装

# pip(要求 Python >= 3.10,官方 quickstart 建议 3.11)
pip install -U langchain

# provider 集成是 extras,按需安装
pip install -U "langchain[openai]"
pip install -U "langchain[deepseek]"
pip install -U "langchain[community]"        # 文档加载器等社区集成

# RAG 常用配套
pip install -U langchain-text-splitters langchain-postgres pypdf
# uv(官方推荐流程)
uv python pin 3.11
uv init
uv add langchain
uv sync

API Key 配置

export OPENAI_API_KEY="sk-..."
export DEEPSEEK_API_KEY="sk-..."          # 使用 DeepSeek 时
export ANTHROPIC_API_KEY="sk-ant-..."     # 使用 Claude 时

在代码中加载 .env(需 pip install python-dotenv):

from dotenv import load_dotenv

load_dotenv()

Read the full file on GitHub · 442 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. today First seen · 442 lines · 93 tokens per session scan A 62f3bfd31234

Subscribe to this mod's changes

langchain is a skill published in the GitHub repository znlgis/opengis-skills (64 stars, last pushed yesterday), licensed MIT. It adds 93 tokens to every session and 4,998 once invoked, about $0.0004 per session on Opus 5.5. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-16.