On this page

Quick Start Voice Call

2026-08-14

Quick Start Digital Human Video Call

This document explains how to quickly call AI Agent related backend APIs to achieve video interaction with AI Agent.

Digital Human Introduction

With just a photo or image of a real person or anime character from the waist up, you can obtain a 1080P digital human with accurate lip-sync and realistic appearance. When used with the AI Agent product, you can quickly achieve video interaction chat with AI digital humans with an overall latency of about 1.5s, suitable for scenarios such as digital human 1V1 interactive video, digital human customer service, and digital human live streaming.

  • More natural driving effects: supports subtle body movements, natural facial expressions without distortion, providing a more realistic and immersive interaction compared to voice calls;
  • Multi-language accurate lip-sync: natural and accurate lip movements, especially optimized for Chinese and English;
  • Ultra-low interaction latency: digital human driving latency < 200ms, combined with AI Agent interaction latency < 1.5s;
  • Higher clarity: true 1080P effect, 20%+ improvement in clarity compared to traditional image-based digital humans.

Go to the download page to download and experience.

Quick Start Digital Human Live Broadcast

Prerequisites

  • You have created a project in the ZEGOCLOUD Console and obtained a valid AppID and ServerSecret (for server API signing and RTC Token04 generation). For details, see Console - Project Info.
  • You have contacted ZEGOCLOUD Technical Support to enable the AI Agent related services and obtained LLM and TTS related configuration information. For details, see Console - AI Agent.
  • You have obtained a valid digital_human_id (for testing, you can use the public ID: 63c3aa64-1d80-4b04-a0be-1c65614eb7eb).
  • You have contacted ZEGOCLOUD Technical Support to create a digital human.
Note

During the test period (within 2 weeks after the AI Agent service is enabled), you can set the LLM and TTS authentication parameters to "zego_test" to use the related services. For details, see Register Agent > BODY Parameter Description.

You can also purchase LLM and TTS services supported by ZEGOCLOUD to obtain authentication information. Alternatively, you can contact ZEGOCLOUD sales to purchase TTS services directly.

Example Code

The following is the example code for the business backend that integrates the real-time interactive AI Agent API. You can refer to the example code to implement your own business logic.

The following is the client sample code. You can refer to the example code to implement your own business logic.

The following video demonstrates how to run the service backend and client (Web) example code and interact with the digital human agent.

Overall Business Process

  1. Service backend: run the business backend example code and deploy the business backend.
    • Integrate the real-time interactive AI Agent API to manage AI Agents.
  1. Client: refer to the Android Quick Start, iOS Quick Start, or Web Quick Start document to run the client example code.
    • Create and manage AI Agents through the business backend.
    • Integrate ZEGO Express SDK for real-time communication.
    • Integrate Digital Human SDK for digital human rendering.

After completing the above three steps, you can achieve real-time video interaction between the AI Agent and real users by joining the room.

Core Implementation

1

Register Agent

Register Agent is used to set the basic configuration of the AI Agent, including the agent name, LLM, TTS, ASR, and other related configurations. After registration, the agent can be used as a template to create multiple instances for real-time interaction with multiple real users.

Typically, the agent configuration is relatively fixed. Once the relevant parameters (persona) are set, they do not change frequently. Therefore, it is recommended to register the agent at the appropriate time according to your business flow. The agent will not be automatically destroyed or recycled after registration. Once an agent instance is created, you can interact with the agent via voice.

Note
An agent can only be registered once (with the same ID). If you register it again, error code 410001008 will be returned.

The following is an example of calling the Register Agent API:

Server(NodeJS)
// Please replace the LLM and TTS authentication parameters (ApiKey, appid, token, etc.) in the following example with your actual authentication parameters.
async registerAgent(agentId: string, agentName: string) {  
    // Request URL: https://aigc-aiagent-api.zegotech.cn?Action=RegisterAgent  
    const action = 'RegisterAgent';  
    const body = {  
        AgentId: agentId,  
        Name: agentName,  
        LLM: {  
            Url: "https://ark.cn-beijing.volces.com/api/v3/chat/completions",  
            ApiKey: "zego_test",  
            Model: "doubao-1-5-pro-32k-250115",  
            SystemPrompt: "You are an AI Agent. Please answer the user's questions."  
        },  
        TTS: {  
            Vendor: "ByteDance",  
            Params: {  
                "app": {  
                    "appid": "zego_test",  
                    "token": "zego_test",  
                    "cluster": "volcano_tts"  
                },  
                "audio": {  
                    "voice_type": "zh_female_wanwanxiaohe_moon_bigtts"  
                }  
            }  
        }  
    };  
    // The sendRequest method encapsulates the request URL and common parameters. For details, see: /aiagent-server/api-reference/accessing-server-apis  
    return this.sendRequest<any>(action, body);  
}  
Note
  • Please ensure all LLM parameters are correctly filled in according to the LLM service provider's official documentation. Otherwise, you may not be able to see the agent's text responses or hear the agent's voice output.
  • Please ensure all TTS parameters are correctly filled in according to the TTS service provider's official documentation. Otherwise, you may see the agent's text responses but not hear the agent's voice output.
  • If the agent cannot output text or voice, please first check whether the LLM and TTS parameter configurations are completely correct, or refer to Get AI Agent Service Status - Monitor Server Exception Events to identify the specific issue.
2

Create Digital Human Agent Instance

You can use a registered agent as a template to create multiple digital human agent instances to join different rooms for real-time interaction with different users. After creating a digital human agent instance, the instance will automatically log in to the room and publish stream, while also playing the real user's stream.

After successfully creating a digital human agent instance, the digital human config needs to be returned to the client. The client initializes the Digital Human SDK based on the digital human config, and can then interact with the digital human in real time.

Note
After the client successfully joins the room, you should immediately call this API so that the agent instance can join the room and start publishing and playing streams.


Note
By default, a maximum of 10 digital human agent instances can exist simultaneously under one account. Creating digital human agent instances will fail if this limit is exceeded. To adjust the limit, please contact ZEGOCLOUD sales.

The following is an example of calling the Create Digital Human Agent Instance API:

Server(NodeJS)
async createDigitalHumanAgentInstance(agentId: string, userId: string, rtcInfo: RtcInfo, digitalHuman: DigitalHumanInfo, messages?: any[]) {  
    // Request URL: https://aigc-aiagent-api.zegotech.cn?Action=CreateDigitalHumanAgentInstance  
    // const rtcInfo = {  
    //   RoomId: room_id,  
    //   AgentStreamId: agent_stream_id,  
    //   AgentUserId: agent_user_id,  
    //   UserStreamId: user_stream_id,  
    // };  
    const action = 'CreateDigitalHumanAgentInstance';  
    const body = {  
        AgentId: agentId,  
        UserId: userId, // Real user ID interacting with this AI Agent instance  
        RTC: rtcInfo,  
        DigitalHuman: digitalHuman, // For testing, you can use the public ID: 63c3aa64-1d80-4b04-a0be-1c65614eb7eb  
        MessageHistory: {  
            SyncMode: 1, // Change to 0 to use history messages from ZIM  
            Messages: messages && messages.length > 0 ? messages : [],  
            WindowSize: 10  
        }  
    };  
    // The sendRequest method encapsulates the request URL and common parameters. For details, see: /aiagent-server/api-reference/accessing-server-apis  
    const result = await this.sendRequest<any>(action, body);  
    console.log("create agent instance result", result);  
    // The returned DigitalHumanConfig is the digital human config. The client initializes the Digital Human SDK based on the config, and can then interact with the digital human in real time.  
    return result.AgentInstanceId, result.DigitalHumanConfig;  
}  

After completing this step, you can create digital human agent instances. Once the client is integrated, you can interact with the digital human agent instance via video.

3

Integrate Client SDK

Please refer to the following documents to complete client integration development:

Congratulations 🎉! After completing this step, you have successfully integrated the client SDK and can interact with the agent instance in real time via voice. You can ask the agent any question by voice, and the agent will respond!

4

Delete Agent Instance

After deleting the agent instance, the agent instance will automatically exit the room and stop publishing stream. After the real user stops publishing stream and exits the room on the client, a complete interaction session ends.

The following is an example of calling the Delete Agent Instance API:

Server(NodeJS)
async deleteAgentInstance(agentInstanceId: string) {  
    // Request URL: https://aigc-aiagent-api.zegotech.cn?Action=DeleteAgentInstance  
    const action = 'DeleteAgentInstance';  
    const body = {  
        AgentInstanceId: agentInstanceId  
    };  
    // The sendRequest method encapsulates the request URL and common parameters. For details, see: /aiagent-server/api-reference/accessing-server-apis  
    return this.sendRequest(action, body);  
}  

The above is the complete core flow for achieving real-time voice interaction with the AI Agent.

Callback Monitoring

Note
Since LLM and TTS parameters are numerous and complex, it is easy to encounter various abnormal issues during integration testing, such as the agent not responding or not speaking, due to incorrect parameter configuration. We strongly recommend that you monitor callbacks during integration testing and quickly troubleshoot issues based on callback information.

Previous

Quick Start Voice Call

Next

Quick Start Digital Human Live Broadcast