StartAgent

Updated at:

Starts an AI agent.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

rtc:StartAgent

create

*App

acs:rtc::{#accountId}:app/{#AppId}

None None

Request parameters

Parameter

Type

Required

Description

Example

AppId

string

Yes

The application ID. You can create and query application IDs in the console. Only a single ID is supported.

aoe****

ChannelId

string

Yes

The ID of the channel to join. Only a single ID is supported.

yourChannelId

TaskId

string

Yes

The task ID.

yourTaskId

TemplateId

string

Yes

The template ID.

76dasgb****

RtcConfig

object

Yes

The configuration for the agent to join the RTC channel.

2

UserId

string

Yes

The user ID of the agent in the RTC channel.

423341

TargetUserIds

array

No

The list of user IDs subscribed by the agent. Currently, only one user ID is supported.

string

No

The user ID.

41411

UserInactivityTimeout

integer

No

The maximum duration threshold for user inactivity, in seconds. When any of the following conditions lasts for the specified threshold, the agent automatically stops and exits the channel:

  • All users in the targetUserIds list have left the channel.

  • No users in the targetUserIds list have joined the channel.

Default value: 30. Valid values: 5 to 180.

30

VoiceChatConfig

object

No

The configuration for AI voice chat.

ChatMode

integer

No

The chat mode. Valid values:

  • 1: Natural conversation mode. This is the default value.

  • 2: Walkie-talkie mode.

1

InterruptMode

integer

No

Specifies whether voice interruption is supported. Valid values:

  • 1: Voice interruption is supported. This is the default value.

  • 2: Voice interruption is disabled.

1

Greeting

string

No

The greeting message.

Good morning, my friend

ASRConfig

object

No

The ASR configuration.

SourceLanguage

string

No

No configuration is required.

zh

SemanticPunctuationEnabled

boolean

No

Specifies whether semantic or voice punctuation is enabled.

false

MaxSentenceSilence

integer

No

The voice punctuation detection threshold, in milliseconds. Default value: 800. Valid values: 200 to 6000.

800

VocabularyId

string

No

The ID of the supported hot word vocabulary.

vocab-xxx-24ee19fa8cfb4d52902170a0xxxxxxxx

LanguageHints

array

No

The list of language codes for speech recognition. If you do not specify this parameter, the model automatically identifies the language. Valid values:

  • zh: Chinese, including Mandarin and various dialects such as Shanghainese, Wu, Minnan, Northeastern, Gansu, Guizhou, Henan, Hubei, Hunan, Jiangxi, Ningxia, Shanxi, Shaanxi, Shandong, Sichuan, Tianjin, Yunnan, and Cantonese.

  • en: English.

  • ja: Japanese.

  • yue: Cantonese.

  • ko: Korean.

string

No

The language code.

zh

VadConfig

object

No

The VAD configuration.

InterruptSpeechDuration

integer

No

The minimum duration of continuous human voice signals required to prevent false interruptions, in milliseconds. Default value: 300. Valid values: 0 to 3000.

300

LLMConfig

object

No

The LLM configuration.

Vendor

string

No

The name of the service provider. Examples: aliyun for Alibaba Cloud Model Studio, and thirdparty.

aliyun

Model

string

No

The name of the model. Supported models for the aliyun provider:

  • qwen-plus

  • deepseek-r1

  • qwen-omni-turbo

qwen-plus

ApiKey

string

No

The API key of the service provider.

sk-1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d

Temperature

number

No

The sampling temperature, which controls the randomness and creativity of the generated text. A higher value increases randomness. Default value: 0.7. Valid values: 0 to 2, excluding 2. This parameter does not take effect for deepseek-r1.

0.7

TopP

number

No

The nucleus sampling threshold, which controls the diversity of output tokens. The model samples from tokens whose cumulative probability exceeds this value. A higher value results in more diverse output tokens. Default value: 0.8. Valid values: greater than 0 and up to 1.

0.8

MaxToken

integer

No

The maximum number of tokens for the output text. Default value: 8192. The maximum value for DeepSeek and Qwen models is 8192.

500

HistoryDepth

integer

No

The number of historical conversation turns provided to the LLM. Default value: 3.

3

Prompt

string

No

The prompt that instructs the model on the role or behavior to adopt.

You are a Chinese voice assistant. Please answer the user's questions concisely

Url

string

No

The endpoint URL for accessing a third-party LLM.

https://xxxxx

Params

object

No

The custom parameters in key-value pairs. [Deprecated] This parameter is deprecated. Use the BizParams parameter instead.

{"verification_code":"xxx"}

BizParams

any

No

The custom parameters.

{"playbook":"default"}

AppId

string

No

The agent application ID. You must specify either Model or AppId. If both are specified, AppId takes precedence.

e****

ToolExecutionConfig

any

No

The tool execution configuration. The key is the tool name, and the value is the execution configuration for the tool, which includes the callback URL, request method, authentication information (type and token), and user-defined parameters.

{"end_call":{"method":"POST","auth":{},"userDefinedParams":{"appId":"example1","channelId":"100001_100000000000000001_10000001_0_0_AbC","taskId":"100000000000000001"},"url":"http://example.com/api/end-call"}}

Tools

array

No

The list of tools. Each element is a function tool definition that includes the type and function details (name, description, and parameters).

any

No

A single tool definition. The type is fixed to function. The function includes the tool name, description, and parameter definitions.

{"function":{"name":"end_call","description":"Tool to end the call"},"type":"function"}

TTSConfig

object

No

The TTS configuration.

Vendor

string

No

The service provider. Example: aliyun for Alibaba Cloud Model Studio.

aliyun

Model

string

No

The name of the model. Example: cosyvoice-v1.

cosyvoice-v1

ApiKey

string

No

The API key of the service provider.

sk-1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d

Voice

string

No

The voice. If you select the Alibaba Cloud cosyvoice-v1 model, the default voice is longxiaoxia. Available voices: longwan, longcheng, longhua, longxiaochun, longxiaoxia, longxiaocheng, longxiaobai, longlaotie, longshu, longshuo, longjing, longmiao, longyue, longyuan, longfei, longjielidou, longtong, longxiang, loongstella, and loongbella.

longxiaoxia

Volume

integer

No

The volume. Valid values: 0 to 100. Default value: 50.

50

Rate

number

No

The speech rate. Valid values: 0.5 to 2.0. Default value: 1.0.

1

Pitch

number

No

The pitch. Valid values: 0.5 to 2.0. Default value: 1.0.

1

FilterBrackets

array

No

Specifies whether to filter out characters within specified brackets from being converted to speech.

integer

No

The type of brackets to filter. Valid values:

  • 1: Chinese parentheses ()

  • 2: English parentheses ()

  • 3: Chinese square brackets 【】

  • 4: English square brackets []

  • 5: English curly braces {}

1

AgentSilenceConfig

object

No

Configures the behavior of the agent when it is in a silent state. The agent enters this state after a user joins a channel but does not interact with the agent, such as when the user does not speak. You can configure the agent to play a voice message reminder or send a webhook notification.

Enable

boolean

No

Specifies whether to enable the agent silence timeout mechanism. When a user joins the channel but does not interact with the agent, the agent enters a silent state. If the silent duration exceeds the specified threshold, the agent periodically reminds the user by voice. The interval between periodic reminders is the same as the specified threshold. Default value: false.

false

AlertTimeout

integer

No

The timeout period for silence reminders, in seconds. This can be triggered multiple times. If the agent remains silent after a silence reminder timeout, it is triggered again upon the next timeout. Valid values: 5 to 600. Default value: 0. A value of 0 indicates that no reminder is sent.

0

Strategy

integer

No

The dialogue strategy for silence reminders. Valid values:

  • 1: Plays the prompt message specified by Content to the user by voice.

  • 2: Sends the prompt message specified by Content and the conversation history to the LLM, and plays the reply generated by the model. Default value: 1.

1

Content

string

No

The content of the silence prompt message.

Hello, how can I help you?

WebhookTriggerTimeout

integer

No

The silence timeout period for triggering the agent silence timeout webhook, in seconds. This can be triggered multiple times. If the agent remains silent after a webhook silence timeout, it is triggered again upon the next timeout. Valid values: 10 to 600. Default value: 0. A value of 0 indicates that the webhook is not triggered.

0

AmbientSoundConfig

object

No

The ambient sound settings.

SoundId

string

No

The ambient sound plan supports built-in and download modes. Currently, only the built-in mode is implemented. If this parameter is not passed or is empty, ambient sound is disabled. Built-in mode: The agent provides the following default ambient sounds: white_noise (white noise) and office (office). Download mode: You can enter a soundId in the console, which must be different from the built-in IDs, and provide a URL. The agent will download and bind the sound internally.

white_noise

Volume

integer

No

The volume of the ambient sound. Default value: 50 (original volume). Valid values: 0 to 100.

50

InterruptConfig

object

No

The interruption settings.

SemanticsInterrupt

boolean

No

Specifies whether to enable semantic interruption. Default value: true.

true

BackChannelConfig

object

No

The backchannel settings.

UserTurnEnd

boolean

No

Specifies whether to enable backchannel words after the user finishes speaking. Default value: false.

false

Version

integer

No

The version number of the backchannel words.

1

EnableVideoUnderstanding

boolean

No

Specifies whether to enable visual understanding. If enabled, the LLM must support multimodal data.

preferVideo

integer

No

After visual understanding is enabled, you can set the video stream that the agent prioritizes for understanding. The agent can understand only one video stream when both the camera stream and the screen sharing stream are pushed simultaneously. Valid values:

  • 1: The agent prioritizes the camera stream.

  • 2: The agent prioritizes the screen sharing stream. Default value: 1.

1

Response elements

Element

Type

Description

Example

object

Schema of Response

RequestId

string

The request ID.

6159ba01-6687-4fb2-a831-f0cd8d188648

Examples

Success response

JSON format

{
  "RequestId": "6159ba01-6687-4fb2-a831-f0cd8d188648"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.