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/mrklgit clone --depth 1 https://github.com/xt765/LangChain-Chinese-CommentWrote 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.
[](https://agentmods.dev/agents/xt765/langchain-chinese-comment/mrkl)<a href="https://agentmods.dev/agents/xt765/langchain-chinese-comment/mrkl"><img src="https://agentmods.dev/badge/agents/xt765/langchain-chinese-comment/mrkl.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00000 | $0.00809 |
| Opus 5 | $0.00000 | $0.00404 |
| Sonnet 5 | $0.00000 | $0.00162 |
| Haiku 4.5 | $0.00000 | $0.00081 |
Grade A, and why
mrkl 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 5d 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.
How it starts
The opening of the file, as written. The whole thing — 89 lines — stays where its author put it; the contents beside it link to each section on GitHub.
MRKL & ReAct Agent
MRKL (Modular Reasoning, Knowledge and Language) 系统是 LangChain 中最早实现的 Agent 模式之一,主要通过 ZeroShotAgent 实现。它遵循经典的 ReAct (Reasoning and Acting) 范式。
核心机制:ReAct 范式
Agent 会在执行过程中交替进行推理(Thought)和行动(Action):
- Thought: Agent 思考当前情况。
- Action: Agent 决定调用哪个工具。
- Action Input: Agent 提供工具所需的输入。
- Observation: 工具执行后的结果。
- 重复上述步骤,直到得出 Final Answer。
核心组件
1. ZeroShotAgent
这是 MRKL 系统的核心实现类。它被称为 "Zero-shot",是因为它仅依赖于工具的名称和描述来决定如何使用它们,而不需要额外的示例。
- Prompt: 包含工具列表、格式说明(Thought/Action...)和用户问题。
- OutputParser:
MRKLOutputParser负责将 LLM 的文本输出解析为AgentAction或AgentFinish。
执行逻辑 (Verbatim Snippet)
提示词模板 (mrkl/prompt.py)
Question: {input}
Thought: {agent_scratchpad}
Action: 一定是工具列表中的一个 [{tool_names}]
Action Input: 工具的输入参数
Observation: 工具的执行结果
... (上述步骤循环)
Thought: 我现在知道最终答案了
Final Answer: 最终回答
创建提示词 (ZeroShotAgent.create_prompt)
@classmethod
def create_prompt(
cls,
tools: Sequence[BaseTool],
prefix: str = PREFIX,
suffix: str = SUFFIX,
format_instructions: str = FORMAT_INSTRUCTIONS,
input_variables: list[str] | None = None,
) -> PromptTemplate:
# 1. 渲染工具描述
tool_strings = render_text_description(list(tools))
tool_names = ", ".join([tool.name for tool in tools])
# 2. 格式化说明
format_instructions = format_instructions.format(tool_names=tool_names)
# 3. 拼接最终模板
template = f"{prefix}\n\n{tool_strings}\n\n{format_instructions}\n\n{suffix}"
return PromptTemplate.from_template(template)
迁移指南 (LangGraph)
现代 LangChain 推荐使用 LangGraph 的 create_react_agent 预置函数,它更健壮且易于扩展。
经典方式 (initialize_agent)
from langchain.agents import initialize_agent, AgentType
agent = initialize_agent(
tools,
llm,
agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
verbose=True
)
现代方式 (LangGraph)
from langgraph.prebuilt import create_react_agent
# LangGraph 的 ReAct Agent 内置了对 Tool Calling 的支持
app = create_react_agent(model, tools)
# 运行
final_state = app.invoke({"messages": [("user", "Who is the CEO of LangChain?")]})
print(final_state["messages"][-1].content)
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.
- 5d ago First seen · 89 lines · 0 tokens per session scan A 1bd0e196a9c5
mrkl 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 809 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
memory-keeper
Updates .claude/memory.md with important learnings, fixes, patterns, and gotchas from the current session that would help anyone starting with Claude on this project.
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.
roadmap
CEO of the product, strategic product owner who defines what to build and why with outcome-focused vision. Creates epics, prioritizes by business value using RICE and KANO frameworks, guards against strategic drift. Use when you need direction, outcomes over outputs, sequencing by dependencies, or user-value…
code-reviewer
Use when a major project step completes and needs review against the original plan and coding standards. Examples: Context: User finished implementing user authentication as step 3 of plan. user: "I've finished implementing the user authentication system as outlined in step 3 of our plan" assistant: "Let me use the…
onboard-guide
Onboarding assistant that provides ongoing personalized guidance after initial /onboard. Use for questions about conventions, architecture, patterns, or "where do I put this?" — answers are tailored to the engineer's background.