
AI agents work best when they reflect the knowledge and judgment your team has built over time. Some of that is institutional knowledge that’s already documented and easy for an agent to use as-is. But most great organizations also rely on tacit knowledge that lives inside their employees’ minds. Teams often don’t realize how critical that information is to perform meaningful work until they try building AI agents to automate it. Ensuring this wisdom makes its way into an agent requires an improvement loop that incorporates input from domain experts.当AI智能体能够反映团队长期积累的知识与判断时,其效果最佳。其中一部分是已经成文记录、智能体可直接使用的组织知识。但绝大多数优秀组织还依赖存在于员工头脑中的隐性知识。团队往往在尝试构建AI智能体来自动化相关工作时,才会意识到这些信息对完成有价值的工作有多关键。要确保这些经验智慧融入智能体,就需要建立纳入领域专家输入的改进循环。
In this guide, we’ll cover:在本指南中,我们将涵盖以下内容:
- Which components of your agent will benefit from absorbing human judgment智能体的哪些组件可以通过吸收人工判断获益
- How to incorporate human judgment into your agent at each step of the development lifecycle如何在开发生命周期的每个阶段将人工判断融入智能体
Real-life inspired example: Copilot for traders现实启发案例:交易员Copilot
Imagine a financial services firm whose traders need up-to-date market data. Today, they send their questions to the data science team. A data scientist writes a SQL query, retrieves the relevant data, and sends the result back. Because LLMs are strong at generating SQL, this workflow is a natural candidate to automate with an AI agent: traders get faster responses while the data scientists are free to work on more interesting projects. 设想一家金融服务公司,其交易员需要获取最新的市场数据。目前,他们会将问题提交给数据科学团队,由数据科学家编写SQL查询、提取相关数据后再返回结果。由于大语言模型(LLM)在生成SQL方面表现优异,这一工作流非常适合用AI智能体自动化:交易员能获得更快的响应,数据科学家也能腾出精力从事更有趣的项目。
For this system to work reliably, the agent needs context at both the financial services domain level and the technical database layer. The former includes unwritten trading conventions that determine how to interpret requests like “today’s exposure” or “recent volatility.” The latter includes practical knowledge of the database, like which tables are authoritative vs. outdated, or which query patterns tend to be incorrect or inefficient. We’ll need to engage with the appropriate subject-matter experts to include all the unwritten context the agent needs.要让该系统稳定运行,智能体需要同时具备金融服务领域层面和技术数据库层面的上下文。前者包括决定如何解读“今日敞口”“近期波动率”这类请求的非成文交易惯例;后者包括数据库的实用知识,比如哪些表是权威数据源、哪些已过时,哪些查询模式往往错误或低效。我们需要联系相应的领域专家,将智能体所需的所有非成文上下文纳入其中。
We’ll use this example throughout the guide to give concrete implementation examples. It’s a good example because the architecture is simple, and it showcases principles critical for involving human judgement in agent design. 我们将在整篇指南中使用这个案例提供具体的实现示例。这是一个很好的案例,因为其架构简单,且展示了将人工判断融入智能体设计的关键原则。
Let’s review the different components of the agent that can be improved with human judgment. 接下来我们回顾一下可以通过人工判断优化的智能体不同组件。
How human input improves each component of an AI agent人工输入如何提升AI智能体的各个组件
Building an agent means deciding when to invoke an LLM and managing what context to provide with each call (e.g., documentation, memory, conversation history, tools) to achieve the desired result. Each of these design choices benefits from input from the right stakeholders.构建智能体意味着要决定何时调用大语言模型(LLM),并管理每次调用时提供的上下文(例如文档、记忆、对话历史、工具)以实现预期结果。这些设计选择中的每一项,都能从相关利益方的输入中获益。
Workflow Design工作流设计
LLMs today are great at sequencing their own actions. Just give them some tools and natural language instructions, and they’ll figure out which tools to call in what order. However, there are benefits to using deterministic code to define parts of the workflow: lower latency, fewer tokens, and the guarantee that critical steps actually run. In some regulatory or high-risk settings, you need code to strictly control the sequence of actions. In our trader copilot, we’ll let the LLM autonomously generate and execute a SQL query, but add code that requires it to validate the final answer meets our firm’s risk and compliance requirements before returning it to the trader. We’ll need input from risk and compliance experts to create automated checks that enforce the firm’s standards. We can also include that information in the agent’s pre-loaded context to improve its odds of creating a valid answer on the first try. 当前大语言模型非常擅长自主排序行动步骤:只需为其提供若干工具和自然语言指令,它们就能自行判断调用工具的顺序。不过,使用确定性代码定义部分工作流也有诸多好处:更低延迟、更少的token消耗,以及确保关键步骤实际执行的保障。在某些受监管或高风险的场景中,你需要用代码严格管控行动顺序。在我们的交易员Copilot中,我们会允许大语言模型自主生成并执行SQL查询,但会增加代码校验逻辑,要求其在将结果返回给交易员前,确认最终答案符合公司的风险与合规要求。我们需要风险与合规专家的输入,来创建能执行公司标准的自动化校验规则。同时,我们也可以将这些信息预加载到智能体的上下文中,提升其首次生成有效答案的概率。
Tool Design工具设计
Developers must implement the tools the agent can use and configure the names, parameters, and descriptions that the LLM relies on to decide when to invoke them. It’s often useful to vary the available tools at different stages of the workflow. Limiting the tool set for a single LLM call can guide the model toward the intended behavior and reduce the chance that it selects an irrelevant option.开发人员需要实现智能体可使用的工具,并配置大语言模型决定是否调用工具时依赖的名称、参数和描述。在工作流的不同阶段调整可用工具通常很有用。限制单次大语言模型调用可用的工具集,可以引导模型表现出预期行为,降低其选择无关工具的概率。
Our copilot’s tools might include database schema inspection, query execution, and database documentation retrieval. A key tradeoff is flexibility vs. control for LLM-generated queries: a general execute_sql step allows for flexible queries but increases risk; parameterized query tools are safer but less capable. A close review of your business constraints might give you a sense of which option is right for you, but to know for sure, you’ll need to run evaluations to determine the performance and risk characteristics of your tool design and ship only when all stakeholders are comfortable with the results.我们的Copilot工具可能包括数据库架构检查、查询执行和数据库文档检索。其中一个核心权衡是大语言模型生成查询的灵活性与可控性:通用的execute_sql步骤支持灵活查询但会增加风险;参数化查询工具更安全但功能有限。仔细评估你的业务约束条件,可以让你对适合的选项有初步判断,但要想确定,你需要运行评估测试,明确工具设计的性能和风险特征,且只有在所有利益相关方都对结果满意的情况下才能上线。
Agent Context 智能体上下文
Early agents just gave the model a single system prompt and a set of tool definitions. Over time, the industry has moved toward providing agents with much richer context at the beginning of their execution. Anthropic’s Skills, a standard that has quickly grown in popularity since launching in October, is one prominent example of this trend. 早期的智能体仅会给模型提供单一的系统提示和一组工具定义。随着时间推移,行业逐渐转向在智能体执行初期为其提供更丰富的上下文。Anthropic推出的Skills标准自10月发布以来迅速普及,就是这一趋势的典型代表。
Instead of cramming everything into one system prompt, your team curates documentation, examples, and domain rules in advance, then lets the agent fetch what it needs at runtime. This lets the agent use far more knowledge without bloating the system prompt. Effective agent design involves deciding what knowledge the agent should access and organizing it so the agent can retrieve the right information at the right moment. 团队无需将所有内容塞进一个系统提示中,而是提前整理好文档、示例和领域规则,让智能体在运行时按需获取。这样智能体就能使用更多知识,又不会导致系统提示过于臃肿。高效的智能体设计需要决定智能体应访问哪些知识,并对其进行组织,让智能体能在合适的时机获取正确的信息。
At minimum, our trader copilot needs to know how to use the database and understand its schema. Depending on the nature and amount of additional knowledge from our team that our copilot needs, we’ll have to spend time not just collecting that knowledge but determining how to structure and progressively disclose it to our agent.至少,我们的交易员Copilot需要掌握数据库的使用方法并理解其架构。根据我们的团队需要为Copilot提供的额外知识的性质和数量,我们不仅要花时间收集这些知识,还要确定如何对其进行结构化,并逐步向智能体披露。
Choosing and structuring the information available to the agent when it starts up is part of the discipline of context engineering. Context engineering also covers how the information you provide in each LLM call evolves as the agent moves through its task. The feedback your human stakeholders provide when reviewing your agent’s outputs and evaluation scores may influence how you approach end-to-end context engineering for your agent. 选择并结构化智能体启动时可用的信息,是上下文工程学科的一部分。上下文工程还涵盖智能体执行任务过程中,每次大语言模型调用时提供的信息如何动态调整。人工利益相关方在审查智能体输出和评估分数时提供的反馈,会影响你如何开展智能体的端到端上下文工程工作。
Now that we have outlined the parts of an agent that benefit from human judgment, we’ll cover how to collect that human input. 现在我们已经梳理了可从人工判断中获益的智能体组件,接下来将介绍如何收集这些人工输入。
Incorporating human judgment into the agent improvement loop将人工判断融入智能体改进循环
At LangChain, we’ve worked with hundreds of organizations deploying AI agents. The most successful teams follow a tight iteration loop: they quickly build an agent, deploy it to a production or production-like environment, and collect data at each step to guide improvements. We call this the “agent improvement loop” because we’ve observed that most successful agents have gone through this loop multiple times, and have covered it in greater detail before here. 在LangChain,我们曾与数百家部署AI智能体的组织合作过。最成功的团队都遵循紧密的迭代循环:快速构建智能体,将其部署到生产或类生产环境,在每一步收集数据以指导优化。我们将其称为“智能体改进循环”,因为我们观察到绝大多数成功的智能体都曾多次经历这一循环,且此前我们也曾更详细地介绍过相关内容。
Iterating quickly and frequently is critical because it is the LLM’s real-time reasoning, not code, that determines the agent’s behavior. It’s impossible to know what an AI agent will do until it runs. AI agent interfaces are often free-form, e.g. a text box the user can type anything into, making it even harder to predict what interactions between your users and your agent will look like. Putting your agent in front of users is the only way to collect the data you need to make it ultimately successful.快速、频繁的迭代至关重要,因为决定智能体行为的是大语言模型的实时推理,而非代码。在智能体运行之前,你不可能知道它会做出什么行为。AI智能体的交互界面通常是自由格式的,例如用户可以输入任意内容的文本框,这进一步增加了预测用户与智能体交互形式的难度。将智能体开放给用户使用,是收集所需数据、最终使其成功的唯一途径。

We’ll walk through the following phases of the flywheel while discussing how to incorporate human input effectively:在讨论如何有效融入人工输入的同时,我们将逐步介绍飞轮模式的以下阶段:
- Implementing the agent’s first version实现智能体首个版本
- Monitoring the agent after it goes live and collecting production data to help refine it智能体上线后的监控与生产数据收集,用于辅助优化
- Implementing and testing improved versions of the agent实现并测试优化后的智能体版本
Before we dive in, it’s worth highlighting a principle that applies across the entire development lifecycle.在深入介绍之前,有必要强调一个适用于整个开发生命周期的原则。
The key to high return on human time invested: automated evaluations, aligned with human judgment提升人工时间投入回报的核心:与人工判断对齐的自动化评估
We’ve observed that teams get more leverage when humans help design and calibrate automated evaluators, rather than manually reviewing large volumes of agent outputs. No matter how big or well-resourced your team is, it’s rarely economical to rely on extensive manual review. The scalable approach is to translate expert judgment into automated evaluations that let you test broadly and continuously. That’s what LangSmith’s Align Evaluator feature helps with. It provides a user interface for calibrating LLM-as-a-judge evaluators using curated examples and feedback from subject matter experts. We recommend using this feature for any evaluator that’s meant to mimic a non-developer stakeholder’s judgments. 我们观察到,当人工参与设计和校准自动化评估工具,而非手动审查大量智能体输出时,团队的效率会更高。无论团队规模多大、资源多充足,依赖大规模人工审查都很难称得上经济实惠。可扩展的方法是将专家判断转化为自动化评估,让你能够广泛、持续地开展测试。LangSmith的Align Evaluator(对齐评估器)功能正是为此而生。它提供了用户界面,支持使用精选示例和领域专家的反馈来校准“大语言模型作为评判者”的评估器。我们建议对于任何需要模拟非开发人员利益相关方判断的评估器,都使用这一功能。

Let’s follow the trader copilot from the perspective of our hypothetical trading firm through each phase of the improvement loop. We’ll look at how to incorporate human input effectively, and in particular, how to channel that input into automated evaluations.接下来我们将从假设的交易公司的视角,跟随交易员Copilot走完改进循环的每个阶段。我们将探讨如何有效融入人工输入,尤其是如何将人工输入转化为自动化评估。
Development: Curate test suites and evaluators开发阶段:整理测试套件与评估器
Before development starts, engineers should have at least a small set of use case scenarios and expected behavior as part of the project requirements. These initial tests help confirm that the agent performs the core tasks correctly. As the agent approaches production readiness, engineers should work with product managers and subject matter experts to build a more comprehensive test suite that evaluates both overall behavior and key subcomponents.开发启动前,工程师应至少准备一组用例场景和预期行为,作为项目需求的一部分。这些初始测试有助于确认智能体能正确执行核心任务。当智能体接近上线标准时,工程师应与产品经理和领域专家合作,构建更全面的测试套件,评估智能体的整体行为和关键子组件。
For our copilot, we’ll use LangSmith’s datasets feature to manually create some ground truth datasets pairing natural language questions and their correct answers. We’ll also create datasets containing examples of what good, performant SQL looks like in the context of our database. As our developers build the agent, we’ll use LangSmith’s evaluations feature to run tests against those datasets. The LangSmith UI lets our technical and nontechnical team members review evaluation results and annotate them so everyone can align on the developers’ next steps. 针对我们的Copilot,我们将使用LangSmith的数据集功能手动创建一些真实数据集,将自然语言问题与对应的正确答案配对。我们还会创建包含符合我们数据库场景的高质量、高性能SQL示例的数据集。开发人员构建智能体的过程中,我们会使用LangSmith的评估功能针对这些数据集运行测试。LangSmith的用户界面支持技术和非技术团队成员审查评估结果并添加标注,让所有人对开发人员的下一步行动达成共识。
We can create a mini-flywheel during this phase by augmenting our initial datasets with examples inspired by interesting cases we encounter during manual testing. This helps progressively automate our feedback loop and ensure we have a comprehensive test suite by the time we’re ready to ship our agent’s v1.在这一阶段,我们可以通过将手动测试中遇到的典型案例添加到初始数据集中,构建一个迷你飞轮。这有助于逐步实现反馈循环的自动化,确保我们在准备发布智能体v1版本时,已经拥有全面的测试套件。

After deployment: Use automated evaluations and monitoring to direct human attention to where it’s most needed上线后:利用自动化评估和监控,将人工注意力引导到最需要的地方
Once your agent is live, you'll need to ensure its reliability and quickly identify problems or opportunities for improvement. The traditional way of validating user experience is satisfaction surveys and user interviews, but the flaw with that approach is it measures what users tell you, not what they actually do. LLM-as-a-judge evaluators give us a much more robust method. Automated evaluations running on production data can help monitor the agent and surface situations that warrant human attention. For example, an LLM judge can automatically detect when a user expresses frustration and flag those interactions for review. A team member can then investigate the trace and decide whether the issue reflects a bug, a gap in the agent’s knowledge, or a weakness in the workflow.智能体上线后,你需要确保其可靠性,并快速识别问题或改进机会。验证用户体验的传统方式是满意度调研和用户访谈,但这种方法存在缺陷:它测量的是用户告诉你的内容,而非用户实际的行为。“大语言模型作为评判者”的评估器为我们提供了更可靠的方法。在生产数据上运行的自动化评估可以帮助监控智能体,浮现需要人工关注的情况。例如,大语言模型评判者可以自动检测到用户表达不满的交互,并标记出来供审查。团队成员随后可以追溯交互记录,判断问题属于智能体漏洞、知识缺口还是工作流缺陷。
{insert-video-here}{insert-video-here}
Check out the demo trader app and set up annotation queues.查看演示交易员应用并设置标注队列。

Our hypothetical firm will first set up LangSmith tracing to capture all of the agent’s interactions with our traders. We’ll next set up LangSmith’s automations feature for:我们的假设公司会首先配置LangSmith的链路追踪功能,捕获智能体与交易员的所有交互。接下来我们会配置LangSmith的自动化功能,用于:
- Online evaluations: Configure LangSmith to run evaluators on the observability data as it comes in. For example, we’ll want automated code checks for slow or dangerous SQL queries as well as LLM-as-a-judge evaluators reviewing conversations to see if users are expressing satisfaction with the answers the copilot is giving them. 在线评估:配置LangSmith,使其在可观测数据流入时自动运行评估器。例如,我们会设置针对缓慢或危险SQL查询的自动化代码检查,以及“大语言模型作为评判者”的评估器来审查对话,判断用户是否对Copilot给出的答案感到满意。
- Alerts: LangSmith will trigger our preexisting alerting system when it sees spikes in errors, latency, or negative online evaluation scores so our team can quickly fix the underlying problem告警:当LangSmith检测到错误、延迟或负面在线评估分数激增时,会触发我们已有的告警系统,让团队能够快速修复底层问题。
- Annotation queues: We’ll flag notable traces for human review by sending them to a LangSmith annotation queue. In the queue, we’ll have subject matter experts review cases where an online evaluator returned a very negative feedback score, indicating something is wrong with the agent. A borderline feedback score would suggest that we need to adjust the evaluator itself. LangSmith saves the feedback submitted through annotation queues so it’s available for future automated and manual analysis. 标注队列:我们会将值得关注的链路标记出来,发送到LangSmith标注队列供人工审查。在队列中,我们会请领域专家审查在线评估器给出极低反馈分数的案例,这表明智能体存在问题。处于临界值的反馈分数则意味着我们需要调整评估器本身。LangSmith会保存通过标注队列提交的反馈,供未来进行自动化和人工分析使用。

Insights Agent: Another way to get value from the tracing data洞察智能体:从链路追踪数据中获取价值的另一种方式
Unstructured explorations of live behavior inspire some of the most valuable improvements for AI agents. To support this, LangSmith provides Insights Agent, a built-in AI agent that analyzes large volumes of tracing data with minimal user configuration. It surfaces patterns and trends in agent behavior that wouldn’t be obvious from individual traces or deterministic evaluations. You’ll still ultimately have your human stakeholders review the insights report to align on next steps, but the feature jump-starts the process.对实时行为的非结构化探索,往往能催生AI智能体最有价值的改进。为此,LangSmith提供了洞察智能体(Insights Agent),这是一个内置的AI智能体,只需极少用户配置即可分析大量链路追踪数据。它能浮现出从单条链路或确定性评估中无法发现的智能体行为模式与趋势。你最终仍然需要人工利益相关方审查洞察报告以对齐下一步行动,但该功能可以大幅加速这一流程。
For our trading copilot, we might run an insights report automatically identifying similar conversations and clustering them into use case categories. Having a sense of the underlying themes behind the questions the traders ask the copilot can help us identify use cases we should be extra sure to support well or even future product additions that would serve our traders even better for those use cases. 针对我们的交易Copilot,我们可以运行洞察报告,自动识别相似的对话并将其聚类为用例类别。了解交易员向Copilot提问背后的核心主题,可以帮助我们识别需要重点保障支持的用例,甚至未来可以新增的、能更好服务交易员的相关产品功能。
As automated evaluations, human annotations, and aggregate-level insights accumulate, they provide a clear picture of how the agent performs in the real world. Those learnings feed into the final step of the cycle: restarting the iteration loop by building the agent’s next version.随着自动化评估、人工标注和聚合级洞察的不断积累,我们可以清晰了解智能体在真实世界中的表现。这些经验会输入到循环的最后一步:通过构建智能体的新版本,重启迭代循环。

Continuous refinement: turn today’s production data into tomorrow’s test suites持续优化:将今天的生产数据转化为明天的测试套件
When you build the first version of an agent, your evaluation suite is at best educated guesses on what tests you need to validate that it works. After launch, you gain access to a much better source of test cases: real production data.构建智能体首个版本时,你的评估套件最多只能是对所需验证测试的合理推测。上线后,你能获得更优质的测试用例来源:真实的生产数据。
You need to curate this data into test suites that are comprehensive but not unnecessarily large. Automated systems can help generate candidate datasets, for example, by filtering production traces based on evaluator results. But we often need human judgment to curate balanced, representative evaluation sets. Evaluations can be useful running on just a few hundred examples if they’re chosen carefully, so it’s worthwhile to involve experts in deciding which examples should define the test suite.你需要将这些数据整理为测试套件,要求全面但不过度冗余。自动化系统可以帮助生成候选数据集,例如基于评估结果过滤生产链路。但我们通常需要人工判断来整理平衡、有代表性的评估集。如果精心挑选,仅用几百个示例运行评估也能发挥效用,因此邀请专家参与决定哪些示例应纳入测试套件是值得的。
Once our trading firm has had its copilot running in production for a while, the team will have access to real SQL queries and chatbot conversations, along with the online evaluator results and human opinions collected via monitoring and curated annotation queues.一旦我们的交易公司让Copilot在生产环境运行一段时间,团队就能获得真实的SQL查询和聊天对话记录,以及通过监控和精选标注队列收集的在线评估结果和人工意见。
Our team can create datasets out of the reviewed traces to run a more robust suite of evaluations, resulting in huge improvements in our agent’s performance for v2 and beyond. One of the most helpful datasets we can curate is a “golden dataset,” consisting of examples of the copilot’s best work so far, so we can use it as a baseline to ensure future versions perform at least as well. LangSmith makes this easy to put together. Use the online evaluator scores to identify candidate traces, then put them in an annotation queue so our subject matter experts can decide which ones actually belong in the golden dataset.我们的团队可以将经过审查的链路整理为数据集,运行更稳健的评估套件,从而让v2及后续版本的智能体性能得到大幅提升。我们可以整理的最有价值的数据集之一是“黄金数据集”,它包含Copilot迄今为止的最佳工作示例,我们将其作为基准,确保未来版本的性能至少不低于当前水平。LangSmith让这一工作变得简单:利用在线评估分数筛选候选链路,再将其放入标注队列,由我们的领域专家决定哪些真正应纳入黄金数据集。

Conclusion结论
Effective agent development combines human judgment with the scalability of automated evaluations. Human expertise helps define what “good” looks like by shaping workflows, tools, context, and evaluation criteria. Automated evaluators apply that judgment at scale, helping teams test agents quickly, monitor their behavior in production, and direct human attention to the cases that matter most.高效的智能体开发需要将人工判断与自动化评估的可扩展性相结合。人工专业知识通过塑造工作流、工具、上下文和评估标准,帮助定义“优秀”的衡量标准。自动化评估器可以大规模应用这些判断,帮助团队快速测试智能体、监控其生产环境中的行为,并将人工注意力引导到最重要的场景上。
Over time, this creates a flywheel. Human feedback improves evaluators, test suites, and the agent itself, the improved agent we deploy gets us more data that tells us how to improve it, and these insights drive the next development iteration.久而久之,这会形成一个飞轮效应:人工反馈优化评估器、测试套件和智能体本身;我们部署的优化后的智能体能获取更多数据,告诉我们如何进一步改进;这些洞察又会推动下一轮开发迭代。
We used a simple use case to illustrate this process, but the same principles apply to building any agent: Build tight iteration loops, capture expert judgment in scalable evaluations, and continuously turn production data into better tests. This is the key to creating AI agents that create meaningful value for your business.我们用一个简单的用例阐释了这一流程,但同样的原则适用于构建任何智能体:建立紧密的迭代循环,将专家判断转化为可扩展的评估,持续将生产数据转化为更优质的测试。这是打造能为业务创造实际价值的AI智能体的关键。





