Execute skills¶
Submit a skill run request. The successful response is 202 Accepted, which only means that the request has been accepted, but does not mean that the skill has been executed.
POST https://moi.matrixorigin.cn/newmoi/workspaces/{workspace_id}/skills/{skill_id}/execute
Before you call¶
First query skill details] to confirm that the skill is active. Prepare the personal access token, target workspace ID, and skill ID that have access to the target workspace.
The example below uses:
$AI_STUDIO_API_KEY: The actual personal access token, passed through theX-API-KeyHeader.$WORKSPACE_ID: Execution workspace ID, passed throughX-Workspace-IDHeader.$SKILL_ID: ID of the skill to be performed.
Provide at least one of message, parts, variables, or resource_refs. Only skills in the active state can be executed. Execution also requires valid authenticated roles and runtime access authorization.
Request example¶
curl -X POST "https://moi.matrixorigin.cn/newmoi/workspaces/$WORKSPACE_ID/skills/$SKILL_ID/execute" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d '{
"message": "请总结这段内容。",
"idempotency_key": "<IDEMPOTENCY_KEY>"
}'
Path parameters¶
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
Yes |
Execution workspace ID. |
|
string |
Yes |
The skill ID to execute. |
Query parameters¶
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
No |
The workspace to which the skill belongs; can only be the current workspace or |
Request body¶
Field |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
No |
Optional execution agent ID. When specified, the agent must be active and have the current skill bound. |
|
string |
No |
Context ID and text input. |
|
string |
No |
Context ID and text input. |
|
array |
No |
Structured input fragment. |
|
object |
No |
Skill variables and parameters. |
|
object |
No |
Skill variables and parameters. |
|
array |
No |
Resource reference. Each must contain |
|
string |
No |
Idempotent key. |
|
object |
No |
Extended metadata. Variables, parameters, input fragments, and metadata cannot contain keys or run session references. |
Successful response¶
Returns 202 on success. Use runtime_task_id or runtime_task_url to track subsequent run status and results (field only appears when runtime returns).
{
"code": 0,
"data": {
"id": "exec_01",
"workspace_id": "ws_01",
"skill_id": "skill_01",
"skill_version": 2,
"runtime_task_id": "task_01",
"runtime_task_url": "/runtime/tasks/task_01",
"status": "accepted",
"accepted_at": "2026-01-02T15:04:05Z"
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
integer |
|
|
string |
Execution record ID, execution workspace, and skill ID. |
|
string |
Execution record ID, execution workspace, and skill ID. |
|
string |
Execution record ID, execution workspace, and skill ID. |
|
integer |
The skill version used in this submission. |
|
string |
The associated agent and context; not returned if not provided. |
|
string |
The associated agent and context; not returned if not provided. |
|
string |
Runtime task ID and query address; returned when available. |
|
string |
Runtime task ID and query address; returned when available. |
|
string |
The current acceptance status, does not mean that the operation has been completed. |
|
object |
Metadata returned at runtime; returned when available. |
|
string |
Request processing time, using RFC 3339 format. |
Error response¶
{
"code": 2,
"message": "<错误信息>"
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
The input is empty, the resource reference is invalid, the skill is not activated, or the specified agent does not have the skill bound to it. |
Complete inputs, use active skills, and check resource and agent bindings. |
|
|
Lack of valid identity credentials. |
Check API Key. |
|
|
Valid role or runtime access is not authorized. |
Check workspace roles and runtime usage permissions. |
|
|
This skill does not exist in the current or rollback system directories. |
Check skill ID and |
|
|
Skill execution submitter, runtime access or authorization dependencies are not currently available. |
Try again later. |
Follow-up operations¶
After the call is completed, if you need to check the configuration, Query skill details.