Share an agent application

更新时间:
复制 MD 格式

Alibaba Cloud Model Studio lets you share or publish applications to different platforms in multiple ways, making it easy to integrate AI capabilities into your business. This topic uses an agent application as an example to demonstrate how to share the application as a webpage, integrate it with DingTalk and WeChat, publish it as a reusable component, and interact with it in real time using audio and video.

Prerequisites

You have built and published an agent application. For more information, see Create an agent application.

Share or publish a Model Studio application

  1. Go to the Application Management page in the Model Studio console. On the card for the target agent application, click Publish.

  2. Agent applications support the following five sharing or publishing methods.

Share an application using the Official Webpage or UI Application

Note

Permissions for accessing shared applications

  • Who can access? The application creator (Alibaba Cloud account), RAM users, and other Alibaba Cloud users who have the link.

  • Billing: All costs incurred through the shared link are charged to the UID of the application creator.

  1. Official Webpage

    Currently, sharing through the official webpage is supported only for agent applications, not for workflow applications
    1. To the right of Official Webpage, click Create to deploy the web application. The default validity period is 7 days.

    2. To track the number of tokens consumed by the web application, click Monitor to enable the service. Then, click Enable Application Observation.

      Enable Application Observation, you can go to the Monitor page to Disable Observation.

      After the application is published, the page displays a green Published label and a shareable link with an expiration time. You can adjust the link's validity period from the 7-day validity drop-down list. To take the webpage offline, click Unpublish Webpage.

    3. Click the image icon on the right to copy the web application link. You can then share the link with other users. Any Alibaba Cloud user with the link can access this application.

    4. Click Unpublish Webpage > Confirm Unpublish to stop the web application service.

  2. Mobi sharing channel

    1. To the right of UI Application, click View to go to the UI Designer interface.

    2. For more information about how to edit and publish the application interface, see UI Design.

    3. Go to the UI Designer page in the Model Studio console. Hover over the published UI and click Environment Deployment.

    4. You can share the Application Address with other users. Any Alibaba Cloud user who has the link can access this application. Click Deactivate to stop the application service.

      In the Application Environment Information dialog box, the Development Environment has a Published status and an available application address. The Production Environment has an Unpublished status, and its application address is not available.

Publish an application through DingTalk

  1. On the Publish to Platform tab of the agent application, click Authorize first on the right side of the DingTalk Robot card.

    If you have already granted authorization, skip to step 3.
  2. In the Authorization dialog box, select Select to agree, and then click Confirm Authorization.

    Important

    If this is the first time you are creating an application for the WeChat or DingTalk channel on the Model Studio platform, you must authorize AppFlow from Alibaba Cloud Computing Co., Ltd. to provide automated application integration services. This includes the following two authorizations:

    • Authorize the service-linked role (SLR) to be associated with AppFlow.

    • Authorize the API key to be encrypted and transmitted to AppFlow to call applications on the Model Studio platform.

  3. To the right of the DingTalk Robot card, click Create. In the Select API Key step of the Configure DingTalk panel, select an existing API key from the list and click Next Step. To create or manage keys, you can click Manage API Keys or Create API Key in the upper-right corner.

If no API keys are available, click Create API Key. After you create a key, select it. You can also click Manage API key to go to the My API Keys page to manage your API keys.
  1. In the Configure Message step of the Configure DingTalk panel, configure the DingTalk Template ID, DingTalk Client ID, and DingTalk Client Secret parameters. Then, click Confirm.

    To obtain the DingTalk Template ID, DingTalk Client ID, and DingTalk Client Secret, follow these steps:

    Next, you need to create a simple DingTalk application in your organization to act as an AI assistant that answers user questions.

    Important

    To create a DingTalk application, your DingTalk account must have developer permissions. You can contact your organization administrator to obtain developer permissions for the DingTalk Open Platform. For more information, see Obtain developer permissions.

    Step 1: Create an application

    1. Go to the DingTalk Open Platform.

      • If this is your first time creating a DingTalk application, click Application Development Guide > Create.

      • If you have created an application before, click Quickly Build AI Applications > Get Started.

    2. In the navigation pane on the left, click DingTalk Applications. In the upper-right corner of the page, click Create Application.

    3. Enter an Application Name and Application Description. You can also upload an Application Icon. Click Save.

    Step 2: Obtain the application Client ID and Client Secret

    In the navigation pane on the left, select Credentials and Basic Information. Copy the Client ID and Client Secret to use when you create the connection flow.

    Step 3: Create a message card and obtain the card template ID

    The DingTalk robot supports streaming responses through card messages. You need to create a card template for sending messages.

    1. Go to the Card Platform and click Create Template.

    2. In the create template text box, enter the template information and click Create.

      • Set Card Type to Message Card.

      • Set Card Template Scenario to AI Card.

      • For Associated Application, select the application that you created in Step 1: Create an application.

      • For Create from Template, do not select a preset template.

    3. On the simulation editing page, leave the default configurations. Save and Publish the template, and then click Back. After the template is created, you are redirected to the AI card template editor.

    4. In the navigation pane on the left, click Template List. Find the template that you created and locate its Template ID at the bottom of the card. Click the copy icon to copy the ID. You will need this template ID later.

    Step 4: Grant the application permission to send card messages

    After you create the card, you must grant the application permission to send card messages.

    1. Go to the DingTalk application list. Click the name of the application you just created to go to its product page.

    2. In the navigation pane on the left, select Permission Management. In the search box, enter Card.Streaming.Write and Card.Instance.Write. In the Actions column for each permission, click Request Permission.

    3. After you obtain the permissions, enter the Template ID, Client ID, and Client Secret in the publishing configuration window of the Model Studio application. You can then publish the Model Studio application to the DingTalk application.

  2. After the DingTalk application is created, go to the Publish Channel tab of the Model Studio application and copy the Webhook Address. You can share this Webhook Address with target users.

    Users who have the Webhook Address can configure a robot for the DingTalk application and add it to group chats to answer user questions.

    Configure the DingTalk robot

    Step 1: Configure the DingTalk robot

    1. Go to the DingTalk application list. Find the application you just created and click its name to go to the product page.

    2. On the Add Application Capabilities page, find the robot card and click Add.

    3. Turn on the Robot Configuration switch.

      • Robot Name, Robot Icon, Robot Introduction, Robot Description, Robot Message Preview Image: Configure these parameters as described on the page.

      • Set Message Reception Mode to HTTP mode. AppFlow supports only HTTP mode. If you select Stream mode, messages will not be returned.

      • For Message Reception Address, paste the Webhook Address that you obtained from the Model Studio publishing channel.

      • Click Publish.

    Step 2: Publish the application version

    After the application is created, you need to publish a version if you want other users in your enterprise to use it.

    1. Click Application Development. On the DingTalk Applications page, click the application you just created.

    2. In the navigation pane on the left, click Version Management and Publishing. In the upper-right corner, click Create New Version. On the version details page, enter the Application Version Number and Version Description, and select an Application Visibility Scope. Then, click Save. In the dialog box that appears, click Publish Directly.

    Step 3: Test the robot

    You can create a new group chat or add the robot to an existing one to chat with it and see the results.

    1. Add the robot in DingTalk Group Management.

      Go to the DingTalk group's Group Settings page. Click the Robot card area. On the Robot Management page, click Add Robot. In the Search text box of the Add Robot dialog box, enter the name of the target robot and select it. Click Add, and then click Finish Adding.

    2. In the DingTalk group, mention the robot to interact with it. After the robot is added, group members can ask it questions by typing @RobotName (for example, @Bailian Mobile Assistant) in the chat. The robot automatically replies with the relevant answer.

Publish an application through WeChat

If you have already granted authorization when you created the DingTalk robot, you do not need to grant it again. For information about the authorization process, see the corresponding steps in Publish an application through DingTalk.
  1. On the Publish to Platform tab of the agent application, click Create on the right side of the WeChat Official Account card.

  2. In the Select API Key step of the Configure WeChat panel, select the target API key and click Next Step.

    If no API keys are available, you can click Create API Key. After you create a key, select it. You can also click Manage API key to go to the My API Keys page to manage your API keys.
  3. In the Configure Message step of the Configure WeChat panel, select the target WeChat credential, and then click Confirm.

    If no WeChat credential options are available, you can click go to create. For more information, see the following steps.

    In the dialog box, enter the Developer ID (AppID), and then click Authorization.

    To obtain the Developer ID (AppID), go to the WeChat Official Account admin console. In the navigation pane on the left, choose Settings and Development > Development Interface Management. Select the Basic Configuration tab to view the AppID.

  4. After the WeChat Official Account AI Robot is created, go to the Publish Channel tab. The WeChat Official Account card displays a Created status, which indicates that the WeChat customer service QR code is generated. Hover over the image icon to view the QR code. You can share this QR code with target users. To test the feature, click the Scan to Use button and scan the QR code with WeChat.

Publish an application as a component

  1. On the Publish Channel tab of the agent application, hover over Component, and click Create on the right.

  2. Configure the component information and click Confirm Publish.

    Parameter Name

    Description

    Component Name

    Enter a custom name. Use a name that has a clear meaning. For example, Weather Analysis Agent.

    Component Description

    A brief description of the component's features and scenarios. Use natural language for the description. For example, Used to analyze weather information for a city.

    After the component is published, when you reference it in an Agent Application, the LLM automatically determines whether to call the component based on its description and the context. When you reference the component in a workflow application, the component description only explains the component's features and does not affect the workflow's execution.

    Input Information

    Alias

    To avoid identical parameter names, you need to give each parameter an alias. When the component is called, the caller can only see the parameter's alias.

    Parameter Description

    A description of the parameter's content.

    • When you reference the component in an agent and the parameter passing method is Model Recognition, the LLM automatically fills in the parameter content based on the parameter description.

    • In other cases, this description is only for informational purposes.

    Whether Required

    Set as needed.

    Visibility

    Specifies whether the component exposes this parameter externally. This is used to hide unnecessary parameters. For example, if a component uses a text model, you need to hide the image input parameter.

    Passing Method

    Business Pass-through:

    • When you reference the component in an agent, the value is provided by the component's user.

    • When you reference the component in a workflow, the value is provided by an ancestor node.

    Model Recognition:

    • When you reference the component in an agent, the LLM automatically infers and fills the value from the context based on the parameter description.

    • When you reference the component in a workflow, even if the parameter's Passing Method is set to Model Recognition, the application does not automatically infer the parameter value. You must explicitly provide an input value for the parameter from an ancestor node, just as you would for Business Pass-through.

    Default Value

    Set as needed.

  3. After the component is published, you can reference it in an agent application or a workflow application.

    Note
    • Avoid nested calls: If application A calls application B, and application B calls application A, the application enters a recursive loop, which makes the feature unavailable.

    • Avoid multi-level calls: If application A calls application B, and application B calls application C, the application has a maximum runtime limit. Multi-level calls can easily cause timeout errors.

    Reference a component in an agent application

    1. On the Application Management page in Alibaba Cloud Model Studio, when you create an agent application, select the component in the Skills section.

      You can select only published agent components.

      Click the + icon next to Agent and make your selection in the Select Agent panel that appears.

    2. After configuration, enter a question related to the component's feature to test the result.

      If the referenced component contains parameters that require Business Pass-through, you can manually configure the Input Variable Configuration during testing or pass the parameters using the biz_param parameter in an API call.

    Reference a component in a workflow application

    1. On the Application Management page in Alibaba Cloud Model Studio, when you create a workflow application, drag the Component node onto the canvas, and then select a component.

      You can select published agent components or workflow components.

    2. After configuration, enter a question related to the component's feature to test the result.

Publish an application using real-time audio and video interaction

Note

Only image-and-text conversational applications in Model Studio are supported. This includes agent applications and workflow applications.

  1. On the AI Real-time Interaction tab of the agent application, click Voice Interaction/Video Interaction, and then click Configure on the right side of the page.

  2. In the View API-KEY configuration wizard, select the target API key and click OK.

  3. In the upper-right corner, click image to generate a temporary QR code for testing. Scan the code with WeChat, DingTalk, or a browser on your mobile phone to test the interaction.

    The QR code is valid for 24 hours. You can also click Copy Link to share the experience link directly.

  4. After testing, click Publish > Confirm Publish. After the application is published, go to the Publish Channel tab. Enable Intelligent Media Services, authorize the SLR, and then create an interactive agent.

    Real-time audio and video interaction applications support two publishing channels:

    1. Scan QR code for H5/App: Click Generate Sharing Link, set the Token Validity Period, and then click Confirm.

      In the Share and Experience dialog box, two options are available. For the H5 Experience, you can scan the QR code with WeChat or DingTalk, or copy the link and open it in a mobile browser. For the APP Experience, you must scan the code in AI Agent > Custom Agent > Authorization Token. When you install the application on an iOS device, you must go to Settings > General > VPN & Device Management, find the trust profile for Taobao, and select Trust.

    2. SDK Integration: Click SDK Integration. You can choose Quick Integration to quickly deploy and run the audio and video interaction service. You can also choose Developer Integration to extend more advanced features based on your business needs.

      Quick Integration supports the Web, iOS, and Android platforms. The page provides a Share ID that you can update by clicking Regenerate. Add the installation code to the <body> section of your webpage and enter the Share ID to run the application without AppServer debugging. This method is for testing only. Developer Integration is based on the AICallKit SDK and provides two integration options: with UI solution and without UI solution.