CreateAgentSession
Creates a new agent session and returns the session ID.
Operation description
Request description
-
This operation creates a new agent session.
-
Specify the name of the bound agent by using
Params.Meta.Agent.AgentName. This parameter is required.dataworks_data_agent: DataWorks built-in agent - Data Agent. It provides AI capabilities for the entire data development lifecycle, including data integration, development, O&M, governance, and analysis.
dataworks_chatbi_agent: DataWorks built-in agent - ChatBI. Based on natural language processing and intelligent analysis technologies, it automates the entire analysis process from requirement parsing, data extraction, and automatic code generation to visual report output through conversational interaction.
dataworks_ai_assistant_agent: DataWorks built-in agent - AI Assistant. An enterprise-grade AI assistant for DataWorks built on open-source frameworks such as OpenClaw and Hermes Agent.
-
You can specify the session source by using
Params.Meta.Config.SessionSourceto facilitate subsequent retrieval by source. -
You can pass session tags by using
Params.Meta.Config.SessionTags[].SessionTagCode. -
Set optional initial session configurations by using
Params.Meta.InitialConfigOptions. UseModel,Mode, andReasoningEffortfor the model, authorization mode, and reasoning configuration, respectively. After the session is created, save the session ID from the response to send prompts or subscribe to session events later.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
dataworks:CreateAgentSession |
create |
*All Resource
|
None | None |
Request syntax
POST HTTP/1.1
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| Jsonrpc |
string |
No |
The JSON-RPC version. Fixed to 2.0. |
2.0 |
| Id |
string |
No |
The ID passed by the requester. The value is returned as is. |
4758330557805415712 |
| Params |
object |
No |
The business parameters. |
|
| Meta |
object |
No |
The extended metadata that carries agent binding, session source, and tags. |
|
| Agent |
object |
No |
The agent configuration for the session. Valid values are the results returned by the ListAgents operation. |
|
| AgentName |
string |
No |
The name of the agent bound to the session. This parameter is required. Valid values:
|
dataworks_data_agent |
| Config |
object |
No |
The session parameter settings, such as filter parameter settings based on the session source and session tags. |
|
| SessionSource |
string |
No |
The session source identifier, which facilitates retrieval by source. For example, if an agent is used on both Page A and Page B, and you want to display only sessions created on Page A when you are on Page A, you can filter sessions based on this parameter. The value can be up to 128 characters in length and can contain letters, digits, hyphens (-), and underscores (_). |
openapi_sdk |
| SessionTags |
array<object> |
No |
The list of session tags. You can search and filter sessions based on session tags later. |
|
|
object |
No |
|||
| SessionTagCode |
string |
No |
The session tag. You can filter sessions based on session tags. For example, if you use a fixed RAM user to call an API operation but the calling system has its own account system, and you need to filter the session list based on the account ID, you can pass the account ID of the calling system as this tag. The value can be up to 128 characters in length and can contain letters, digits, hyphens (-), and underscores (_). |
chatbi |
| InitialConfigOptions |
object |
No |
The advanced parameter settings for the agent execution environment. |
|
| Cu |
string |
No |
The compute unit (CU) specifications of the session instance. Only 2, 4, 8, and 12 are supported. If this parameter is omitted, the instance CU is not specified, and reuse in shared mode is not constrained by the CU. If this parameter is specified, shared mode reuses only instances with the same CU. If the CU does not match, a new instance is created. |
4 |
| ExecutionLane |
string |
No |
Execution mode:
|
chat |
| Mode |
string |
No |
The authorization mode for script execution. OpenAPI currently supports only the yolo mode. Valid values:
|
yolo |
| Model |
string |
No |
The model ID. Use the full model identifier supported by the target environment. If this parameter is omitted, the default model is used. If this parameter is passed, the server verifies its availability and applies it before the session is created. |
qwen3.7-max(openai) |
| ProjectId |
string |
No |
The DataWorks workspace ID. It is used to initialize the session project context. If this parameter is omitted, it is processed as having no project. The project context can be corrected or switched later by the project context of PromptAgentSession. |
12345 |
| ReasoningEffort |
string |
No |
The reasoning configuration. The value must be supported by the target model. A value of none disables reasoning, and default uses the model's default configuration. If an unsupported value is used or the configuration fails to apply, session creation fails. If this parameter is omitted, the existing reasoning configuration is not modified. A successful configuration updates the default value of the daemon workspace, which affects not only the current request. |
none |
| ResourceGroupId |
string |
No |
The ID of the resource group used for initialization. |
Serverless_res_group_123123123_564657857 |
| Skills |
string |
No |
The names of the loaded custom skills. Separate multiple names with commas (,). |
skill-name-1,skill-name2,skill-name-3 |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
Response parameters (result) |
||
| JsonRpcResponse |
object |
The JSON-RPC response result. |
|
| Error |
object |
The JSON-RPC error message. This field is not returned when the request is successful. |
|
| Code |
integer |
The JSON-RPC error code. |
500 |
| Data |
any |
The optional additional error information. The content depends on the error type. |
{} |
| ErrorCode |
string |
The business error code. |
0x4883300000000019 |
| Message |
string |
The error message. |
To create a DataAgent instance, you must specify a resource group. Pass the resource group ID in _meta.dataAgent.resourceGroupId of the request |
| Id |
string |
The ID passed by the requester. The value is returned as is. |
1 |
| Jsonrpc |
string |
The JSON-RPC version. Fixed to 2.0. |
2.0 |
| Result |
object |
The business data. The value is null when an error occurs. |
|
| SessionId |
string |
The ID of the newly created session. |
sess_0f12abc34 |
| Timestamp |
integer |
The response time. It is a UNIX timestamp in milliseconds. |
1789549200000 |
| RequestId |
string |
The request ID for this OpenAPI call. You can use it to troubleshoot issues with the call. |
8A9D5E6C-5817-5837-9715-6E3967EC6123 |
Examples
Success response
JSON format
{
"JsonRpcResponse": {
"Error": {
"Code": 500,
"Data": "{}",
"ErrorCode": "0x4883300000000019",
"Message": "To create a DataAgent instance, you must specify a resource group. Pass the resource group ID in _meta.dataAgent.resourceGroupId of the request"
},
"Id": "1",
"Jsonrpc": "2.0",
"Result": {
"SessionId": "sess_0f12abc34"
},
"Timestamp": 1789549200000
},
"RequestId": "8A9D5E6C-5817-5837-9715-6E3967EC6123"
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.