UiPath Documentation
maestro-automate
latest
false
Maestro Automate 用户指南

您的第一个工作流

构建包含两个 API 调用、一个做出决策的 AI 智能体以及两个分支的订单接收工作流,然后使用编码智能体或画布上进行测试并部署。

在本教程中,您将构建什么是 Maestro 自动化?描述。对于每个新订单,工作流会检查库存和客户信用,让 AI 智能体决定是否接受订单,然后创建订单或通知销售代表。

整个教程大约需要 15 分钟。库存和信用检查将调用 dummyjson.com,免费的示例 API,因此您不需要其他应用程序的帐户或 API 密钥。最后两个步骤是代表客户关系管理 (CRM) 和 Slack 的脚本,因此工作流无需连接到这些应用程序即可运行。上面的屏幕截图显示了通知销售代表为 Slack 连接器,这就是真实工作流中的情况。

您可以通过两种方式构建工作流。请选择其中一个,页面的其余部分将遵循您的选择:

  • 使用编码智能体:描述工作流,智能体为您构建工作流。
  • 在画布上手动:自行添加和设置每个节点。

开始之前​

  • UiPath 帐户。“注册”介绍了如何创建注册。
  • 具有 UiPath CLI 和技能的编码智能体。设置编码智能体,只需三个步骤即可使其准备就绪。
  • 带有 UiPath Maestro 扩展的 VS Code,用于在画布上查看工作流。“在 VS Code 中构建”介绍了如何安装该程序。

1. 构建工作流​

  1. 为项目创建一个空文件夹,然后在 VS Code 中打开。

  2. 在该文件夹中启动编码智能体。例如,对于 Claude Code,请在 VS Code 终端中运行claude 。

  3. 粘贴此提示词:

    Create a Maestro Automate project named OrderIntake with a workflow that does exactly this. Don't add, remove, or rename nodes.
    
    1. Rename the Manual trigger to "New order", set its ID to newOrder, and add two input arguments: productId (number) and customerId (string).
    2. Add an HTTP Request node "Check stock" (ID checkStock), GET, with the URL as an expression: "https://dummyjson.com/products/" + $vars.newOrder.output.productId
    3. Add an HTTP Request node "Check credit" (ID checkCredit), GET https://dummyjson.com/users/1
    4. Add an Autonomous Agent node "Review order" (ID reviewOrder) with the default model.
       System prompt: "You review new customer orders. Accept an order only if the product has stock greater than 0 and the customer record is present. Otherwise reject it. Always give a short reason."
       Give the agent the response body of Check stock as the product, and the response body of Check credit as the customer.
       Output variables: accepted (boolean) and reason (string).
    5. Add a Decision node "Accepted?" (ID accepted) with the condition $vars.reviewOrder.output.accepted
    6. On True, add a Script node "Create order in CRM" (ID createOrderInCrm): return { orderCreated: true, productId: $vars.newOrder.output.productId };
    7. On False, add a Script node "Notify sales rep" (ID notifySalesRep): return { notified: true, reason: $vars.reviewOrder.output.reason };
    
    The order is: New order → Check stock → Check credit → Review order → Accepted? → True: Create order in CRM, False: Notify sales rep.
    dummyjson.com is a public sample API, so these URLs work as they are.
    
    Then validate the workflow and fix any problems.
    Create a Maestro Automate project named OrderIntake with a workflow that does exactly this. Don't add, remove, or rename nodes.
    
    1. Rename the Manual trigger to "New order", set its ID to newOrder, and add two input arguments: productId (number) and customerId (string).
    2. Add an HTTP Request node "Check stock" (ID checkStock), GET, with the URL as an expression: "https://dummyjson.com/products/" + $vars.newOrder.output.productId
    3. Add an HTTP Request node "Check credit" (ID checkCredit), GET https://dummyjson.com/users/1
    4. Add an Autonomous Agent node "Review order" (ID reviewOrder) with the default model.
       System prompt: "You review new customer orders. Accept an order only if the product has stock greater than 0 and the customer record is present. Otherwise reject it. Always give a short reason."
       Give the agent the response body of Check stock as the product, and the response body of Check credit as the customer.
       Output variables: accepted (boolean) and reason (string).
    5. Add a Decision node "Accepted?" (ID accepted) with the condition $vars.reviewOrder.output.accepted
    6. On True, add a Script node "Create order in CRM" (ID createOrderInCrm): return { orderCreated: true, productId: $vars.newOrder.output.productId };
    7. On False, add a Script node "Notify sales rep" (ID notifySalesRep): return { notified: true, reason: $vars.reviewOrder.output.reason };
    
    The order is: New order → Check stock → Check credit → Review order → Accepted? → True: Create order in CRM, False: Notify sales rep.
    dummyjson.com is a public sample API, so these URLs work as they are.
    
    Then validate the workflow and fix any problems.
    

    智能体创建项目,添加节点并验证工作流。它可能会在此过程中询问您问题。根据提示回答问题。

  4. 智能体运行完成后,从资源管理器中打开.flow文件。它将在流画布上打开。

  5. 查看结果:

    • 画布与此页面顶部的工作流相符。
    • 没有节点显示警告图标,并且“问题”面板为空。
    • 底部工具栏会显示Maestro Automate。如果显示“Maestro Orchestrate” ,请将其选中,然后选择“Maestro Automate” 。

如果某些内容不匹配,请告诉智能体不同之处,例如:“缺少检查信用”。将其添加到“查看库存”和“审核订单”之间。

结果:您的画布与此页面顶部的工作流相符。

2. 进行测试​

测试使用示例数据在画布上运行工作流。

  1. 询问智能体:“调试产品 ID 为 1、客户 ID 为 c-100 的工作流。”
  2. 智能体运行工作流并报告结果。每个节点都应完成,并且运行应为True路径到CRM 中的“创建订单” ,因为示例产品有库存。
  3. 在报告中查看智能体的决策: accepted为true ,并简要说明原因,例如“产品有库存,并且存在客户记录”。

要自行查看运行情况,请选择画布底部工具栏中的“运行调试”(▸),然后在画布选项卡上按照“手动”中的步骤操作。

3. 部署并运行​

到目前为止,此工作流仅作为测试运行。部署后,它成为无需画布即可运行的实时工作流。每次运行都计入计划的每月运行次数。

  1. 询问智能体:

    Deploy this workflow, then start one run with productId 1 and customerId c-100, and tell me where I can see the run.
    Deploy this workflow, then start one run with productId 1 and customerId c-100, and tell me where I can see the run.
    

    智能体打包项目,进行部署,并使用这些输入开始运行。

  2. 在运行有时间完成时,询问:“运行是否完成?告诉我它的最终状态以及它采用的分支。”

智能体报告运行成功,并采用了True路径,前往在 CRM 中创建订单。

结果:您的工作流已部署,其首次运行采取了“True”路径,前往“在 CRM 中创建订单” 。

您学到了什么​

  • 触发器:每个工作流都从一个触发器开始,输入参数包含每次运行开始的数据。
  • HTTP 请求:节点调用另一个系统的 API,并将响应提供给后续节点。
  • 表达式: $vars.<node ID>.output读取上一个节点的输出。
  • 智能体:智能体读取数据,做出决策,然后返回您定义的输出变量。
  • 决策:一个条件沿两条路径之一发送每次运行。
  • 测试:调试运行显示每个节点接收和返回的内容。
  • 编码智能体:智能体可以根据描述构建相同的工作流,您可以在画布上进行查看。
  • 正在部署:部署的工作流在没有画布的情况下运行,并且每次运行都会列出其状态。

后续步骤​

  • 评估:根据一组示例订单检查智能体的决策。追踪条目上的“添加到评估”按钮是一种快速入门方法。
  • 部署工作流:让工作流在没有您的情况下运行。
  • 连接器:将这两个脚本替换为真实的应用程序。
  • 节点参考:每个节点以及如何配置节点。
  • 社区:提出问题,与其他构建器共享工作流。

此页面有帮助吗?

连接

需要帮助? 支持(opens in new window)

想要了解详细内容? UiPath Academy(opens in new window)

有问题? UiPath 论坛(opens in new window)

保持更新