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/agentgit 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.00765 |
| Opus 5 | $0.00000 | $0.00382 |
| Sonnet 5 | $0.00000 | $0.00153 |
| Haiku 4.5 | $0.00000 | $0.00076 |
Grade A, and why
agent 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 3d 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\agent.py
此文档提供了 libs\langchain\langchain_classic\agents\agent.py 文件的详细中文注释。该模块定义了 LangChain 经典代理架构的基础抽象类和核心执行器 AgentExecutor。
功能描述
该模块是代理系统的核心逻辑所在,负责定义代理如何决策(Planning)以及如何执行动作(Execution)。它支持单动作(Single Action)和多动作(Multi Action)代理,并提供了一个强大的执行环境。
核心类层级
1. 基础抽象类
BaseSingleActionAgent: 单操作代理的基类。每次决策产生一个AgentAction或AgentFinish。BaseMultiActionAgent: 多操作代理的基类。每次决策可以产生多个AgentAction。LLMSingleActionAgent: 使用LLMChain实现的单操作代理。
2. 核心执行器 AgentExecutor
AgentExecutor 是驱动代理运行的容器。它负责管理“思考-行动-观察”循环:
- Plan: 调用代理决定下一步(Action 或 Finish)。
- Execute: 如果是 Action,则执行对应的工具。
- Observe: 将工具输出作为 Observation 反馈给代理。
- Repeat: 重复循环,直到代理返回 Finish 或触发限制。
关键参数表
| 参数 | 类型 | 描述 |
|---|---|---|
agent |
BaseSingleActionAgent | BaseMultiActionAgent | Runnable |
负责决策的核心代理逻辑。 |
tools |
Sequence[BaseTool] |
代理可以访问并调用的工具集合。 |
max_iterations |
int |
最大循环步数(默认 15),防止代理进入死循环。 |
max_execution_time |
float |
最大运行时间限制。 |
early_stopping_method |
str |
强制停止时的行为:force (默认) 或 generate (尝试总结已有信息)。 |
handle_parsing_errors |
bool | str | Callable |
解析错误处理逻辑。为 True 时会将错误反馈给 LLM 修复。 |
return_intermediate_steps |
bool |
是否在结果中包含所有中间思考和工具调用过程。 |
3. Runnable 包装器
RunnableAgent: 将 LCEL 中的Runnable对象适配为单动作代理接口。RunnableMultiActionAgent: 将Runnable适配为多动作代理接口。
核心方法
Agent.plan(intermediate_steps, **kwargs)
这是代理最核心的方法。
intermediate_steps: 包含之前的动作和对应的观察结果。- 返回值: 下一个要执行的动作或最终答案。
AgentExecutor.from_agent_and_tools(...)
用于快速创建执行器的类方法,会自动处理工具验证和配置。
弃用说明
Agent 类已被标记为弃用,并计划在 1.0 版本移除。建议开发者:
- 使用
create_tool_calling_agent等工厂函数。 - 将复杂的代理逻辑迁移到 LangGraph,以获得更好的控制流和持久化支持。
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.
- 3d ago First seen · 59 lines · 0 tokens per session scan A aaa7ed9cff47
agent 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 765 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
build-error-resolver
빌드 실패·타입 에러·컴파일 오류·import 에러·의존성 이슈를 최소 변경으로 그린 복구. 리팩토링·아키텍처 변경 절대 금지. Use proactively when CI/빌드가 빨간불이거나, 터미널에 타입 에러·컴파일 에러가 표시될 때 즉시. 런타임 로직 버그는 systematic-debugger, 아키텍처 변경은 architect 사용.
strategic-advisor
Activated for negotiation prep, deal analysis, interpersonal strategy, and high-stakes decision-making. Combines game theory with psychological awareness.
integration-reviewer
Runtime integration validator — read-only. Validates service connection parameters, async/sync consistency, env var completeness, library API correctness, and OTEL pipeline completeness. Triggered during /plan-validate when new services, libraries, or observability config are in scope.
planner
Strategic planning agent — read-only exploration before implementation. Use to decompose tasks, analyze codebases, and produce a detailed plan. Never modifies files.
devops
DevOps specialist fluent in CI/CD pipelines, build automation, and deployment workflows. Thinks in reliability, security, and developer experience. Designs GitHub Actions, configures build systems, manages secrets. Use for pipeline configuration, infrastructure automation, and anything involving environments…
ticket-gate
Ticket readiness gate for actual-mcp-server (forge-kit ticket-gate v6). Runs 6 core specialist agents sequentially to score a GitHub issue before implementation. Each agent scores 1-10; ALL must score 10 to pass. An agent whose domain the ticket does not touch auto-scores 10 (N/A). Extra specialists are added by…