UiPath Documentation
getting-started
latest
false
入门开发者指南
  • 概述
    • 概述
  • UiPath 智能体入门
  • 开始使用 UiPath 智能体(采用 LangGraph)
  • 在 Studio Web 中构建低代码智能体
  • 向 UiPath 智能体添加工具
    • 简介
    • 构建 API 工作流
    • 连接到您的智能体
    • 进行端到端测试
重要 :
请注意,此内容已使用机器翻译进行了本地化。 新发布内容的本地化可能需要 1-2 周的时间才能完成。

连接到您的智能体

在 Manager 智能体中将 API 工作流注册为工具,并更新智能体的输入架构。

工作流发布后,即可在 Agent Builder 中作为可连接的工具使用。

步骤 2 - 打开 Monitor Selector 智能体

在 Studio Web 中,导航到您的MonitorSelector解决方案,并在 Agent Builder 中将其打开。

在进行更改之前,请花点时间了解其当前状态:

  • 输入: questDescription (字符串)和monsters (调用者传递的候选对象数组)
  • Output: monsterIndex (string): the key of the chosen monster, for example srd_goblin
  • 系统提示:指示智能体从提供的列表中选取最佳匹配项

在本实验室中,您将删除monsters输入和预填充候选对象的要求。智能体会使用您刚才构建的工具自行获取这些数据。


步骤 3 - 将 API 工作流作为工具连接

添加工具

确保您位于Canvas视图中:使用Agent Builder顶部的Canvas/Form切换开关。“工具”下的“+”按钮仅在“Canvas”视图中可见。

  1. 在智能体画布上,选择“工具”下的“+”

  2. In the Choose tool panel, select API workflow under Toolbox.

  3. Under Available resources, select the workflow you created in Step 1.

    Your workflow is listed by its project name, nested under a <workspace>/<solution> folder line - so if you renamed the solution in Step 1, look for API Query - 5e Monsters, not the solution name. You can also filter with the Search API workflows box above the list.

备注:

Available resources empty, or showing "No tools found"? The workflow must be published before it appears here. Return to Step 1 and complete the Publish to your feed sub-step, then come back and try again.

配置工具描述

为工具命名并提供描述。描述是智能体在运行时读取的内容,用于决定何时以及如何调用工具;将其写为智能体指令,而非人类标签:

  • 名称Monster Query
  • 说明: Searches the 5e SRD for monsters matching a name or creature type. Returns up to 10 candidates with key, name, type, size, challenge rating, and alignment. Call this tool when you need to find monster candidates for a quest.
备注:

描述决定了工具的选择。智能体将读取此描述(而非工具名称),以决定何时以及如何调用工具。模糊的描述会导致工具使用模糊。请具体说明工具返回的内容以及何时使用。


步骤 4 - 更新智能体合同

连接工具后,更新智能体定义以反映新合同:智能体不再需要预先填充的城市列表,并且现在会返回结构化的城市数据,包括自己的推理。

此步骤中的三项更改协同作用:删除monsters结束智能体对调用者的数据依赖;输出架构声明智能体承诺返回的内容;更新后的提示会告知智能体如何使用其新功能。这三种模式中的任何一种都不可缺少其他者。

要编辑智能体定义,请在画布上选择智能体节点,以在右侧打开“定义”面板。

从输入中删除角色

在智能体定义中,从输入架构中删除monsters属性。更新后的输入应仅包含questDescription

要删除monsters属性,请执行以下操作:

  1. 在智能体中,选择左侧导航栏(看起来像剪贴板)的“打开 Data Manager”图标,以打开Data Manager
  2. Data Manager面板分为三组:输入输出变量monsters应位于“输入”列表中。
  3. 指向monsters即可在标签右侧显示编辑和删除图标:铅笔图标(编辑)和回收站图标(删除)。
  4. 选择删除图标,删除monsters
  5. Open the agent's Properties panel and remove the now-dangling monsters reference from the User prompt: select the x on the monsters chip. The User prompt should be left with only the questDescription chip.
警告:

Deleting the input does not clear the prompt that references it. After step 4 the User prompt still carries a monsters chip, which Studio Web renders in red and flags with an error badge on Inputs. The agent will not run until you remove that chip, so do not skip step 5.

您现在应该只有一个输入: questDescription

字段类型必填描述
questDescription字符串任务说明

添加输出架构

使用“您正在构建的内容”中的设计表中的五个字段添加输出架构。

在同一Data Manager面板中:

  1. 指向“输出”标头,以显示“添加属性”图标 (+)。
  2. 选择“添加属性”以添加以下每个字段:
字段类型
monsterIndex字符串
monsterName字符串
monsterType字符串
monsterCr字符串
monsterReasoning字符串
备注:

monsterReasoning由智能体生成,而不是来自 API。智能体会自行写入此字段:这是智能体对为何所选生物符合任务的解释。与其他四个字段(来自工具的结果)不同, monsterReasoning反映了智能体自身的判断。

更新系统提示词

要打开“属性”面板,请在画布上选择智能体,或选择右上角的扳手图标。将系统消息替换为:

You are a quest classifier for an adventurer's guild. Given a quest description, your job is to find the most thematically appropriate monster from the 5e SRD and to return information about that monster.

When given a quest description:
1. Analyze the quest to determine what kind of creature fits the context - consider creature type, challenge rating, environment, and theme.
2. Call the Monster Query tool with a search term that targets that creature type.
3. Review the returned candidates and select the best fit for the quest.
4. Return the selected monster's key fields and a monsterReasoning that explains why this monster fits the quest.

Always call the Monster Query tool before selecting a monster. Do not guess monster details from memory.
You are a quest classifier for an adventurer's guild. Given a quest description, your job is to find the most thematically appropriate monster from the 5e SRD and to return information about that monster.

When given a quest description:
1. Analyze the quest to determine what kind of creature fits the context - consider creature type, challenge rating, environment, and theme.
2. Call the Monster Query tool with a search term that targets that creature type.
3. Review the returned candidates and select the best fit for the quest.
4. Return the selected monster's key fields and a monsterReasoning that explains why this monster fits the quest.

Always call the Monster Query tool before selecting a monster. Do not guess monster details from memory.
重要提示:

编码智能体是非确定性的。提示将产生与上述示例不同的结果;这是预期的。重要的是智能体调用该工具,对候选对象进行推理,并返回所有五个必填输出字段。


连接工具并更新智能体合同后,您就可以在下一部分中测试完整管道。

此页面有帮助吗?

连接

需要帮助? 支持

想要了解详细内容? UiPath Academy

有问题? UiPath 论坛

保持更新