Streaming polishing skill draft

Submit a skill draft and receive polishing events sent by the server. The resulting event contains saveable skill content.

HTTP
POST $CLOUDSIGMA_API_BASE/workspaces/{workspace_id}/skills/polish/stream

Before you call

Configure the CloudSigma regional endpoint and authentication before calling. The endpoint, credentials, workspace, and resource IDs must belong to the same region. Prepare personal access token, workspace ID and skills draft to be polished. The response type is text/event-stream.

Request body

Shell
curl -N -X POST "$CLOUDSIGMA_API_BASE/workspaces/$WORKSPACE_ID/skills/polish/stream" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "摘要",
    "description": "生成内容摘要",
    "instruction": "总结输入内容"
  }'

Parameter

Type

Required

Description

name

string

Yes

Skill name.

instruction

string

Yes

Skill instructions to be polished.

description

string

Yes

Skill Description.

instruction_spec

object

No

Structured skill instruction.

instruction_spec.body

string

No

This field is ignored by the current interface. Please fill in instruction for the text to be polished.

instruction_spec.variables_schema

object

No

JSON Schema of directive variables.

input_requirements

string

No

Enter the requirements.

output_format

string

No

Output format.

category

string

No

Skill classification.

tags

array of string

No

Skill tag.

phase

string

No

Skill stage.

pipeline

array of string

No

Pipeline steps.

pipeline_ref

string

No

Pipeline reference.

source_type

string

No

Skill source type.

source_ref

string

No

Skill source reference.

routing_summary

object

No

Route summary.

requirements

object

No

Skill dependent requirements.

parameters_schema

object

No

JSON Schema of the input parameters.

output_contract

object

No

Output format convention.

labels

object

No

String label.

annotations

object

No

String annotation.

metadata

object

No

Extended metadata.

Successful response

Text
event: started
data: {"request_id":"req_01","prompt_version":"skill_polish_v1"}

event: delta
data: {"request_id":"req_01","content":"请总结输入内容"}

event: ping
data: {"request_id":"req_01","timestamp":"2026-08-21T07:00:00Z"}

event: result
data: {"request_id":"req_01","result":{"name":"摘要","description":"摘要技能","instruction":"请总结输入内容","instruction_spec":{"body":"请总结输入内容"},"routing_summary":{},"requirements":{},"tags":[]}}

event: error
data: {"request_id":"req_01","error":{"code":"INVALID_DRAFT","message":"The skill draft is invalid.","retryable":false}}

event: done
data: {"request_id":"req_01"}

Returns the event stream on success. Each event consists of the event: line, the data: line of a single line of JSON, and a blank line. The result event contains the verified skill draft, and done indicates the end of the flow.

Common fields

Field

Type

Description

SSE 事件名

string

The event type in the event: row can be started, delta, ping, result, error or done.

request_id

string

ID of this polish request.

start event

Field

Type

Description

prompt_version

string

The prompt word version in the started event.

Increment and heartbeat

Field

Type

Description

content

string

Incremental text in the delta event.

timestamp

string

RFC 3339 time in ping event.

Generate results

Field

Type

Description

result

object

Verified skill draft in event result.

result.name

string

Skill name.

result.description

string

Skill Description.

result.instruction

string

Polished skill instructions.

result.instruction_spec

object

Structured skill instructions, the text is the same as instruction.

result.input_requirements

string

Enter the requirements. Does not return if not set.

result.output_format

string

Output format. Does not return if not set.

result.category

string

Skill classification. Does not return if not set.

result.tags

array of string

Skill tag.

result.phase

string

Skill stage. Does not return if not set.

result.pipeline

array of string

Pipeline steps. Does not return if not set.

result.pipeline_ref

string

Pipeline reference. Does not return if not set.

result.source_type

string

Skill source type. Does not return if not set.

result.source_ref

string

Skill source reference. Does not return if not set.

result.routing_summary

object

Route summary object, which can be an empty object.

result.requirements

object

Skill dependent object, which can be an empty object.

result.parameters_schema

object

JSON Schema of the input parameters. Does not return if not set.

result.output_contract

object

Output format convention. Does not return if not set.

result.labels

object

String label. Does not return if not set.

result.annotations

object

String annotation. Does not return if not set.

result.metadata

object

Extended metadata. Does not return if not set.

result.pending_confirmations

array of string

Things still to be confirmed. Do not return if not.

result.warnings

array of string

Polishing warning. Do not return if not.

error event

Field

Type

Description

error

object

Public error message in event error.

error.code

string

In-stream error code.

error.message

string

In-stream error description.

error.retryable

boolean

Is it possible to try again.

Error response

Before establishing the event stream, permission denial returns HTTP 403, code=5. Unable to establish event stream or unknown internal error returned HTTP 500, code=13. After the event stream is established, the error and end events in the stream should be read, and success cannot be determined based on HTTP 200 alone.

Text
event: error
data: {"request_id":"req_01","error":{"code":"INVALID_DRAFT","message":"The skill draft is invalid.","retryable":false}}

event: done
data: {"request_id":"req_01"}
JSON
{
  "code": 2,
  "message": "invalid argument"
}

After the stream has started, a processing error is returned via the SSE error event, followed by done:

Request errors before the stream is established with a plain JSON response:

Common fields

HTTP status code

error code

Description

400

2

Common reasons: The JSON is invalid, or the skill draft fails the verification before establishing the event stream. Recommended Action: Check the request body and required fields.

503

15

Common reasons: The skill polish service is not configured. Recommended Action: Try again later.

Last updated on