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

> 更新一个 Agent

# Update Agent



## OpenAPI

````yaml post /v1/agent/{agent_id}
openapi: 3.1.0
info:
  title: spectra-server
  description: The API for Spectra Backend.
  version: 0.1.0
servers:
  - url: https://api-spectra.duplik.cn
security: []
paths:
  /v1/agent/{agent_id}:
    post:
      tags:
        - Agent
      summary: Update Agent
      description: Update agent
      operationId: update_agent_v1_agent__agent_id__post
      parameters:
        - name: agent_id
          in: path
          required: true
          schema:
            type: string
            title: Agent Id
        - name: user_id
          in: query
          required: false
          schema:
            type: string
            description: 用户ID
            title: User Id
          description: 用户ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AgentUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentRead'
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Bad Request
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unprocessable Entity
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal Server Error
      security:
        - HTTPBearer: []
components:
  schemas:
    AgentUpdate:
      properties:
        name:
          anyOf:
            - type: string
              maxLength: 256
            - type: 'null'
          title: Name
          description: Name of the Agent
        mode:
          anyOf:
            - type: string
            - type: 'null'
          title: Mode
          description: Working mode of the Agent
        icon:
          anyOf:
            - type: string
              maxLength: 1024
            - type: 'null'
          title: Icon
          description: URL of the Agent's icon
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: Detailed description of the Agent
        category:
          anyOf:
            - type: string
            - type: 'null'
          title: Category
          description: Category of the Agent
        prompt:
          anyOf:
            - type: string
            - type: 'null'
          title: Prompt
          description: System prompt for the Agent
        status:
          anyOf:
            - type: integer
            - type: 'null'
          title: Status
          description: Enable status of the Agent
        publish_status:
          anyOf:
            - type: integer
            - type: 'null'
          title: Publish Status
          description: 'Publication status of the Agent, 0: draft, 1: published'
        orchestration:
          anyOf:
            - $ref: '#/components/schemas/OrchestrationConfig-Input'
            - type: 'null'
          description: Orchestration configuration of the Agent
        llm:
          anyOf:
            - $ref: '#/components/schemas/LLMConfig'
            - type: 'null'
          description: Language model configuration of the Agent
        conversation:
          anyOf:
            - $ref: >-
                #/components/schemas/src__libs__modules__agent__schemas__ConversationConfig
            - type: 'null'
          description: Conversation configuration of the Agent
        created_by:
          anyOf:
            - type: string
            - type: 'null'
          title: Created By
          description: Agent created by
      type: object
      title: AgentUpdate
      example:
        category: sales
        conversation:
          background_color: '#FFFFFF'
          background_image: ''
          copyright: ''
          enabled: true
          greeting_message: ''
          guiding_questions:
            - string
          recommended_related_questions_prompt: ''
          show_answer_source: true
          show_answer_source_data: true
          text_color: '#000000'
        description: You are a helpful assist
        icon: https://example.com/analysis-icon.png
        llm:
          completion_params:
            max_memory: 2048
            max_memory_num: 5
            max_tokens: 2048
            temperature: 0.7
          model_name: qwen2.5-72b-instruct
          model_provider: aliyun
        mode: advanced_single
        name: advanced_single_agent use kb and other tools
        orchestration:
          instruction:
            enabled: true
            rewriting_count: 3
            rewriting_prompt: rewriting prompt
          knowledge_list:
            - folders:
                - folder_id: xxx
                  name: xxx
              knowledge_id: '631506272047205'
          tools:
            - tool_apis:
                - api_id: '631506271514745'
              tool_id: '631506271912031'
            - tool_id: '631506271912032'
              tool_llm:
                llm_id: '631506271514746'
          voice:
            enabled: false
            input_enabled: false
            output_enabled: false
        prompt: You are a helpful assist
        publish_status: 1
        status: 1
    AgentRead:
      properties:
        created_at:
          anyOf:
            - type: integer
            - type: 'null'
          title: Created At
        updated_at:
          anyOf:
            - type: integer
            - type: 'null'
          title: Updated At
        org_id:
          type: string
          title: Org Id
        user_id:
          type: string
          title: User Id
        name:
          anyOf:
            - type: string
              maxLength: 256
            - type: 'null'
          title: Name
          description: Name of the Agent
        mode:
          anyOf:
            - type: string
            - type: 'null'
          title: Mode
          description: Working mode of the Agent
        icon:
          anyOf:
            - type: string
              maxLength: 1024
            - type: 'null'
          title: Icon
          description: URL of the Agent's icon
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: Detailed description of the Agent
        category:
          anyOf:
            - type: string
            - type: 'null'
          title: Category
          description: Category of the Agent
        prompt:
          anyOf:
            - type: string
            - type: 'null'
          title: Prompt
          description: System prompt for the Agent
        status:
          anyOf:
            - type: integer
            - type: 'null'
          title: Status
          description: Enable status of the Agent
        publish_status:
          anyOf:
            - type: integer
            - type: 'null'
          title: Publish Status
          description: 'Publication status of the Agent, 0: draft, 1: published'
        orchestration:
          anyOf:
            - $ref: '#/components/schemas/OrchestrationConfig-Output'
            - type: 'null'
          description: Orchestration configuration of the Agent
        llm:
          anyOf:
            - $ref: '#/components/schemas/LLMConfig'
            - type: 'null'
          description: Language model configuration of the Agent
        conversation:
          anyOf:
            - $ref: >-
                #/components/schemas/src__libs__modules__agent__schemas__ConversationConfig
            - type: 'null'
          description: Conversation configuration of the Agent
        created_by:
          anyOf:
            - type: string
            - type: 'null'
          title: Created By
        agent_id:
          type: string
          title: Agent Id
        permission_types:
          items:
            type: string
          type: array
          title: Permission Types
          default: []
        message_count:
          anyOf:
            - type: integer
            - type: 'null'
          title: Message Count
          default: 0
      type: object
      required:
        - created_at
        - updated_at
        - org_id
        - user_id
        - agent_id
      title: AgentRead
      description: Agent read model
    ErrorResponse:
      properties:
        code:
          type: integer
          title: Code
        message:
          type: string
          title: Message
      type: object
      required:
        - code
        - message
      title: ErrorResponse
    OrchestrationConfig-Input:
      properties:
        instruction:
          anyOf:
            - $ref: '#/components/schemas/InstructionConfig'
            - type: 'null'
          description: Configuration for instruction rewriting feature
        knowledge_tools_mode:
          anyOf:
            - type: string
            - type: 'null'
          title: Knowledge Tools Mode
          description: 'Call Knowledge retrieval tools mode: smart, force_all'
          default: smart
        knowledge_list:
          anyOf:
            - items:
                $ref: '#/components/schemas/AgentUseKnowledge'
              type: array
            - type: 'null'
          title: Knowledge List
          description: List of knowledge base IDs to be used by the agent
        tools:
          anyOf:
            - items:
                $ref: '#/components/schemas/AgentUseTool-Input'
              type: array
            - type: 'null'
          title: Tools
          description: List of tool IDs available to the agent
        voice:
          anyOf:
            - $ref: '#/components/schemas/VoiceConfig'
            - type: 'null'
          description: Voice configuration of the agent
        multi_mode:
          anyOf:
            - type: string
            - type: 'null'
          title: Multi Mode
          description: Multi agent mode
        member_agents:
          anyOf:
            - items:
                type: object
              type: array
            - type: 'null'
          title: Member Agents
          description: List of member agents in multi-agent mode
        recursion_limit:
          anyOf:
            - type: integer
            - type: 'null'
          title: Recursion Limit
          description: >-
            Maximum number of times a call can recurse. If not provided,
            defaults to 25.
          default: 25
        intent_enabled:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Intent Enabled
          description: Intent enable
          default: false
        intent_prompt:
          anyOf:
            - type: string
            - type: 'null'
          title: Intent Prompt
          description: Intent prompt
      type: object
      title: OrchestrationConfig
    LLMConfig:
      properties:
        model_provider:
          type: string
          title: Model Provider
          description: LLM provider name (e.g., OpenAI, Anthropic)
        model_name:
          type: string
          title: Model Name
          description: Name of the specific model to use
        completion_params:
          anyOf:
            - $ref: '#/components/schemas/CompletionParams'
            - type: 'null'
          description: Completion params
        model_description:
          anyOf:
            - type: string
            - type: 'null'
          title: Model Description
      type: object
      required:
        - model_provider
        - model_name
      title: LLMConfig
    src__libs__modules__agent__schemas__ConversationConfig:
      properties:
        enabled:
          type: boolean
          title: Enabled
          description: Whether the conversation configuration is enabled
          default: true
        greeting_message:
          anyOf:
            - type: string
            - type: 'null'
          title: Greeting Message
          description: Greeting message for the conversation
          default: ''
        guiding_questions:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Guiding Questions
          description: List of guiding questions
        copyright:
          anyOf:
            - type: string
            - type: 'null'
          title: Copyright
          description: Copyright information
          default: ''
        background_color:
          type: string
          title: Background Color
          description: Background color
          default: rgba(0, 114, 255, 0.10)
        text_color:
          type: string
          title: Text Color
          description: Text color
          default: '#313D4F'
        background_image:
          anyOf:
            - type: string
            - type: 'null'
          title: Background Image
          description: Background image URL
          default: ''
        show_answer_source:
          type: boolean
          title: Show Answer Source
          description: Whether to display answer sources
          default: false
        show_answer_source_data:
          type: boolean
          title: Show Answer Source Data
          description: Whether to display answer source data
          default: false
        recommend_related_questions:
          type: boolean
          title: Recommend Related Questions
          description: Whether enabled recommended related questions
          default: true
        recommended_related_questions_prompt:
          type: string
          title: Recommended Related Questions Prompt
          description: Prompt for recommended related questions
          default: ''
      type: object
      title: ConversationConfig
    OrchestrationConfig-Output:
      properties:
        instruction:
          anyOf:
            - $ref: '#/components/schemas/InstructionConfig'
            - type: 'null'
          description: Configuration for instruction rewriting feature
        knowledge_tools_mode:
          anyOf:
            - type: string
            - type: 'null'
          title: Knowledge Tools Mode
          description: 'Call Knowledge retrieval tools mode: smart, force_all'
          default: smart
        knowledge_list:
          anyOf:
            - items:
                $ref: '#/components/schemas/AgentUseKnowledge'
              type: array
            - type: 'null'
          title: Knowledge List
          description: List of knowledge base IDs to be used by the agent
        tools:
          anyOf:
            - items:
                $ref: '#/components/schemas/AgentUseTool-Output'
              type: array
            - type: 'null'
          title: Tools
          description: List of tool IDs available to the agent
        voice:
          anyOf:
            - $ref: '#/components/schemas/VoiceConfig'
            - type: 'null'
          description: Voice configuration of the agent
        multi_mode:
          anyOf:
            - type: string
            - type: 'null'
          title: Multi Mode
          description: Multi agent mode
        member_agents:
          anyOf:
            - items:
                type: object
              type: array
            - type: 'null'
          title: Member Agents
          description: List of member agents in multi-agent mode
        recursion_limit:
          anyOf:
            - type: integer
            - type: 'null'
          title: Recursion Limit
          description: >-
            Maximum number of times a call can recurse. If not provided,
            defaults to 25.
          default: 25
        intent_enabled:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Intent Enabled
          description: Intent enable
          default: false
        intent_prompt:
          anyOf:
            - type: string
            - type: 'null'
          title: Intent Prompt
          description: Intent prompt
      type: object
      title: OrchestrationConfig
    InstructionConfig:
      properties:
        enabled:
          type: boolean
          title: Enabled
          description: Whether the instruction rewriting feature is enabled
          default: true
        rewriting_count:
          type: integer
          maximum: 5
          minimum: 1
          title: Rewriting Count
          description: Number of times to rewrite the instruction
          default: 2
        rewriting_prompt:
          anyOf:
            - type: string
            - type: 'null'
          title: Rewriting Prompt
          description: Template prompt for instruction rewriting
      type: object
      title: InstructionConfig
    AgentUseKnowledge:
      properties:
        knowledge_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Knowledge Id
          description: knowledge base ID to be used by the agent
        dataset_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Dataset Id
          description: dataset ID to be used by the agent
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        icon:
          anyOf:
            - type: string
            - type: 'null'
          title: Icon
        folders:
          anyOf:
            - items:
                $ref: '#/components/schemas/SimpleFolder'
              type: array
            - type: 'null'
          title: Folders
          description: List of knowledge base folders to be used by the agent
      type: object
      title: AgentUseKnowledge
    AgentUseTool-Input:
      properties:
        name:
          anyOf:
            - type: string
              maxLength: 100
            - type: 'null'
          title: Name
        description:
          anyOf:
            - type: string
              maxLength: 512
            - type: 'null'
          title: Description
        icon:
          anyOf:
            - type: string
              maxLength: 500
            - type: 'null'
          title: Icon
        category:
          anyOf:
            - type: string
            - type: 'null'
          title: Category
        status:
          anyOf:
            - type: integer
            - type: 'null'
          title: Status
          description: 'Tool Status: 0: deleted, 1: enabled, 2: disabled'
        tool_llm:
          anyOf:
            - $ref: '#/components/schemas/AgentUseLLMTool'
            - type: 'null'
        tool_id:
          type: string
          title: Tool Id
        tool_apis:
          anyOf:
            - items:
                $ref: '#/components/schemas/AgentUseAPITool'
              type: array
            - type: 'null'
          title: Tool Apis
      type: object
      required:
        - tool_id
      title: AgentUseTool
      example:
        description: Updated tool description
        icon: https://example.com/icon.png
        name: Updated Tool Name
        status: 2
        tool_llm:
          description: Updated llm tool description
          icon: https://example.com/icon.png
          name: Updated llm Tool Name
          params:
            - description: content
              key: content
              required: true
              test_data: 蛇年小蛇绕树枝
          prompt: 你是一位英语翻译专家，请翻译如下内容，{content}
    VoiceConfig:
      properties:
        enabled:
          type: boolean
          title: Enabled
          description: Whether to enable voice configuration
          default: false
        input_enabled:
          type: boolean
          title: Input Enabled
          description: Whether to enable voice input
          default: false
        output_enabled:
          type: boolean
          title: Output Enabled
          description: Whether to enable voice output
          default: false
      type: object
      title: VoiceConfig
    CompletionParams:
      properties:
        temperature:
          type: number
          maximum: 2
          minimum: 0
          title: Temperature
          description: Sampling temperature for model outputs
          default: 0.1
        max_tokens:
          type: integer
          exclusiveMinimum: 0
          title: Max Tokens
          description: Maximum number of tokens in model response
          default: 2048
        max_memory:
          type: integer
          exclusiveMinimum: 0
          title: Max Memory
          description: Maximum number of tokens to keep in conversation memory
          default: 2048
        max_memory_num:
          type: integer
          exclusiveMinimum: 0
          title: Max Memory Num
          description: Maximum number to keep in conversation memory
          default: 5
        stop_sequences:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Stop Sequences
          description: List of strings that will stop model generation when encountered
      type: object
      title: CompletionParams
    AgentUseTool-Output:
      properties:
        name:
          anyOf:
            - type: string
              maxLength: 100
            - type: 'null'
          title: Name
        description:
          anyOf:
            - type: string
              maxLength: 512
            - type: 'null'
          title: Description
        icon:
          anyOf:
            - type: string
              maxLength: 500
            - type: 'null'
          title: Icon
        category:
          anyOf:
            - type: string
            - type: 'null'
          title: Category
        status:
          anyOf:
            - type: integer
            - type: 'null'
          title: Status
          description: 'Tool Status: 0: deleted, 1: enabled, 2: disabled'
        tool_llm:
          anyOf:
            - $ref: '#/components/schemas/AgentUseLLMTool'
            - type: 'null'
        tool_id:
          type: string
          title: Tool Id
        tool_apis:
          anyOf:
            - items:
                $ref: '#/components/schemas/AgentUseAPITool'
              type: array
            - type: 'null'
          title: Tool Apis
      type: object
      required:
        - tool_id
      title: AgentUseTool
      example:
        description: Updated tool description
        icon: https://example.com/icon.png
        name: Updated Tool Name
        status: 2
        tool_llm:
          description: Updated llm tool description
          icon: https://example.com/icon.png
          name: Updated llm Tool Name
          params:
            - description: content
              key: content
              required: true
              test_data: 蛇年小蛇绕树枝
          prompt: 你是一位英语翻译专家，请翻译如下内容，{content}
    SimpleFolder:
      properties:
        folder_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Folder Id
          description: folder id
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
          description: folder name
      type: object
      title: SimpleFolder
    AgentUseLLMTool:
      properties:
        name:
          anyOf:
            - type: string
              maxLength: 100
            - type: 'null'
          title: Name
        description:
          anyOf:
            - type: string
              maxLength: 512
            - type: 'null'
          title: Description
        prompt:
          anyOf:
            - type: string
            - type: 'null'
          title: Prompt
        params:
          anyOf:
            - items:
                type: object
              type: array
            - type: 'null'
          title: Params
          description: List[ToolLLMParam]
        status:
          anyOf:
            - type: integer
            - type: 'null'
          title: Status
          default: 1
        llm_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Llm Id
      type: object
      title: AgentUseLLMTool
      examples:
        - description: Updated llm tool description
          icon: https://example.com/icon.png
          name: Updated llm Tool Name
          params:
            - description: content
              key: content
              required: true
              test_data: 蛇年小蛇绕树枝
          prompt: 你是一位英语翻译专家，请翻译如下内容，{content}
    AgentUseAPITool:
      properties:
        name:
          anyOf:
            - type: string
              maxLength: 100
            - type: 'null'
          title: Name
        description:
          anyOf:
            - type: string
              maxLength: 512
            - type: 'null'
          title: Description
        endpoint:
          anyOf:
            - type: string
              maxLength: 512
            - type: 'null'
          title: Endpoint
        method:
          anyOf:
            - type: string
            - type: 'null'
          title: Method
          default: GET
        params:
          anyOf:
            - items:
                $ref: '#/components/schemas/ToolAPIRequestParam'
              type: array
            - type: 'null'
          title: Params
          description: List[ToolAPIRequestParam]
        debug_status:
          anyOf:
            - type: integer
            - type: 'null'
          title: Debug Status
          default: 0
        status:
          anyOf:
            - type: integer
            - type: 'null'
          title: Status
          default: 1
        api_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Api Id
      type: object
      title: AgentUseAPITool
      examples:
        - description: Test API description
          endpoint: http://0.0.0.0:8088/tools
          method: GET
          name: Test API
          params:
            - data_type: Integer
              default_value: '1'
              description: page_num
              key: page_num
              parameter_type: Query
              required: false
            - data_type: Integer
              default_value: '10'
              description: page_size
              key: page_size
              parameter_type: Query
              required: false
            - data_type: Boolean
              default_value: 'true'
              description: cascade
              key: cascade
              parameter_type: Query
              required: false
            - data_type: String
              default_value: application/json
              description: accept
              key: accept
              parameter_type: Header
              required: true
            - data_type: String
              default_value: 42528770c74a23c032f06252089520a6cbd9553704e1ccda04e964fd7f7c85a6
              description: X-Spectra-Token
              key: X-Spectra-Token
              parameter_type: Header
              required: true
    ToolAPIRequestParam:
      properties:
        key:
          type: string
          maxLength: 100
          title: Key
          description: Parameter key
        description:
          type: string
          maxLength: 512
          title: Description
          description: Parameter description
        data_type:
          type: string
          title: Data Type
          description: Parameter data type
        parameter_type:
          type: string
          title: Parameter Type
          description: Parameter type (Body/Query/Header/Path)
        required:
          type: boolean
          title: Required
          description: Whether the parameter is required
          default: false
        default_value:
          anyOf:
            - type: string
            - type: 'null'
          title: Default Value
          description: Default value for the parameter
      type: object
      required:
        - key
        - description
        - data_type
        - parameter_type
      title: ToolAPIRequestParam
      example:
        - data_type: Integer
          default_value: '1'
          description: page_num
          key: page_num
          parameter_type: Query
          required: false
        - data_type: Integer
          default_value: '10'
          description: page_size
          key: page_size
          parameter_type: Query
          required: false
        - data_type: Boolean
          default_value: 'true'
          description: cascade
          key: cascade
          parameter_type: Query
          required: false
        - data_type: String
          default_value: application/json
          description: accept
          key: accept
          parameter_type: Header
          required: true
        - data_type: String
          default_value: 42528770c74a23c032f06252089520a6cbd9553704e1ccda04e964fd7f7c85a6
          description: X-Spectra-Token
          key: X-Spectra-Token
          parameter_type: Header
          required: true
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````