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/conversationalgit 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/conversational)<a href="https://agentmods.dev/agents/xt765/langchain-chinese-comment/conversational"><img src="https://agentmods.dev/badge/agents/xt765/langchain-chinese-comment/conversational.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.00803 |
| Opus 5 | $0.00000 | $0.00402 |
| Sonnet 5 | $0.00000 | $0.00161 |
| Haiku 4.5 | $0.00000 | $0.00080 |
Grade A, and why
conversational 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 4d 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.
Conversational Agent
ConversationalAgent 是专为对话场景设计的 Agent。它在 ReAct 范式的基础上,通过引入 chat_history(对话历史)来保持上下文连贯性。
核心功能
与标准的 ZeroShotAgent 不同,ConversationalAgent 的提示词模板包含一个专门用于存储历史对话的变量。这使得 Agent 能够记住之前的交互,而不仅仅是处理单一的请求。
- chat_history: 存储 Human 和 AI 之间之前的对话内容。
- ai_prefix / human_prefix: 用于在 Prompt 中标识不同说话者的前缀(默认为 "AI" 和 "Human")。
执行逻辑 (Verbatim Snippet)
提示词结构 (ConversationalAgent.create_prompt)
@classmethod
def create_prompt(
cls,
tools: Sequence[BaseTool],
prefix: str = PREFIX,
suffix: str = SUFFIX,
format_instructions: str = FORMAT_INSTRUCTIONS,
ai_prefix: str = "AI",
human_prefix: str = "Human",
input_variables: list[str] | None = None,
) -> PromptTemplate:
# 1. 渲染工具描述
tool_strings = "\n".join(
[f"> {tool.name}: {tool.description}" for tool in tools],
)
# 2. 注入对话相关的变量名
if input_variables is None:
input_variables = ["input", "chat_history", "agent_scratchpad"]
# 3. 构造模板
template = f"{prefix}\n\n{tool_strings}\n\n{format_instructions}\n\n{suffix}"
return PromptTemplate(template=template, input_variables=input_variables)
提示词模板内容
{prefix}
{tool_strings}
{format_instructions}
{chat_history}
Human: {input}
Thought: {agent_scratchpad}
迁移指南 (LangGraph)
在现代 LangChain 中,对话能力通常由 LangGraph 的 State(状态)管理,而不是硬编码在 Prompt 模板中。
经典方式 (initialize_agent)
from langchain.memory import ConversationBufferMemory
from langchain.agents import initialize_agent, AgentType
memory = ConversationBufferMemory(memory_key="chat_history")
agent = initialize_agent(
tools,
llm,
agent=AgentType.CONVERSATIONAL_REACT_DESCRIPTION,
memory=memory,
verbose=True
)
现代方式 (LangGraph)
from langgraph.checkpoint.memory import MemorySaver
from langgraph.prebuilt import create_react_agent
# 使用内存检查点来自动保存对话历史
memory = MemorySaver()
app = create_react_agent(model, tools, checkpointer=memory)
# 运行时提供 thread_id 以识别不同会话
config = {"configurable": {"thread_id": "user-123"}}
app.invoke({"messages": [("user", "My name is Bob")]}, config)
app.invoke({"messages": [("user", "What is my name?")]}, config)
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.
- 4d ago First seen · 89 lines · 0 tokens per session scan A 34c1c155d2e7
conversational 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 803 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
How Agents remember and learn across conversations.
overview
Understanding Hivekeep's persistent AI agents.
hierophant-distiller
Wisdom extraction agent. Use after project completion to distill enduring lessons. The Hierophant exists outside time, transforming ephemeral project history into permanent doctrine. Invoke when: project complete, retrospective needed, recording a durable lesson from finished work.
session-learning
Extract learnings, patterns, and insights from work sessions. Use this agent: Spawned by session-learning-coordinator for each space After completing major tasks or projects After problem-solving sessions with novel solutions When user explicitly requests learning extraction The agent analyzes session work, identifies…
conversation-processor
Agent "conversation-processor" from datacore-one/datacore, covering agent context, when to reference dip-0014, quick reference, related dips and related agents.
learning-classifier
Process new learning file entries, deduplicate against PLUR engrams, and create new engrams with proper classification. Detects recurrences, scope promotions, contradictions, and novel patterns.