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.
npx agentmods add agents/xt765/langchain-chinese-comment/loadinggit clone --depth 1 https://github.com/xt765/LangChain-Chinese-CommentWhat 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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00000 | $0.00520 |
| Opus 5 | $0.00000 | $0.00260 |
| Sonnet 5 | $0.00000 | $0.00104 |
| Haiku 4.5 | $0.00000 | $0.00052 |
Grade A, and why
loading scanned grade A with 0 findings 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 2d ago.
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.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
What it actually says
libs\langchain\langchain_classic\agents\loading.py
此文档提供了 libs\langchain\langchain_classic\agents\loading.py 文件的详细中文注释。该模块定义了从配置文件(JSON 或 YAML)中加载代理的逻辑。
功能描述
该模块实现了代理的序列化加载机制,支持从本地文件或远程配置中恢复代理对象。它主要处理配置字典到代理实例的转换。
主要函数
1. load_agent_from_config(config, ...)
从配置字典加载代理。
_type映射: 根据配置中的_type字段,在 AGENT_TO_CLASS 中查找对应的代理类。- 两种加载路径:
- 基于 LLM 和工具: 如果
load_from_llm_and_tools为 True,则调用from_llm_and_tools。这通常用于需要根据工具描述动态生成提示词的 ReAct 代理。 - 基于 LLM 链: 如果提供了
llm_chain或llm_chain_path,则直接加载底层的 LLMChain。
- 基于 LLM 和工具: 如果
2. load_agent(path, ...)
从文件路径(JSON/YAML)或远程 URL 加载代理。
- URL 基准: 默认指向早期的
langchain-hub仓库 (https://raw.githubusercontent.com/hwchase17/langchain-hub/master/agents/)。
弃用说明
该模块及其加载函数已被标记为弃用。
弃用原因
- 序列化限制: 基于配置字典的加载方式难以处理复杂的 Python 对象(如自定义回调或复杂的工具逻辑)。
- 工具升级: LangChain 现代推荐使用 LangSmith Hub 来管理和加载提示词及代理配置。
迁移建议
- 避免使用基于 YAML/JSON 的本地代理配置。
- 使用
langchain.hub.pull从 LangSmith Hub 拉取提示词模板。 - 使用代码显式创建代理(如
create_react_agent),这更符合类型检查和现代工程实践。
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.
- 2d ago First seen · 39 lines · 0 tokens per session scan A f37bdf697468
loading is an agent published in the GitHub repository xt765/LangChain-Chinese-Comment (20 stars, last pushed 1mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 520 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other agents, from other repositories
observer
Background agent that analyzes session observations to detect patterns and create instincts. Uses Haiku for cost-efficiency.
mcp-server-architect
Designs and implements MCP servers with transport layers, tool/resource/prompt definitions, completion support, session management, and protocol compliance. Specializes in FastMCP 2.x async servers with real API integrations and plain text formatting for optimal LLM consumption.
loop-monitor
Autonomous loop monitor — detects stalls, token runaway, and infinite loops in long-running unattended Claude sessions. Use alongside a watchdog process when running autonomous pipelines.
claude-code-guide
Expert on the Claude Code Ultimate Guide. Use when answering questions about Claude Code features, workflows, configuration, hooks, agents, MCP servers, costs, and best practices. Searches the guide before answering. Cites file + line sources.
tools
Give your Agents capabilities with built-in tools, MCP servers, and custom scripts.
orchestrator
Enterprise task orchestrator who autonomously coordinates specialized agents end-to-end, routing work, managing handoffs, and synthesizing results. Classifies complexity, triages delegation, and sequences workflows. Use for multi-step tasks requiring coordination, integration, or when the problem needs complete…