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

# Set the model chain

> Replace the agent's model chain. The first model answers, and the next ones take over when it fails. An unknown id returns 404 Bad model_ids. An empty list returns 422. On a built-in agent this changes the chain of the whole organization for that agent.



## OpenAPI

````yaml /openapi.json put /agents/{agent_pid}/models
openapi: 3.1.0
info:
  title: Cominty API
  description: >-
    The HTTP API behind the Cominty Python SDK: chat and threads, memory, MCP
    integrations, agents, skills, document sources, and documents. Send your API
    key in the x-cominty-token header.
  version: main.5359267
servers:
  - url: https://ds.cominty.com
security:
  - comintyToken: []
paths:
  /agents/{agent_pid}/models:
    put:
      tags:
        - agents
      summary: Set the model chain
      description: >-
        Replace the agent's model chain. The first model answers, and the next
        ones take over when it fails. An unknown id returns 404 Bad model_ids.
        An empty list returns 422. On a built-in agent this changes the chain of
        the whole organization for that agent.
      operationId: set_agent_models_agents__agent_pid__models_put
      parameters:
        - name: agent_pid
          in: path
          required: true
          schema:
            type: string
            title: Agent Pid
          description: Identifier of the agent.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AgentModelsIn'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/cominty__api__routers__agents__AgentOut'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    AgentModelsIn:
      properties:
        model_ids:
          items:
            type: string
          type: array
          minItems: 1
          title: Model Ids
          description: >-
            The new chain, in failover order. At least one id, from GET
            /agents/models.
      additionalProperties: false
      type: object
      required:
        - model_ids
      title: AgentModelsIn
    cominty__api__routers__agents__AgentOut:
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        capabilities:
          anyOf:
            - $ref: '#/components/schemas/AgentCapabilities'
            - type: 'null'
        execution_options:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Execution Options
        memory_namespace:
          anyOf:
            - type: string
            - type: 'null'
          title: Memory Namespace
        managed:
          type: boolean
          title: Managed
        scope:
          type: string
          title: Scope
        owner:
          type: string
          title: Owner
        instructions:
          anyOf:
            - type: string
            - type: 'null'
          title: Instructions
        allow_execution_options_override:
          type: boolean
          title: Allow Execution Options Override
        models:
          items:
            $ref: '#/components/schemas/LLMModelSummaryOut'
          type: array
          title: Models
      additionalProperties: false
      type: object
      required:
        - id
        - name
        - description
        - capabilities
        - execution_options
        - memory_namespace
        - managed
        - scope
        - owner
        - instructions
        - allow_execution_options_override
        - models
      title: AgentOut
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    AgentCapabilities:
      properties:
        web:
          anyOf:
            - $ref: '#/components/schemas/SingleAgentCapability'
            - type: 'null'
        indexed_documents:
          anyOf:
            - oneOf:
                - $ref: >-
                    #/components/schemas/InstalledIndexedDocumentsAgentCapability
                - $ref: '#/components/schemas/NeverAgentCapability'
              discriminator:
                propertyName: activation
                mapping:
                  always: >-
                    #/components/schemas/InstalledIndexedDocumentsAgentCapability
                  never: '#/components/schemas/NeverAgentCapability'
                  on_request: >-
                    #/components/schemas/InstalledIndexedDocumentsAgentCapability
            - type: 'null'
          title: Indexed Documents
        mcp:
          anyOf:
            - oneOf:
                - $ref: '#/components/schemas/InstalledMCPAgentCapability'
                - $ref: '#/components/schemas/NeverAgentCapability'
              discriminator:
                propertyName: activation
                mapping:
                  always: '#/components/schemas/InstalledMCPAgentCapability'
                  never: '#/components/schemas/NeverAgentCapability'
                  on_request: '#/components/schemas/InstalledMCPAgentCapability'
            - type: 'null'
          title: Mcp
        skills:
          anyOf:
            - oneOf:
                - $ref: '#/components/schemas/InstalledSkillsAgentCapability'
                - $ref: '#/components/schemas/NeverAgentCapability'
              discriminator:
                propertyName: activation
                mapping:
                  always: '#/components/schemas/InstalledSkillsAgentCapability'
                  never: '#/components/schemas/NeverAgentCapability'
            - type: 'null'
          title: Skills
        image_generation:
          anyOf:
            - $ref: '#/components/schemas/SingleAgentCapability'
            - type: 'null'
        video_generation:
          anyOf:
            - $ref: '#/components/schemas/SingleAgentCapability'
            - type: 'null'
        music_generation:
          anyOf:
            - $ref: '#/components/schemas/SingleAgentCapability'
            - type: 'null'
        memory:
          anyOf:
            - oneOf:
                - $ref: '#/components/schemas/AlwaysMemoryAgentCapability'
                - $ref: '#/components/schemas/NeverAgentCapability'
              discriminator:
                propertyName: activation
                mapping:
                  always: '#/components/schemas/AlwaysMemoryAgentCapability'
                  never: '#/components/schemas/NeverAgentCapability'
            - type: 'null'
          title: Memory
      additionalProperties: false
      type: object
      title: AgentCapabilities
    LLMModelSummaryOut:
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
      additionalProperties: false
      type: object
      required:
        - id
        - name
      title: LLMModelSummaryOut
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    SingleAgentCapability:
      properties:
        activation:
          type: string
          enum:
            - always
            - on_request
            - never
          title: Activation
          description: >-
            always: on for every message. on_request: off until a message turns
            it on with scope. never: unavailable.
      additionalProperties: false
      type: object
      required:
        - activation
      title: SingleAgentCapability
    InstalledIndexedDocumentsAgentCapability:
      properties:
        activation:
          type: string
          enum:
            - always
            - on_request
          title: Activation
          description: >-
            always or on_request. Use never on its own to turn the capability
            off.
        source_ids:
          anyOf:
            - items:
                type: integer
              type: array
              minItems: 1
            - type: string
              const: '*'
          title: Source Ids
          default: '*'
          description: >-
            Allowlist of document source ids, or "*" for every source the user
            can read. At least one id when it is a list.
        document_ids:
          anyOf:
            - items:
                type: string
              type: array
              minItems: 1
            - type: string
              const: '*'
          title: Document Ids
          default: '*'
          description: >-
            Allowlist of document ids, or "*" for no restriction. At least one
            id when it is a list.
      additionalProperties: false
      type: object
      required:
        - activation
      title: InstalledIndexedDocumentsAgentCapability
    NeverAgentCapability:
      properties:
        activation:
          type: string
          const: never
          title: Activation
      additionalProperties: false
      type: object
      required:
        - activation
      title: NeverAgentCapability
    InstalledMCPAgentCapability:
      properties:
        activation:
          type: string
          enum:
            - always
            - on_request
          title: Activation
          description: >-
            always or on_request. Use never on its own to turn the capability
            off.
        connections:
          anyOf:
            - items:
                type: string
              type: array
              minItems: 1
            - type: string
              const: '*'
          title: Connections
          default: '*'
          description: >-
            Allowlist of MCP connection names, or "*" for every connection of
            the user. At least one name when it is a list.
      additionalProperties: false
      type: object
      required:
        - activation
      title: InstalledMCPAgentCapability
    InstalledSkillsAgentCapability:
      properties:
        activation:
          type: string
          const: always
          title: Activation
        include:
          anyOf:
            - items:
                type: string
              type: array
              minItems: 1
            - type: string
              const: '*'
          title: Include
          default: '*'
          description: >-
            Allowlist of skill ids, or "*" for every active skill the user can
            read. At least one id when it is a list.
      additionalProperties: false
      type: object
      required:
        - activation
      title: InstalledSkillsAgentCapability
    AlwaysMemoryAgentCapability:
      properties:
        activation:
          type: string
          const: always
          title: Activation
        namespace:
          type: string
          maxLength: 128
          minLength: 1
          title: Namespace
          description: Memory namespace the thread reads and writes. 1 to 128 characters.
      additionalProperties: false
      type: object
      required:
        - activation
        - namespace
      title: AlwaysMemoryAgentCapability
  securitySchemes:
    comintyToken:
      type: apiKey
      in: header
      name: x-cominty-token
      description: >-
        A Cominty Platform API secret. A key created now starts with sk-cmt-.
        Send it as is, or as Bearer sk-cmt-..., with at most one Bearer prefix.
        A key created before the prefix existed has no sk-cmt- and still works.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.