Intelligent agent status

Updated at: 2025-03-14 02:11

This topic describes how to use AICallKit SDK to query the status of an intelligent agent.

Usage notes

Overview

Listening

The agent is listening for user input.

lQDPJwkbyth3cRHNCMDNBDiwP2pfm310vAsHVyIW5ozbAA_1080_2240

Thinking

The agent is thinking, and the large language model (LLM) is generating an output.

60a2105a465246cb559d6c07b203365a

Speaking

The agent is speaking and can be interrupted.

0787e08947b056173106fe33102f7984

Note

This feature is included in the integration solution with a UI.

Query the agent status

Possible states

State

Description

State

Description

Listening

The agent is listening for user input. If the user is speaking, the volume bar of the user may be displayed in this state.

Thinking

The agent is thinking and the current LLM is generating an output. The state changes to Listening when interrupted.

Speaking

The agent is broadcasting the LLM output. The state changes to Listening when interrupted.

Sample code

Android
iOS
Web
// Register a callback for a call engine.
mARTCAICallEngine.setEngineCallback(mCallEngineCallbackWrapper); 

// Handle callback events.
ARTCAICallEngine.IARTCAICallEngineCallback mCallEngineCallbackWrapper = new ARTCAICallEngine.IARTCAICallEngineCallback() {
    @Override
    public void onAICallEngineRobotStateChanged(ARTCAICallEngine.ARTCAICallRobotState oldRobotState, ARTCAICallEngine.ARTCAICallRobotState newRobotState) {
        // Use newRobotState to update the status on the UI.
    }

    @Override
    public void onVoiceVolumeChanged(String uid, int volume) {
        // If the agent is in the Listening state, the volume bar of the user is displayed.
    }
}
// Register a callback for a call engine.
self.engine.delegate = self

func onAgentStateChanged(state: ARTCAICallAgentState) {
    // Use state to update the status on the UI when the agent status changes.
}

func onVoiceVolumeChanged(uid: String, volume: Int32) {
    // If the agent is in the Listening state, the volume bar of the user is displayed.
}
engine.on('agentStateChange', (state) => {
  // Use state to update the status on the UI when the agent status changes.
  console.log('AICallAgentStateChange to:', state);
});

engine.on('speakingVolumeChanged', (userId, volume) => {
  // The speaking volume of the agent.
  // If the userId parameter is an empty string, the volume is the volume of the current user.
  console.log('AICallSpeakingVolumeChanged', volume);
});
  • On this page (1, T)
  • Usage notes
  • Overview
  • Query the agent status
  • Possible states
  • Sample code
Feedback