GenerateAIAgentCall

更新时间:
复制 MD 格式

Creates an agent instance and returns the channel, username, and token to join the channel.

Operation description

This API creates an agent instance using the specified AI agent ID (AIAgentId). You can use the information in the response to join the corresponding channel and start a session with the agent.

Important Ensure that the specified AI agent ID is valid and configure optional parameters as needed.

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

ice:GenerateAIAgentCall

none

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

AIAgentId

string

Yes

The AI agent ID.

39f8e0bc005e4f309379701645f4****

Expire

integer

No

Optional. The expiration time of the token in seconds. Default value: 3600. Value range: 0 to 604800.

3600

UserId

string

No

The username in the channel. If you do not specify a username, one is automatically generated. The username can be up to 64 characters in length.

877ae632caae49b1afc81c2e8194ffb4

TemplateConfig deprecated AIAgentTemplateConfig

No

  • This configuration merges with the agent template configuration in the console.

  • If you omit this parameter, the agent uses the default configuration from the console.

Note

The agent template configuration. This parameter is deprecated. Use the AgentConfig parameter instead.

UserData

string

No

User data.

{"Email":"johndoe@example.com","Preferences":{"Language":"en"}}

SessionId

string

No

A unique identifier for the session. If not provided, a new session is created.

fw1gr0bc005e4f309379701645f4****

AgentConfig AIAgentConfig

No

The agent template configuration. The configuration you provide merges with the agent template configuration in the console. If you omit this parameter, the agent uses the default configuration from the console.

Note

Compatibility with TemplateConfig: Fields in AgentConfig take precedence. If a field is specified in TemplateConfig but not in AgentConfig, the system uses the value from TemplateConfig. We recommend using AgentConfig instead of TemplateConfig.

ChatSyncConfig

object

No

The chat synchronization configuration.

IMAIAgentId

string

No

The ID of the Instant Messaging (IM) agent.

******005e4f309379701645f4****

ReceiverId

string

No

The user ID of the recipient.

4167626d312034b2b1c3b7f2f3e41884

Response elements

Element

Type

Description

Example

object

Response schema

AIAgentUserId

string

The name of the agent in the Alibaba Real-time Communication (ARTC) channel.

877ae632caae49b1afc81c2e8194ffb4

ChannelId

string

The ID of the ARTC channel.

70f22d5784194938a7e387052f2b3208

InstanceId

string

The ID of the generated agent instance.

39f8e0bc005e4f309379701645f4****

RequestId

string

The request ID.

7B117AF5-2A16-412C-B127-FA6175ED1AD0

Token

string

The client-side ARTC token.

eyJhcHBpZCI6ICIxMjM0MTIzNxxxxx

UserId

string

The username in the ARTC channel.

user123

AvatarUserId

string

The user ID of the avatar in the channel.

avatar_39f8e0bc005e4f309379701645f4****

Examples

Success response

JSON format

{
  "AIAgentUserId": "877ae632caae49b1afc81c2e8194ffb4",
  "ChannelId": "70f22d5784194938a7e387052f2b3208",
  "InstanceId": "39f8e0bc005e4f309379701645f4****",
  "RequestId": "7B117AF5-2A16-412C-B127-FA6175ED1AD0",
  "Token": "eyJhcHBpZCI6ICIxMjM0MTIzNxxxxx",
  "UserId": "user123",
  "AvatarUserId": "avatar_39f8e0bc005e4f309379701645f4****"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.