
由 AI 智能体根据文末列出的来源撰写。 我们的工作方式
在为小型团队构建生产级 AI Agent 时,管理上下文窗口的感觉就像是一场开卷考试。仅仅因为 Agent 在技术上可以访问所有公司文件和外部数据库,并不意味着它能高效地找到正确的信息。根据 LangChain 博客的说法,如果任由 Agent 随意搜索,它们会在开始生成有用的输出之前,就用失败的查询和臃肿的搜索结果填满有限的上下文窗口。
LangChain 博客最近详细介绍了上下文工程和 Agent 记忆的核心机制,重点关注了检索挑战。通过一个每周一研究数百个竞争对手的竞争分析 Agent 的循环案例,文章强调了不同任务需要不同的检索技术。
当 Agent 盲目打开文件查看内容时,文件系统搜索往往会失败。为了解决这个问题,像 LangChain 的 Deep Agents 这样的框架提供了内置工具,例如 ls_info(用于在不读取内容的情况下检查文件和目录)和 grep(用于搜索精确关键词)。然而,在处理新闻存档或不同措辞时,精确匹配往往力不从心,这就需要由向量数据库支持的语义搜索。
为了防止工具结果淹没上下文窗口(例如包含 40,000 行的市场数据导出或超过 20,000 个 token 的新闻文章),开发人员可以通过 read_file 的偏移量和限制来实现分页。或者,框架可以自动将大型结果卸载到 /large_tool_results/,并为 Agent 提供文件路径和简短预览。文章概述了一个使用 Python 的简化检索工具模式:
backend = StateBackend()
@tool
def search_news(query: str) -> str:
"""搜索新闻存档并将每个结果保存到文件。"""
docs = vector_store.similarity_search(query, k=4)
files = [(f"/retrieved/result_{i}.md", doc.page_content.encode()) for i, doc in enumerate(docs)]
backend.upload_files(files)
return "Saved results to: " + ", ".join(path for path, _ in files)对于构建多 Agent 系统的小型公司和开发者主导的团队来说,上下文工程是脆弱的演示与可靠的生产资产之间的分界线。无关或过时的文本与正确的数据一样容易让模型感到困惑。通过利用“检索、卸载、委派”模式(即搜索结果被写入文件,以路径形式返回,并由子 Agent 处理),小型团队可以在不耗尽 API token 预算或过早触及上下文限制的情况下运行复杂的调研和自动化任务。将搜索知识封装为技能并使用渐进式披露,可以进一步确保只有在明确调用时才会消耗上下文。
ls_info 和 grep),以便模型在打开完整文档之前能够扫描名称和关键词。LangChain's recent blog post outlines three principles for effective human-in-the-loop agent evaluation, focusing on domain expertise and full-thread reviews.

NVIDIA has added four open-weight checkpoints to its Cosmos 3 model family, providing 16B-parameter tools for interactive world simulation and robotics.

LangChain's Deep Agents now support async subagents, allowing an orchestrator to remain responsive while background workers handle long-running tasks in parallel.

Dropbox buys Tigris Data for $350M to build AI-native storage, offering S3-compatible object storage and filesystem features for AI agents.

评论 (1)
From my beat, the biggest pitfall in any context engineering playbook is ignoring the latency cost of your retrieval loop. If your agent spends 40% of its execution time on failed greps or bloated reads, you are burning budget before you even hit the generation step. Define a strict "retrieval budget" in your design docs—say, max 3 tool calls for search—and instrument it so you can measure how much of your total token spend is actually yielded by productive context.