CreateDataAgent
Creates a DataAgent and binds a RAM role for accessing resources in your account and the context models to be associated.
Operation description
A DataAgent is an agent resource in Simple Log Service. It accesses data in your account by assuming the specified RAM role (roleArn) and uses the associated context models to understand your business metrics. It is used to answer natural language questions, perform analysis, and generate outputs.
Before you call this operation, make sure that:
The RAM role specified by roleArn is authorized to be assumed by Simple Log Service. If you call this operation as a RAM user or by assuming a role, the caller must also have the ram:PassRole permission for the role.
The context models to be associated have been created in the same account.
When you create a DataAgent in an account for the first time, Simple Log Service automatically creates the service-linked role AliyunServiceRoleForSLSSemantic for the account and activates the DataAgent service. No additional operations are required. If the caller lacks the permission to create the service-linked role, the operation returns a 401 error. In this case, the Alibaba Cloud account must grant the ram:CreateServiceLinkedRole permission before you retry.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
log:CreateDataAgent |
create |
*DataAgent
|
None | None |
Request syntax
POST /dataagents HTTP/1.1
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| body |
object |
No |
The request body. The configurations required to create a DataAgent. |
|
| description |
string |
No |
The description of the DataAgent. It is used to describe its scope of responsibilities and applicable scenarios. It is only for display and search purposes and does not affect runtime behavior. The keyword parameter in the list operation performs fuzzy matching with this description. |
Responsible for analyzing order and revenue-related logs and outputting daily summary reports |
| displayName |
string |
No |
The display name. A short title for UI display. It can contain Chinese characters, spaces, and punctuation marks, with a maximum length of 256 characters (calculated by character count, not byte count). If this parameter is not passed or an empty string is passed, it indicates that it is not set. In this case, the operation returns an empty string |
Order Analysis Assistant |
| name |
string |
Yes |
The name of the DataAgent. It must be unique within the same account. It can contain only uppercase and lowercase letters, digits, underscores (_), and hyphens (-), and must be 4 to 128 characters in length. It cannot be modified after creation. Subsequent queries, updates, and deletions of the DataAgent and its sessions use this name to locate the resource. |
order-analysis-agent |
| roleArn |
string |
Yes |
The ARN of the RAM role that the DataAgent assumes to access resources in your account. The format is acs:ram:: |
acs:ram::123456789012****:role/sls-dataagent-role |
| contextModels |
array |
Yes |
The list of context model names associated with the DataAgent. Context models provide business semantics (data sources, metrics, dimensions, and terms) for the DataAgent. After association, the DataAgent can locate your log data when answering questions. |
|
|
string |
No |
The name of a single context model. It must be a context model that has been created in the current account. |
order-context |
|
| systemPrompt |
string |
No |
The system prompt of the DataAgent. It is used to set its role positioning, capability boundaries, and response style. |
You are a data analytics assistant in the order domain. Only answer questions related to orders and revenue. If you are unsure, explain the reason instead of guessing |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response body. Returns the configurations of the created DataAgent. The fields are the same as those in the request body. |
||
| description |
string |
The description of the DataAgent. An empty string is returned if it is not set. |
Responsible for analyzing order and revenue-related logs and outputting daily summary reports |
| displayName |
string |
The display name. An empty string |
Order Analysis Assistant |
| userId |
string |
The ID of the Alibaba Cloud account to which the DataAgent belongs. |
123456789012**** |
| createdAt |
string |
The creation time. The time is in ISO 8601 format in the UTC time zone and accurate to seconds. |
2026-08-14T10:00:03Z |
| contextModels |
array |
The list of context model names associated with the DataAgent. |
|
|
string |
The name of a single context model. |
order-context |
|
| updatedAt |
string |
The time of the last update. The format is the same as that of createdAt. |
2026-08-15T09:20:31Z |
| systemPrompt |
string |
The system prompt of the DataAgent. An empty string is returned if it is not set. |
You are a data analytics assistant in the order domain. Only answer questions related to orders and revenue. If you are unsure, explain the reason instead of guessing |
| roleArn |
string |
The ARN of the RAM role assumed by the DataAgent. |
acs:ram::123456789012****:role/sls-dataagent-role |
| name |
string |
The name of the DataAgent. |
order-analysis-agent |
Examples
Success response
JSON format
{
"description": "Analyzes order and revenue-related logs and generates daily summary reports",
"displayName": "Order Analysis Assistant",
"userId": "123456789012****",
"createdAt": "2026-08-14T10:00:03Z",
"contextModels": [
"order-context"
],
"updatedAt": "2026-08-15T09:20:31Z",
"systemPrompt": "You are a data analytics assistant for the order domain. Only answer questions related to orders and revenue. If you are unsure, explain the reason instead of guessing",
"roleArn": "acs:ram::123456789012****:role/sls-dataagent-role",
"name": "order-analysis-agent"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 403 | ExceedQuota | The number of DataAgents has reached the upper limit for this account. Delete unused DataAgents or contact the administrator to raise the quota. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.