RunDeepWriting

Updated at:

Queries deep writing events. The system returns detailed information about the task execution as a stream of Server-Sent Events (SSE).

Try it now

You can run this API directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After the call succeeds, OpenAPI Explorer can automatically generate SDK code examples.

Try it now

Authorization information

The following table describes the authorization information of the API. You can use it in the Action element of a RAM permission policy statement to grant RAM users or RAM roles the permission to call this API. For more information, see the following:

  • Action: the specific permission point.

  • Access level: the access level of each operation. Valid values: Write, Read, or List.

  • Resource type: the resource types that support authorization in the operation. For more information, see the following:

    • Required resource types are marked with a leading *.
    • For operations that do not support resource-level authorization, All resources is used.
  • Condition key: the condition keys defined by the cloud service itself.

  • Dependent action: the other permissions required to successfully perform the operation. The caller must have the permissions of the dependent actions at the same time for the operation to succeed.

ActionAccess levelResource typeCondition keyDependent action
aimiaobi:RunDeepWritingcreate
*All resources
*
    None
None

Request syntax

POST /pop/deepWrite/runDeepWriting HTTP/1.1

Request parameters

NameTypeRequiredDescriptionExample value
WorkspaceIdstringYes

The unique identifier of the Alibaba Cloud Model Studio workspace: Workspace ID

llm-ir8zkqry2fncaxwq
TaskIdstringNo

The task ID.

95c2fbe6-5a20-4fc2-8a93-376ed05fbe13
CursorintegerNo

The cursor, which is the ordinal number of the streaming event.

10

Response elements

NameTypeDescriptionExample value
object

Schema of Response

Headerobject

The response header.

ErrorCodestring

The error code.

403
ErrorMessagestring

The error message.

Error message
Eventstring

The Server-Sent Event (SSE).

Valid values:
  • response.sub_task.created: The subtask is created.
  • response.output_item.done: The intermediate result output is complete.
  • response.completed: The task is complete.
  • response.created: The task is created.
response.output_item.done
SessionIdstring

The session ID.

c2e2e991-f96a-4fcc-9ff7-d0df46c6d232
StatusCodeinteger

The HTTP response code.

200
TaskIdstring

The task ID.

b84d31a5-44b2-4a35-9c6d-878d459c93d0
TraceIdstring

The trace ID.

FAB10D42-F081-557B-8DCB-D6FB7AAF100B
Payloadobject

The response body.

Outputobject

The output.

Typestring

The type.

Same as the parent Event
SequenceNumberstring

The ordinal number of the streaming event.

1
OutputIndexinteger

The ordinal number of the new output item in this event.

1
Responseobject

The response body.

Idstring

The unique ID of the task.

b2dc224b38694e0b668020159a7c5732
Statusstring

The execution status of the task.

Valid values:
  • in_progress: The task is in progress.
  • completed: The task is complete.
in_progress
Itemobject

The new output item for this event.

Idstring

The unique ID of the item.

88f6ed9e85c4f9377378da23e6a370d1
Statusstring

The status of the item.

Valid values:
  • in_progress: In progress.
  • completed: Completed.
completed
Typestring

The type of the item.

Valid values:
  • function_call: A function call.
  • message: A message.
function_call
Argumentsstring

The parameters.

This field has a value when the item type is function_call. It is the input parameter of the function being called.
Namestring

The parameter name.

This field has a value when the item type is function_call. It is the name of the function being called.
Resultstring

The result of the item.

This field has a value when the item type is function_call. It is the output of the function being called.
Agentstring

The name of the agent that outputs this item.

ProjectManager
Contentarray<object>

This field has a value when the item type is message. It is a list of output content.

contentobject

The text content.

Typestring

When the item type is message, the value of this field is output_text.

output_text
Textstring

The text content that is output when the item type is message.

<TASK_DONE>
RequestIdstring

The unique request ID.

31AC01F1-88FB-5C4D-B6F5-E8BB136CD5A3
HttpStatusCodestring

The HTTP response code.

200
Codestring

The status code.

successful
Messagestring

The error message.

success
Successboolean

Indicates whether the request was successful.

true

Examples

Success response

JSON format

{
  "Header": {
    "ErrorCode": 403,
    "ErrorMessage": "错误消息",
    "Event": "response.output_item.done",
    "SessionId": "c2e2e991-f96a-4fcc-9ff7-d0df46c6d232",
    "StatusCode": 200,
    "TaskId": "b84d31a5-44b2-4a35-9c6d-878d459c93d0",
    "TraceId": "FAB10D42-F081-557B-8DCB-D6FB7AAF100B"
  },
  "Payload": {
    "Output": {
      "Type": "同上级Event",
      "SequenceNumber": 1,
      "OutputIndex": 1,
      "Response": {
        "Id": "b2dc224b38694e0b668020159a7c5732",
        "Status": "in_progress"
      },
      "Item": {
        "Id": "88f6ed9e85c4f9377378da23e6a370d1",
        "Status": "completed",
        "Type": "function_call",
        "Arguments": "item类型为function_call时,此字段有值,为调用函数的入参",
        "Name": "item类型为function_call时,此字段有值,为调用的函数名字",
        "Result": "item类型为function_call时,此字段有值,为调用的函数的输出",
        "Agent": "ProjectManager",
        "Content": [
          {
            "Type": "output_text",
            "Text": "<TASK_DONE>"
          }
        ]
      }
    }
  },
  "RequestId": "31AC01F1-88FB-5C4D-B6F5-E8BB136CD5A3",
  "HttpStatusCode": 200,
  "Code": "successful",
  "Message": "success",
  "Success": true
}

Error codes

HTTP status codeError codeError messageDescription
403NoPermissionYou are not authorized to perform this action.Please check the workspaceId assignment

For more error codes, visit Error Center.