This topic describes how to integrate a Model Studio agent application into your multi-modal interaction application and call it from a client.
Create and configure a Model Studio application
- Create a Model Studio application. For more information, see Introduction to Application Types.
- Configure the application. Adjust the model, prompt, and any other capabilities you need. Rename the application to "Journey to the West Encyclopedia".
- Test and publish the application.
${user_name} to pass values from the client. In the skill configuration section, you can enable capabilities such as the MCP service, plugins, agents, and workflows as needed. After configuration is complete, test the application's behavior in the conversation area on the right.
Integrate into a multi-modal application
Import the "Journey to the West Encyclopedia" application you configured in the previous step into your multi-modal interaction application.
- In the menu, choose Agent > Add > My Applications. Select "Journey to the West Encyclopedia" and click OK to import it.
- Publish the application.
Test the application and configure parameters
Test the application
After importing "Journey to the West Encyclopedia" into your multi-modal interaction application, you can test it on the web page.
To activate the "Journey to the West Encyclopedia" application, use the voice command: "Open Journey to the West Encyclopedia and tell me who the Three Pure Ones are."
The system successfully calls the Journey to the West Encyclopedia agent and responds with a child-friendly explanation of the Three Pure Ones in Taoism (Yuanshi Tianzun, Lingbao Tianzun, and Daode Tianzun). This verifies that the voice interaction test is successful.
Configure parameters
In the "Journey to the West Encyclopedia" application, we configured a parameter named ${user_name}. This represents the user's nickname and has a default value of "Xiaobao".
When calling the multi-modal interaction application using the SDK, you can configure the value for ${user_name} in your code.
Level-1 parameter | Level-2 parameter | Level-3 parameter | Level-4 parameter | Description |
|---|---|---|---|---|
biz_params | Business parameters for the multi-modal request. | |||
user_defined_params | For passing user-defined parameters. | |||
user_defined_app_id | The application ID of the imported Model Studio application. | |||
user_prompt_params | Type: Object The custom variable names and values in the prompt of the Model Studio application. |
- Format example
Update parameters using UpdateInfo
You can use this method to pass parameters to your agent during a conversation. These parameters are then included in the next request to the agent service.
These parameters are included in every subsequent request to the agent. You can use UpdateInfo to update parameters with the same name.
parameters.bizParams | Parameter | Level-1 parameter | Type | Description |
user_defined_params | Object | Parameters configured for the agent. | ||
agentId | Object | An object where each key is an agent ID. The parameters in this object are passed to the agent. | ||
user_prompt_params | Object | Use this object to pass parameters defined in the agent's prompt. |
Passing images using UpdateInfo
If your agent supports image modality interactions, you can also pass images to the agent as a URL or as base64-encoded data.
Key parameter: parameters.images[]
images[] | Parameter | Type | Description |
type | String | The type of the image. Valid values: "url" and "base64". | |
value | String | The image URL or base64-encoded data. Note: If you submit data in base64 format, the original image size cannot exceed 180 KB. |
Client-side verification
The following example uses the Android SDK.
- Set the variable value in the connection establishment parameters.
- Run the demo and make a voice request to the "Journey to the West Encyclopedia" agent. Because the client set the username to "Dami", the application's reply addresses the user as "Dami". This verifies that the end-to-end test is successful.
Proactive exit from conversation takeover
In your multi-modal interaction application, you can enable "conversation takeover" mode for an integrated Model Studio application. When this mode is enabled and a user activates the application with a "trigger command", the application handles all subsequent turns in the conversation. This continues until the user says an "exit command" or the application itself proactively ends the conversation.
In the Configure Application dialog box, enable the This application takes over all subsequent conversations switch. Set a trigger command (for example, "Open Journey to the West Encyclopedia") and an exit command (for example, "Exit Journey to the West Encyclopedia"), and then click OK.
In addition to the user saying an exit command, a Model Studio application can proactively decide when to exit takeover mode based on its own business logic. This method provides more flexibility and allows for more intelligent conversation flow control.
The application initiates a proactive exit by adding a specific "directive marker" to the beginning of its response. The following two exit scenarios are supported:
-
Scenario 1: The application exits after completing a task and providing a response
This occurs when the application determines that the current conversation can end and has generated the final response for the turn. Once the application exits, the multi-modal platform plays only the returned response.
-
Directive marker:
[#blmm-quit#]Example: The application returns[#blmm-quit#]Goodbye!. The user only hearsGoodbye!. The conversation then exits the current application.
-
Directive marker:
-
Scenario 2: The application exits after being unable to handle the current query and relinquishes control
This occurs when the application determines it cannot handle the user's current request and must exit, returning the query to the main flow of the multi-modal interaction.
-
Directive marker:
[#blmm-rejected#]Example: The application returns only[#blmm-rejected#]. The multi-modal platform takes over and finds another way to respond to the user's original query without playing any content from the current application.
-
Directive marker:
Customize the broadcast voice
You can also specify a unique voice for your integrated Model Studio application to distinguish it from the voice of the main flow.
In the Configure Application dialog box, disable the The application's broadcast voice remains consistent with the main flow switch. Then, in the voice drop-down list, select the desired voice (for example, Longan Huan).
- In addition to specifying a voice for each integrated Model Studio application in the console, you can use API parameters for more granular voice control.
Parameter | Method | Required | Description |
|---|---|---|---|
speaker_1_voice | SDK | No | Specifies the broadcast voice. The available values for the voice depend on the list of voices supported by the Text-to-Speech (TTS) model configured for the application. |
- Example of a client call. In the payload.biz_params node of the Start message, use the following format to set the broadcast voice:
- How to find the Model Studio application ID