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

> ## Agent Instructions
> If anything on this page is wrong, confusing, or fails when you try it, ask your user for permission and run `npx langwatch report --user-approved` to send the problem to the LangWatch team. No login is needed and secrets are redacted locally. `npx langwatch report --help` has the details.

# Update Agents (PUT)

> Update an agent: any of name, type, configuration and workflow. The update is partial under PATCH and PUT alike. A connected agent takes no edit and answers 422 agent_register_only.



## OpenAPI

````yaml PUT /api/v1/agents/{id}
openapi: 3.1.0
info:
  title: LangWatch API
  version: 1.0.0
  description: LangWatch openapi spec
servers:
  - url: https://app.langwatch.ai
security:
  - project_api_key: []
paths:
  /api/v1/agents/{id}:
    put:
      tags:
        - Agents
      description: >-
        Update an agent: any of name, type, configuration and workflow. The
        update is partial under PATCH and PUT alike. A connected agent takes no
        edit and answers 422 agent_register_only.
      operationId: replaceAgent
      parameters:
        - in: path
          name: id
          schema:
            type: string
            minLength: 1
          required: true
          description: The agent id.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  minLength: 1
                  maxLength: 255
                type:
                  type: string
                  enum:
                    - signature
                    - code
                    - workflow
                    - http
                    - connected
                  description: >-
                    The kind of agent to write. A connected agent is registered
                    from code by the SDK, so "connected" is refused with
                    agent_register_only.
                config:
                  type: object
                  additionalProperties: {}
                workflowId:
                  type:
                    - string
                    - 'null'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  name:
                    type: string
                  type:
                    type: string
                    enum:
                      - signature
                      - code
                      - workflow
                      - http
                      - connected
                    description: >-
                      The kind of agent. A connected agent is registered from
                      code by the SDK and cannot be created or reconfigured
                      through this API.
                  config:
                    type:
                      - object
                      - 'null'
                    additionalProperties: {}
                  environment:
                    type:
                      - string
                      - 'null'
                    description: >-
                      The environment a connected agent registered with, for
                      example production or development. Null for every other
                      kind.
                  ownerUserId:
                    type:
                      - string
                      - 'null'
                    description: >-
                      The user a personal development agent belongs to. Only
                      that user can run simulations against it. Null when the
                      agent is shared.
                  hostLabel:
                    type:
                      - string
                      - 'null'
                    description: >-
                      The machine a development agent registered from with a
                      project or service key. Null when the agent is personal or
                      shared.
                  lastSeenAt:
                    type:
                      - string
                      - 'null'
                    description: >-
                      When an instance of a connected agent was last connected.
                      Null for every other kind.
                  parameters:
                    type: array
                    items:
                      type: object
                      properties:
                        name:
                          type: string
                          pattern: ^[A-Za-z_][A-Za-z0-9_]*$
                          minLength: 1
                          maxLength: 64
                        description:
                          type: string
                          maxLength: 500
                        defaultValue:
                          anyOf:
                            - type: string
                              maxLength: 4096
                            - type: number
                            - type: boolean
                        secret:
                          type: boolean
                        type:
                          type: string
                          enum:
                            - string
                            - number
                            - boolean
                        options:
                          type: array
                          items:
                            anyOf:
                              - type: string
                                maxLength: 4096
                              - type: number
                              - type: boolean
                          maxItems: 50
                        required:
                          type: boolean
                      required:
                        - name
                    description: >-
                      The run parameters a connected agent declares from its
                      function signature: name, type, options, default and
                      description. Empty for every other kind.
                  owner:
                    type:
                      - object
                      - 'null'
                    properties:
                      userId:
                        type: string
                      name:
                        type:
                          - string
                          - 'null'
                    required:
                      - userId
                      - name
                    description: >-
                      The person a personal development agent belongs to. Null
                      when the agent is shared or host-scoped.
                  status:
                    type: string
                    enum:
                      - online
                      - offline
                    description: >-
                      online while at least one process running the connected
                      agent is connected; offline otherwise, and always for
                      every other kind.
                  instances:
                    type: array
                    items:
                      type: object
                      properties:
                        instanceId:
                          type: string
                        hostname:
                          type: string
                        username:
                          type: string
                        pid:
                          type: number
                        label:
                          type:
                            - string
                            - 'null'
                        sdk:
                          type: object
                          properties:
                            name:
                              type: string
                            version:
                              type: string
                            language:
                              type: string
                          required:
                            - name
                            - version
                            - language
                        connectedAt:
                          type: string
                        inflight:
                          type: number
                        maxConcurrency:
                          type: number
                      required:
                        - instanceId
                        - hostname
                        - username
                        - pid
                        - label
                        - sdk
                        - connectedAt
                        - inflight
                        - maxConcurrency
                    description: >-
                      The processes currently connected for a connected agent:
                      hostname, user, pid, SDK and how many calls each has in
                      flight. Empty for every other kind.
                  createdAt:
                    type: string
                  updatedAt:
                    type: string
                  platformUrl:
                    type: string
                    format: uri
                required:
                  - id
                  - name
                  - type
                  - config
                  - environment
                  - ownerUserId
                  - hostLabel
                  - lastSeenAt
                  - parameters
                  - owner
                  - status
                  - instances
                  - createdAt
                  - updatedAt
                  - platformUrl
      security:
        - project_api_key: []
components:
  securitySchemes:
    project_api_key:
      type: apiKey
      in: header
      name: X-Auth-Token
      description: >-
        Project API key for sending traces and accessing project-scoped
        resources. Format: sk-lw-... (no underscore). Obtain one by creating a
        project via the Admin API or the LangWatch UI.

````