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

# Create Agent Version

> Create a new version of an existing agent.

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url "https://api.roe-ai.com/v1/agents/YOUR_AGENT_ID/versions/" \
    --header "Authorization: Bearer YOUR_API_KEY" \
    --header "Content-Type: application/json" \
    --data '{
      "prompt": "New version prompt",
      "description": "Version description"
    }'
  ```
</RequestExample>


## OpenAPI

````yaml POST /v1/agents/{agent_id}/versions/
openapi: 3.1.0
info:
  title: Roe AI API
  version: 1.0.0
  description: Complete API documentation for Roe AI platform
servers:
  - url: https://api.roe-ai.com
    description: Production API
security: []
paths:
  /v1/agents/{agent_id}/versions/:
    post:
      tags:
        - v1
      summary: Create a new agent version.
      description: Create a new version of an existing agent.
      operationId: v1_agents_versions_create
      parameters:
        - in: path
          name: agent_id
          schema:
            type: string
            format: uuid
          description: A UUID string identifying the base agent.
          required: true
        - name: organization_id
          in: query
          required: false
          schema:
            type: string
            format: uuid
          description: >-
            Organization ID. This is required for access control. It can be
            provided via query or request body depending on the endpoint.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AgentVersionCreateRequest'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentVersion'
              examples:
                Example:
                  value:
                    id: 789e1234-e89b-12d3-a456-426614174002
                    version_name: version 2
                    description: Updated version with new features
                    input_definitions:
                      - key: input_text
                        description: Text to process
                        data_type: text/plain
                    engine_config:
                      model: gpt-4
                      temperature: '0.5'
                    created_at: '2024-01-16T14:20:00Z'
                    readonly: false
                    engine_class_id: openai_chat
                    organization: org-123e4567-e89b-12d3-a456-426614174000
          description: Successfully created new agent version.
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Invalid request data.
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: >-
            Access to the Agents feature is forbidden or permission to access
            this agent denied.
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Agent not found.
components:
  schemas:
    AgentVersionCreateRequest:
      type: object
      description: Serializer for creating new agent versions
      properties:
        version_name:
          type: string
          minLength: 1
          description: >-
            Version name for the agent version. Defaults to 'unnamed version' if
            not provided.
        description:
          type:
            - string
            - 'null'
          description: Description for the agent version.
        input_definitions:
          description: List of input definitions for this agent version.
        engine_config:
          description: Engine configuration as a dictionary of string key-value pairs.
      required:
        - engine_config
        - input_definitions
    AgentVersion:
      type: object
      description: Serializer for Agent (version) model
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
        name:
          type: string
          readOnly: true
        version_name:
          type: string
          description: >-
            Version name for the agent version. Defaults to 'unnamed version' if
            not provided.
        creator:
          oneOf:
            - $ref: '#/components/schemas/UserInfo'
            - type: 'null'
        created_at:
          type: string
          format: date-time
          readOnly: true
        description:
          type: string
          description: Description of the agent version.
        engine_class_id:
          type: string
          description: Get engine_class_id from base_agent.
          readOnly: true
        engine_name:
          type: string
          description: Engine Display Name
          readOnly: true
        input_definitions:
          type: array
          items:
            $ref: '#/components/schemas/AgentInputDefinition'
          description: List of input definitions for this agent version.
        engine_config:
          description: Engine configuration.
        organization_id:
          type: string
          format: uuid
          readOnly: true
          description: Organization ID from base_agent.
        readonly:
          type: boolean
          readOnly: true
        base_agent:
          allOf:
            - $ref: '#/components/schemas/BaseAgent'
          readOnly: true
      required:
        - base_agent
        - created_at
        - engine_class_id
        - engine_config
        - engine_name
        - id
        - input_definitions
        - name
        - organization_id
        - readonly
        - version_name
    ErrorResponse:
      type: object
      properties:
        message:
          type: string
          description: Error message
      required:
        - message
    UserInfo:
      type: object
      properties:
        id:
          type: integer
          readOnly: true
        email:
          type: string
          format: email
          title: Email address
          maxLength: 254
        first_name:
          type: string
          maxLength: 150
        last_name:
          type: string
          maxLength: 150
        display_name:
          type: string
          readOnly: true
      required:
        - display_name
        - email
        - id
    AgentInputDefinition:
      type: object
      properties:
        key:
          type: string
          description: The unique identifier for this input definition
        data_type:
          type: string
          description: The data type of the input (e.g., text, file, etc.)
        description:
          type: string
          description: Description of what this input is for
        example:
          type: string
          description: An example value for this input
        accepts_multiple_files:
          type: boolean
          description: Whether this input accepts multiple files
      required:
        - data_type
        - description
        - key
    BaseAgent:
      type: object
      description: Serializer for BaseAgent (agent config)
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
        creator:
          oneOf:
            - $ref: '#/components/schemas/UserInfo'
            - type: 'null'
        created_at:
          type: string
          format: date-time
          readOnly: true
        name:
          type: string
          maxLength: 200
          minLength: 1
        disable_cache:
          type: boolean
          description: Whether to disable job cache fetching for this agent.
        cache_failed_jobs:
          type: boolean
          description: Whether to cache failed jobs for this agent.
        organization_id:
          type: string
          format: uuid
          description: Organization ID that owns this agent.
        engine_class_id:
          type: string
          maxLength: 200
        current_version_id:
          type: string
          format: uuid
          readOnly: true
          description: UUID of the current agent version.
        job_count:
          type:
            - integer
            - 'null'
          description: >-
            Job count from annotation, or None when not fetched (use
            /agents/job-stats/).
          readOnly: true
        most_recent_job:
          type: string
          readOnly: true
        engine_name:
          type: string
          description: Engine Display Name
          readOnly: true
        tags:
          type: string
          readOnly: true
      required:
        - cache_failed_jobs
        - created_at
        - current_version_id
        - disable_cache
        - engine_class_id
        - engine_name
        - id
        - job_count
        - most_recent_job
        - name
        - organization_id
        - tags

````