在本地运行评估追踪,并审核进入 Studio Web 的结果。
智能体在本地运行并注册入口点后,您就可以运行智能体并构建评估集。
步骤 6 - 在本地运行智能体
使用您的编码智能体创建的示例输入文件运行智能体:
uip codedagent run agent --file input.json
uip codedagent run agent --file input.json
您应该会看到智能体对请求进行了分类,并返回一个带有推理的层级。
您也可以内联传递输入。这些示例使用 Bash 单引号语法;如果您使用的是 PowerShell,请改为将--file与 JSON 文件一起使用:
uip codedagent run agent '{"description": "Clear the rats out of the inn cellar"}'
uip codedagent run agent '{"description": "Clear the rats out of the inn cellar"}'
尝试使用几个不同的输入以验证分类是否合理:
uip codedagent run agent '{"description": "Slay the ancient red dragon terrorizing the countryside"}'
uip codedagent run agent '{"description": "Slay the ancient red dragon terrorizing the countryside"}'
步骤 7 - 创建评估测试
评估会测试您的智能体在一系列输入中的性能。uipath-agents技能包含完整的评估框架参考:评估程序类型、评估集架构、目录结构约定以及最佳实践,例如将gpt-4.1 (非迷你)用于 LLM Judge 评估程序。您的编码智能体使用此功能在简短提示下生成正确的评估器配置和测试集。
询问您的编码智能体:
Create an evaluation set for the intake classifier agent with 5 test cases:
1. A clearly trivial request (e.g., delivering a letter)
2. A standard request (e.g., escort a caravan)
3. A heroic request (e.g., clear a goblin stronghold)
4. A legendary request (e.g., slay a dragon)
5. An edge case with ambiguous difficulty
Use both a semantic similarity evaluator (to check the output) and a
trajectory evaluator (to check the agent's reasoning path).
Include evaluator config files in evaluations/evaluators/ and the eval
set in evaluations/eval-sets/. Use gpt-4.1-2025-04-14 as the model in
the evaluator configs. Each evaluator config must include a populated
defaultEvaluationCriteria - use {"expectedOutput": {}} for the
semantic evaluator and {"expectedAgentBehavior": ""} for the
trajectory evaluator. Empty {} fails schema validation.
Create an evaluation set for the intake classifier agent with 5 test cases:
1. A clearly trivial request (e.g., delivering a letter)
2. A standard request (e.g., escort a caravan)
3. A heroic request (e.g., clear a goblin stronghold)
4. A legendary request (e.g., slay a dragon)
5. An edge case with ambiguous difficulty
Use both a semantic similarity evaluator (to check the output) and a
trajectory evaluator (to check the agent's reasoning path).
Include evaluator config files in evaluations/evaluators/ and the eval
set in evaluations/eval-sets/. Use gpt-4.1-2025-04-14 as the model in
the evaluator configs. Each evaluator config must include a populated
defaultEvaluationCriteria - use {"expectedOutput": {}} for the
semantic evaluator and {"expectedAgentBehavior": ""} for the
trajectory evaluator. Empty {} fails schema validation.
步骤 8 - 运行评估
在本地运行评估集:
uip codedagent eval agent evaluations/eval-sets/smoke-test.json --workers 3 --output-file eval-results.json
uip codedagent eval agent evaluations/eval-sets/smoke-test.json --workers 3 --output-file eval-results.json
评估框架通过智能体运行每个测试用例,并对结果进行评分。
| 分数 | 它测量什么 |
|---|---|
| 语义相似度 | 智能体输出与预期输出的匹配程度 |
| 智能体轨迹 | 智能体是否采用了预期的推理路径 |
此智能体的预计轨迹分数为 0.0。轨迹评估器会判断智能体的推理路径:它调用了哪些工具、以何种顺序调用,以及如何在节点之间路由。此分类器不会调用工具,并且有一个节点,因此每个测试用例的分数为 0.0。对于此单节点分类器,请依靠语义相似度分数。
对于语义相似度,分数通常高于 0.8。查看eval-results.json ,以查看智能体的性能。
在下一步中连接到 Studio Web 后,从 CLI 运行uip codedagent eval run会自动将结果上传到 Studio Web;评估集和评估集将显示在运行下的评估集选项卡中。
Studio Web 运行评估按钮不是一回事情。该按钮会触发需要 Python 运行时支持的 Cloud Robot 执行,这是一个更复杂的设置,不属于本实验室的范围。改为使用 CLI 中的uip codedagent eval run ;无论哪种方式,结果都会在 Studio Web 中显示。
确认本地评估结果后,在下一部分中,您即可准备将项目连接到 Studio Web。