activities
latest
false
重要 :
请注意,此内容已使用机器翻译进行了部分本地化。 新发布内容的本地化可能需要 1-2 周的时间才能完成。
UiPath logo, featuring letters U and I in white

Integration Service 活动

上次更新日期 2025年11月19日

执行线程

描述

此活动可让 Maestro 编排的自动化流程连接到 Azure AI Foundry 项目并调用其中定义的智能体。

创建 Microsoft Azure AI Foundry 智能体

在 Azure Foundry AI 中,可以使用 Azure 支持的编码方法和无代码方法创建智能体。UiPath 连接器兼容性取决于 API 在projectname/services.ai.azure.com/api/部署和可用的智能体。

Maestro 与智能体创建过程中应保留同种交互策略。在 Maestro 业务流程中,Maestro 会将一组预定义的参数发送给智能体,其中明确指出智能体将在回复中使用哪些参数,以继续推动流程实现目标。

如何使用活动

要在 Maestro 智能体流程中使用此活动,请按照以下步骤操作:

  1. 在画布中添加服务任务元素,然后打开任务的“属性”面板。
  2. 将服务任务命名为Foundry Hello World
  3. 实施部分的操作下拉列表中,选择启动并等待外部智能体
  4. 选择“Microsoft Azure AI Foundry连接器”。
  5. 选择现有连接或新建连接。有关更多信息,请参阅Microsoft Azure AI Foundry 身份验证
  6. “活动”中,选择“执行线程”

  7. 智能体名称中,选择先前在 Microsoft Azure AI Foundry 中创建的智能体。
  8. 消息中,输入“你可以做什么?”。确保在提示词中添加引号。

    docs image
  9. 将开始事件连接到画布中的服务任务,然后将服务任务连接到结束事件节点。

  10. 选择“调试”以运行此流程。成功运行后,查看全局变量并查找来自来源的{:} 响应Foundry 你好,世界。记下回复的结构。

    注意: Foundry 代理执行最多可能需要 90 秒才能完成。在极少数情况下,由于 Foundry 代理的异步响应机制,最长可能需要 10 分钟。

    例如,以下是智能体对“你可以做什么?”提示的响应:

    {
      "content_value": "Here’s how I can assist you:\n\n- **Recommend AI Tools**: Suggest the best AI tools (apps, platforms, APIs) for your specific challenge, need, or workflow.\n- **Usage Guidance**: Provide clear steps on how to use the suggested AI tool for your scenario.\n- **Prompt Writing**: If the suggestion involves an AI language model (like ChatGPT, Claude, etc.), I provide you with a ready-to-use prompt tailored to your need.\n- **Comparison**: Offer quick comparisons between similar AI tools if needed.\n- **Special Cases**: Point you to tools with image/audio/video capabilities for media-related requirements.\n\n**Try me:**  \n- State your problem, task, or goal (e.g., “I need to summarize research articles”).\n- I’ll reply with the best matching AI tool and exact usage instructions/prompt.",
      "thread_id": "thread_AJhKo6PvrzCFu1dtpXV1ZEqM",
      "assistant_id": "asst_lozoOWbsiggHu9QItxfrXZt1",
      "role": "assistant",
      "run_id": "run_GS5b1gEgXElhudrhFSAtFzQo",
      "content_type": "text",
      "latest_message_id": "msg_D5MUkFj4AvsHKNdHNFQBJpAv",
      "created_at": 1758581230,
      "object": "thread.message",
      "timestamp": "2025-09-22T22:47:10Z",
      "eventType": "TRIGGER_CREATED"
    }{
      "content_value": "Here’s how I can assist you:\n\n- **Recommend AI Tools**: Suggest the best AI tools (apps, platforms, APIs) for your specific challenge, need, or workflow.\n- **Usage Guidance**: Provide clear steps on how to use the suggested AI tool for your scenario.\n- **Prompt Writing**: If the suggestion involves an AI language model (like ChatGPT, Claude, etc.), I provide you with a ready-to-use prompt tailored to your need.\n- **Comparison**: Offer quick comparisons between similar AI tools if needed.\n- **Special Cases**: Point you to tools with image/audio/video capabilities for media-related requirements.\n\n**Try me:**  \n- State your problem, task, or goal (e.g., “I need to summarize research articles”).\n- I’ll reply with the best matching AI tool and exact usage instructions/prompt.",
      "thread_id": "thread_AJhKo6PvrzCFu1dtpXV1ZEqM",
      "assistant_id": "asst_lozoOWbsiggHu9QItxfrXZt1",
      "role": "assistant",
      "run_id": "run_GS5b1gEgXElhudrhFSAtFzQo",
      "content_type": "text",
      "latest_message_id": "msg_D5MUkFj4AvsHKNdHNFQBJpAv",
      "created_at": 1758581230,
      "object": "thread.message",
      "timestamp": "2025-09-22T22:47:10Z",
      "eventType": "TRIGGER_CREATED"
    }

智能体的输出必须分配给流程变量,以便影响 Maestro 流程的进度,例如,根据布尔值评估做出决策,或使用分类任务的答案。

  1. 在设计模式下,从设计画布中选择智能体。

  2. 选择(“属性” >“属性”)

  3. 在“输出”下,选择“新增” ,然后添加一个名为 agent_reponse 的 字符串 类型变量。

  4. 对于“值” ,选择“Foundry Hello World” > “响应” > “内容值(字符串)”

提示:在实践中,指定您选择的智能体的结构化输出,然后使用表达式编辑器在 Maestro 中评估输出,以按照流程所需的类型提取所需的输出的特定部分。

在 Maestro 中使用表达式编辑器处理智能体输出的示例:

如果提示词为:

“法国的首都是哪里?”仅在 JSON 输出的形式上提供 {"capture":"Normandy") 答案
响应为result.reponse.Content_value(类型为string ):
{"capture":"Paris"}
如果要将其转换为 JSON,请创建一个新的 JSON 类型变量(例如answer_in_JSON ,然后使用表达式编辑器:
js:JSON.parse(result.response.messages[0].Content)
该 js 表达式的结果为(键入JSON ):
{
  "capital": "Paris"
}{
  "capital": "Paris"
}

故障排除和调整

除了建立连接外,您还应该在 Microsoft Azure AI Foundry 工作区和 Maestro 中测试提示词。这可确保您获得所需的输出,这些输出最适合 Maestro 使用,分配给变量,并传递给流程中的其他参与者。

我们建议将详细提示保留在 Microsoft Azure AI Foundry 中智能体的系统提示中。Maestro 在运行时向智能体提供的用户提示应该简明扼要。其作用主要是指示智能体执行特定任务并生成预期的一致输出所需的相关变量。

针对人类的输出(例如升级原因)可以轻松地作为自然文本传递给人类。API/机器人操作的预期输出必须经过严格撰写。以下是智能体生成特定输出的用户提示示例。使用 Studio 中的 C# 表达式编辑器根据需要添加变量。
"What is the quantity on inventory of Order ID " + vars.orderId_1 + "respond only with a JSON object with the quantity in the key Order_Quantity. No explanations, only JSON""What is the quantity on inventory of Order ID " + vars.orderId_1 + "respond only with a JSON object with the quantity in the key Order_Quantity. No explanations, only JSON"

智能体将回复:

{"Order_Quantity":"100"}{"Order_Quantity":"100"}
请特别注意您向智能体发出的请求和实际响应中所包含的类型。即使响应看起来像JSON类型,它实际上可能是string类型。

此页面有帮助吗?

获取您需要的帮助
了解 RPA - 自动化课程
UiPath Community 论坛
Uipath Logo
信任与安全
© 2005-2025 UiPath。保留所有权利。