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

> Updates an existing agent by its UID. Use this endpoint to modify an agent's configuration, instructions, model, or connected tools.  **Validation:** Referenced tools, API tools, and MCP servers are v

# Update Agent

For the complete error reference, see [Error Guide](/rest-api/ai-agents-apis/error-codes).


## OpenAPI

````yaml patch /ai-agents/agent-builder/agents/{uid}
openapi: 3.0.0
info:
  title: AI Agents APIs
  description: API reference for CometChat AI Agents service
  version: '1.0'
servers:
  - url: https://{appId}.api-{region}.cometchat.io/v3
    variables:
      appId:
        default: appId
        description: (Required) App ID
      region:
        enum:
          - us
          - eu
          - in
        default: us
        description: Select Region
security: []
tags:
  - name: ai-agent
    description: ''
paths:
  /ai-agents/agent-builder/agents/{uid}:
    patch:
      tags:
        - Agent Builder
      summary: Update Agent
      description: >-
        Updates an existing agent by its UID. Use this endpoint to modify an
        agent's configuration, instructions, model, or connected tools.


        **Validation:** Referenced tools, API tools, and MCP servers are
        validated if provided.
      operationId: AgentBuilderController_update
      parameters:
        - name: uid
          required: true
          in: path
          description: Unique identifier of the agent
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateCometChatAgentDto'
      responses:
        '200':
          description: Agent updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessBooleanResponse'
              example:
                success: true
      security:
        - apiKey: []
components:
  schemas:
    UpdateCometChatAgentDto:
      type: object
      properties:
        name:
          type: string
          description: Name of the agent
        icon:
          type: string
          description: URL to the icon/avatar of the agent
        description:
          type: string
          description: Description of the agent
        tools:
          description: Array of tool names available to this agent
          type: array
          items:
            type: string
        apiTools:
          description: Array of API tool names available to this agent
          type: array
          items:
            type: string
        mcpServers:
          description: Array of MCP server names available to this agent
          type: array
          items:
            type: string
        instruction:
          type: string
          description: Instructions for the agent behavior
        metaData:
          type: object
          description: Additional metadata for the agent
        model:
          type: string
          description: AI model to use for this agent
          default: gpt-4o-mini
        modelMetaData:
          type: object
          description: Configuration metadata for the AI model
          properties:
            temperature:
              type: number
              description: >-
                Controls randomness in responses. Lower values make output more
                focused and deterministic.
              example: 0.7
            maxTokens:
              type: number
              description: Maximum number of tokens to generate in the response.
              example: 4096
          additionalProperties: true
        isActive:
          type: boolean
          default: true
          description: Is the agent active?
    SuccessBooleanResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
          description: Indicates whether the operation was successful
      required:
        - success
  securitySchemes:
    apiKey:
      type: apiKey
      description: API Key (i.e. Rest API Key from the Dashboard).
      name: apikey
      in: header

````