> ## Documentation Index
> Fetch the complete documentation index at: https://docs.linxueyuan.online/llms.txt
> Use this file to discover all available pages before exploring further.

# Resume Task

> Resume a task by ID.



## OpenAPI

````yaml https://app.stainless.com/api/spec/documented/agentlin/openapi.documented.yml post /tasks/{task_id}/resume
openapi: 3.1.0
info:
  title: Agentlin API
  description: >-
    The Agentlin REST API. Please see https://linxueyuan.online/agentlin/ for
    more details.
  version: 2.3.0
  termsOfService: https://linxueyuan.online/policies/terms-of-use
  contact:
    name: Agentlin Support
    url: https://help.linxueyuan.online/
  license:
    name: MIT
    url: https://github.com/LinXueyuanStdio/agentlin/blob/master/LICENSE
servers:
  - url: https://api.linxueyuan.online/v1
security:
  - ApiKeyAuth: []
tags:
  - name: Tasks
    description: Create, retrieve, and cancel agent tasks.
  - name: Environment
    description: Interact with remote environments.
paths:
  /tasks/{task_id}/resume:
    post:
      tags:
        - Tasks
      summary: Resume Task
      description: Resume a task by ID.
      operationId: resume_task_v1_tasks__task_id__resume_post
      parameters:
        - name: task_id
          in: path
          required: true
          schema:
            type: string
            description: The ID of the task to resume
            title: Task Id
          description: The ID of the task to resume
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskObject'
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JSONRPCError'
          description: Not Found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import Client from 'agentlin_client';

            const client = new Client({
              apiKey: process.env['AGENTLIN_API_KEY'], // This is the default and can be omitted
            });

            const taskObject = await client.tasks.resume('task_id');

            console.log(taskObject.id);
        - lang: Python
          source: |-
            import os
            from agentlin_client import Client

            client = Client(
                api_key=os.environ.get("AGENTLIN_API_KEY"),  # This is the default and can be omitted
            )
            task_object = client.tasks.resume(
                "task_id",
            )
            print(task_object.id)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/LinXueyuanStdio/agentlin-client-go\"\n\t\"github.com/LinXueyuanStdio/agentlin-client-go/option\"\n)\n\nfunc main() {\n\tclient := agentlin.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\ttaskObject, err := client.Tasks.Resume(context.TODO(), \"task_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", taskObject.ID)\n}\n"
components:
  schemas:
    TaskObject:
      type: object
      description: The task object returned in JSON-RPC result.
      x-oaiMeta:
        name: TaskObject
        group: tasks
        notes: 代表一次完整任务的聚合结果与元信息。
        example: |
          {
            "object": "task",
            "id": "task_abc",
            "session_id": "sess_1",
            "user_id": "u_1",
            "status": "completed",
            "created_at": 1720000000,
            "output": [
              {"type":"message","role":"assistant","content":"hello"}
            ],
            "usage": {"input_tokens": 100, "output_tokens": 0, "total_tokens": 100},
            "metadata": {}
          }
      properties:
        object:
          type: string
          enum:
            - task
          description: 固定为 task。
        id:
          type: string
          description: 任务 ID。
        session_id:
          type: string
          description: 会话 ID。
        user_id:
          type: string
          description: 用户 ID。
        status:
          $ref: '#/components/schemas/TaskStatus'
          description: 任务状态。
        created_at:
          type: integer
          description: 任务创建时间（Unix 秒）。
        output:
          type: array
          description: 模型/代理生成的输出条目集合（多类型）。
          items:
            $ref: '#/components/schemas/OutputItem'
        usage:
          type: object
          additionalProperties: true
          description: token 用量统计信息。
        error:
          $ref: '#/components/schemas/JSONRPCError'
          description: 错误信息（失败时）。
        input_required:
          $ref: '#/components/schemas/ToolCallItem'
          description: 若任务等待外部输入，则给出需要执行的工具调用（如等待用户参数）。
        metadata:
          type: object
          additionalProperties: true
          description: 扩展元数据。
        previous_task_id:
          type: string
          description: 前置任务 ID（用于续写/衔接）。
        rollouts:
          type: array
          items:
            type: object
            additionalProperties: true
          description: 任务推演/回溯事件集合（可选）。
      required:
        - object
        - id
        - session_id
        - user_id
        - status
        - created_at
        - output
    JSONRPCError:
      type: object
      description: JSON-RPC error object.
      x-oaiMeta:
        name: JSON-RPC Error
        group: tasks
        example: |
          {
            "code": -32602,
            "message": "Invalid params: missing 'task_id'",
            "data": { "param": "task_id", "expected": "string" }
          }
      properties:
        code:
          type: integer
          description: 错误码（遵循 JSON-RPC 约定或服务端自定义）。
        message:
          type: string
          description: 错误信息。
        data:
          description: 自定义错误数据，任意 JSON 值或 null。
          anyOf:
            - type: object
            - type: array
            - type: string
            - type: number
            - type: integer
            - type: boolean
            - type: 'null'
      required:
        - code
        - message
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    TaskStatus:
      type: string
      description: |
        任务生命周期状态。
        CREATED：任务已创建但尚未开始。
        QUEUED：任务已排队，等待处理。
        WORKING：任务正在处理中。
        INPUT_REQUIRED：任务需要额外输入以继续。
        PAUSED：任务已暂停，需恢复后继续。
        COMPLETED：任务已成功完成。
        CANCELED：任务已取消，不会继续处理。
        EXPIRED：任务已过期，不会继续处理。
        FAILED：任务处理失败，不会重试。

        常见情况：
            1. CREATED -> WORKING -> COMPLETED|FAILED|CANCELED|EXPIRED
            2. CREATED -> WORKING -> INPUT_REQUIRED -> WORKING -> COMPLETED|FAILED|CANCELED|EXPIRED
            3. CREATED -> WORKING -> PAUSED -> WORKING -> COMPLETED|FAILED|CANCELED|EXPIRED
            4. CREATED -> QUEUED -> WORKING -> COMPLETED|FAILED|CANCELED|EXPIRED
            5. CREATED -> QUEUED -> WORKING -> INPUT_REQUIRED -> WORKING -> COMPLETED|FAILED|CANCELED|EXPIRED
            6. CREATED -> QUEUED -> WORKING -> PAUSED -> WORKING -> COMPLETED|FAILED|CANCELED|EXPIRED

        取消情况：
            1. CREATED -> CANCELED
            2. CREATED -> WORKING -> CANCELED
            3. CREATED -> QUEUED -> CANCELED
            4. CREATED -> QUEUED -> WORKING -> CANCELED
            5. CREATED -> QUEUED -> WORKING -> PAUSED -> CANCELED
            6. CREATED -> QUEUED -> WORKING -> INPUT_REQUIRED -> CANCELED

        过期情况：
            1. CREATED -> WORKING -> EXPIRED
            2. CREATED -> WORKING -> INPUT_REQUIRED -> EXPIRED
            3. CREATED -> WORKING -> PAUSED -> EXPIRED
            4. CREATED -> QUEUED -> EXPIRED
            5. CREATED -> QUEUED -> WORKING -> EXPIRED
            6. CREATED -> QUEUED -> WORKING -> INPUT_REQUIRED -> EXPIRED
            7. CREATED -> QUEUED -> WORKING -> PAUSED -> EXPIRED
      enum:
        - created
        - queued
        - working
        - input-required
        - paused
        - completed
        - canceled
        - expired
        - failed
    OutputItem:
      title: OutputItem
      description: An output item produced by the agent/model.
      type: object
      discriminator:
        propertyName: type
      oneOf:
        - $ref: '#/components/schemas/ReasoningItem'
        - $ref: '#/components/schemas/MessageItem'
        - $ref: '#/components/schemas/ToolCallItem'
        - $ref: '#/components/schemas/ToolResultItem'
    ToolCallItem:
      type: object
      properties:
        type:
          type: string
          enum:
            - tool_call
          description: 工具调用条目类型标识。
        id:
          type: string
          description: 工具调用条目 ID。
        status:
          type: string
          enum:
            - in_progress
            - completed
            - incomplete
          description: 调用状态。
        call_id:
          type: string
          description: 工具调用唯一 ID（跨事件关联）。
        name:
          type: string
          description: 工具名称。
        arguments:
          type: string
          description: 工具调用参数（JSON 字符串）。
        language:
          type: string
          enum:
            - json
            - yaml
            - python
            - javascript
          description: 参数语言标注（可选）。
      required:
        - type
        - call_id
        - name
        - arguments
      x-oaiMeta:
        name: Tool call item
        group: tasks
        example: |
          {
            "type": "tool_call",
            "id": "tc_1",
            "status": "in_progress",
            "call_id": "call_1",
            "name": "get_weather",
            "arguments": "{\"city\":\"San Francisco\"}",
            "language": "json"
          }
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    ReasoningItem:
      type: object
      properties:
        type:
          type: string
          enum:
            - reasoning
          description: 推理项类型标识。
        id:
          type: string
          description: 推理项 ID。
        summary:
          type: array
          items:
            $ref: '#/components/schemas/TextContentItem'
          description: 推理摘要内容（结构化）。
        content:
          type: array
          items:
            $ref: '#/components/schemas/TextContentItem'
          description: 推理详细内容（可选）。
        status:
          type: string
          enum:
            - in_progress
            - completed
            - incomplete
          description: 状态。
      required:
        - type
        - id
        - summary
      x-oaiMeta:
        name: Reasoning item
        group: tasks
        example: |
          {
            "type": "reasoning",
            "id": "rs_123",
            "summary": [
              {"type": "summary_text", "text": "对推理过程的简短概述"}
            ],
            "content": [
              {"type": "reasoning_text", "text": "分步推理内容……"}
            ],
            "status": "in_progress"
          }
    MessageItem:
      type: object
      properties:
        type:
          type: string
          enum:
            - message
          description: 消息条目类型标识。
        id:
          type: string
          description: 消息 ID。
        status:
          type: string
          enum:
            - in_progress
            - completed
            - incomplete
          description: 消息生成状态。
        role:
          type: string
          enum:
            - user
            - assistant
            - system
            - developer
          description: 消息角色。
        name:
          type: string
          description: 角色名称（可选）。
        message_content:
          $ref: '#/components/schemas/MessageContent'
          description: 消息内容，字符串或内容项数组，工具协议兼容的 message_content（保留字段）。
        block_list:
          type: array
          items:
            type: object
          description: 渲染块列表（图表/表格等富媒体）。
          additionalProperties: true
          x-oaiExpandable: false
      required:
        - type
        - role
        - message_content
      x-oaiMeta:
        name: Output message
        group: tasks
        example: |
          {
            "type": "message",
            "id": "msg_123",
            "role": "assistant",
            "status": "completed",
            "message_content": [
              {"type": "output_text", "text": "你好，我可以帮你。"}
            ],
            "block_list": []
          }
    ToolResultItem:
      type: object
      properties:
        type:
          type: string
          enum:
            - tool_result
          description: 工具结果条目类型标识。
        id:
          type: string
          description: 工具结果条目 ID。
        status:
          type: string
          enum:
            - in_progress
            - completed
            - incomplete
          description: 结果状态。
        call_id:
          type: string
          description: 对应的工具调用 ID。
        message_content:
          $ref: '#/components/schemas/MessageContent'
          description: 消息内容，字符串或内容项数组，工具协议兼容的 message_content（保留字段）。
        block_list:
          type: array
          items:
            type: object
          description: 工具结果的渲染块列表。
          additionalProperties: true
          x-oaiExpandable: false
      required:
        - type
        - call_id
        - message_content
        - block_list
      x-oaiMeta:
        name: Tool result item
        group: tasks
        example: |
          {
            "type": "tool_result",
            "id": "tr_1",
            "status": "completed",
            "call_id": "call_1",
            "output": "{\"temp\":18}",
            "message_content": [
              {"type": "output_text", "text": "当前温度 18°C"}
            ],
            "block_list": []
          }
    TextContentItem:
      type: object
      properties:
        type:
          type: string
          enum:
            - text
            - input_text
            - output_text
            - reasoning_text
            - summary_text
            - refusal
          description: 文本内容类型。
        text:
          type: string
          description: 文本内容。
        id:
          type: integer
          description: 可选的内容引用 ID。
        tags:
          type: array
          description: 可选标签，用于标记内容来源或用途（如 "added_by_reference_manager"）。
          items:
            type: string
        annotations:
          type: array
          description: 文本注释（如引用、链接、文件路径等），与后端 Annotation 模型一致。
          items:
            $ref: '#/components/schemas/Annotation'
        logprobs:
          type: array
          description: 每个 token 的对数概率信息（可选）。
          items:
            $ref: '#/components/schemas/LogProb'
      required:
        - type
        - text
      x-oaiMeta:
        name: Text content item
        group: tasks
        example: |
          {"type": "output_text", "text": "这是模型输出的文本。"}
    MessageContent:
      description: 消息内容，字符串或内容项数组，工具协议兼容的 message_content（保留字段）。
      oneOf:
        - type: string
        - $ref: '#/components/schemas/ContentItemList'
    Annotation:
      discriminator:
        propertyName: type
      anyOf:
        - $ref: '#/components/schemas/AnnotationFileCitation'
        - $ref: '#/components/schemas/AnnotationURLCitation'
        - $ref: '#/components/schemas/AnnotationContainerFileCitation'
        - $ref: '#/components/schemas/AnnotationFilePath'
    LogProb:
      properties:
        token:
          type: string
        logprob:
          type: number
        bytes:
          items:
            type: integer
          type: array
        top_logprobs:
          items:
            $ref: '#/components/schemas/TopLogProb'
          type: array
      type: object
      required:
        - token
        - logprob
        - bytes
        - top_logprobs
      title: Log probability
      description: The log probability of a token.
    ContentItemList:
      title: Content Item List
      type: array
      description: 内容项数组。
      items:
        $ref: '#/components/schemas/ContentItem'
    AnnotationFileCitation:
      properties:
        type:
          type: string
          enum:
            - file_citation
          description: The type of the file citation. Always `file_citation`.
          default: file_citation
          x-stainless-const: true
        file_id:
          type: string
          description: The ID of the file.
        index:
          type: integer
          description: The index of the file in the list of files.
        filename:
          type: string
          description: The filename of the file cited.
      type: object
      required:
        - type
        - file_id
        - index
        - filename
      title: File citation
      description: A citation to a file.
    AnnotationURLCitation:
      properties:
        type:
          type: string
          enum:
            - url_citation
          description: The type of the URL citation. Always `url_citation`.
          default: url_citation
          x-stainless-const: true
        url:
          type: string
          description: The URL of the web resource.
        start_index:
          type: integer
          description: The index of the first character of the URL citation in the message.
        end_index:
          type: integer
          description: The index of the last character of the URL citation in the message.
        title:
          type: string
          description: The title of the web resource.
      type: object
      required:
        - type
        - url
        - start_index
        - end_index
        - title
      title: URL citation
      description: A citation for a web resource used to generate a model task.
    AnnotationContainerFileCitation:
      properties:
        type:
          type: string
          enum:
            - container_file_citation
          description: >-
            The type of the container file citation. Always
            `container_file_citation`.
          default: container_file_citation
          x-stainless-const: true
        container_id:
          type: string
          description: The ID of the container file.
        file_id:
          type: string
          description: The ID of the file.
        start_index:
          type: integer
          description: >-
            The index of the first character of the container file citation in
            the message.
        end_index:
          type: integer
          description: >-
            The index of the last character of the container file citation in
            the message.
        filename:
          type: string
          description: The filename of the container file cited.
      type: object
      required:
        - type
        - container_id
        - file_id
        - start_index
        - end_index
        - filename
      title: Container file citation
      description: A citation for a container file used to generate a model task.
    AnnotationFilePath:
      properties:
        type:
          type: string
          enum:
            - file_path
          description: The type of the file citation. Always `file_path`.
          default: file_path
          x-stainless-const: true
        index:
          type: integer
          description: The index of the file in the list of files.
        file_url:
          type: string
          description: The URL of the file cited.
      type: object
      required:
        - type
        - index
        - file_url
      title: File path citation
      description: A citation to a file path.
    TopLogProb:
      properties:
        token:
          type: string
        logprob:
          type: number
        bytes:
          items:
            type: integer
          type: array
      type: object
      required:
        - token
        - logprob
        - bytes
      title: Top log probability
      description: The top log probability of a token.
    ContentItem:
      title: Content Item
      description: A single content item within a message.
      type: object
      oneOf:
        - $ref: '#/components/schemas/TextContentItem'
        - $ref: '#/components/schemas/ImageContentItem'
        - $ref: '#/components/schemas/AudioContentItem'
        - $ref: '#/components/schemas/FileContentItem'
        - type: string
    ImageContentItem:
      type: object
      properties:
        type:
          type: string
          enum:
            - image
            - input_image
            - output_image
            - image_url
          description: 图片内容类型。
        image_url:
          $ref: '#/components/schemas/ImageURL'
          description: 图片 URL 信息。
      required:
        - type
        - image_url
      x-oaiMeta:
        name: Image content item
        group: tasks
        example: >
          {"type": "image_url", "image_url": {"url":
          "https://example.com/cat.png", "detail": "auto"}}
    AudioContentItem:
      type: object
      properties:
        type:
          type: string
          enum:
            - input_audio
            - output_audio
            - audio
          description: 音频内容类型。
        input_audio:
          $ref: '#/components/schemas/InputAudio'
          description: 输入音频内容。
      required:
        - type
        - input_audio
      x-oaiMeta:
        name: Audio content item
        group: tasks
        example: >
          {"type": "input_audio", "input_audio": {"data": "<base64>", "format":
          "mp3"}}
    FileContentItem:
      type: object
      properties:
        type:
          type: string
          enum:
            - file
          description: 文件内容类型。
        file:
          $ref: '#/components/schemas/FileDetail'
          description: 文件详情。
      required:
        - type
        - file
      x-oaiMeta:
        name: File content item
        group: tasks
        example: >
          {"type": "file", "file": {"file_url":
          "https://example.com/report.pdf", "filename": "report.pdf"}}
    ImageURL:
      type: object
      properties:
        url:
          type: string
          format: uri
          description: 图片的可访问 URL。
        detail:
          anyOf:
            - type: string
              enum:
                - low
                - high
                - auto
            - type: 'null'
          description: 清晰度等级，可选 low/high/auto。
      required:
        - url
    InputAudio:
      type: object
      properties:
        data:
          type: string
          description: Base64-encoded audio bytes
        format:
          type: string
          enum:
            - wav
            - mp3
          default: wav
      required:
        - data
        - format
    FileDetail:
      type: object
      properties:
        file_data:
          type: string
          description: Optional Base64-encoded file content
        file_url:
          type: string
          description: 远程文件的可访问 URL；与 file_data 二选一，可同时提供以便存档。
        filename:
          type: string
          description: 文件名（含扩展名），用于渲染与调试追踪。
      required:
        - file_url
        - filename
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer

````