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

# Add a revision

> Appends a revision to an agent, instructions or code, and makes it the one runs use. Revisions are never changed or removed.

Minimum role required: Member


## OpenAPI

````yaml /api-reference/openapi-backend.json post /agents/{agent_id}/revisions
openapi: 3.1.0
info:
  description: Axilio backend HTTP API.
  title: Axilio API
  version: 0.155.0
servers:
  - url: https://api.axilio.ai/api/v1
    description: Production
security: []
tags:
  - name: Agents
  - name: API Keys
  - name: Billing
  - name: Conversations
  - name: Files
  - name: Messages
  - name: Models
  - name: Organization
  - name: Phones
  - name: Runs
  - name: Sessions
  - name: Skill
  - name: Usage
  - name: Webhooks
paths:
  /agents/{agent_id}/revisions:
    post:
      tags:
        - Agents
      summary: Add a revision
      description: >-
        Appends a revision to an agent, instructions or code, and makes it the
        one runs use. Revisions are never changed or removed.
      operationId: agents_create_revision
      parameters:
        - description: The agent's id.
          in: path
          name: agent_id
          required: true
          schema:
            description: The agent's id.
            format: uuid
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AgentRevisionCreateRequest'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentRevision'
          description: Created
        '400':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/V2ErrorModel'
          description: Bad Request
        '403':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/V2ErrorModel'
          description: Forbidden
        '404':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/V2ErrorModel'
          description: Not Found
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/V2ErrorModel'
          description: Unprocessable Entity
        '500':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/V2ErrorModel'
          description: Internal Server Error
      security:
        - apiKeyAuth: []
components:
  schemas:
    AgentRevisionCreateRequest:
      additionalProperties: false
      description: >-
        Request body for adding a revision. The new revision becomes the agent's
        current one.
      properties:
        code:
          description: The script, for a code revision.
          type: string
        instructions:
          description: The task, for an instructions revision.
          maxLength: 20000
          type: string
        kind:
          description: code needs code; instructions needs instructions.
          enum:
            - code
            - instructions
          type: string
        message:
          description: A note on the revision.
          maxLength: 500
          type: string
        on_failure:
          description: >-
            For a code revision, what a run does when a step fails. fail fails
            the run. ask pauses the run for a person (reason step_check_failed),
            who retries the step or completes the run with its output. repair
            hands the run to the agent, which finishes the task and proposes a
            fixed revision for a person to promote. Defaults to the current
            revision's, or fail.
          enum:
            - fail
            - ask
            - repair
          type: string
      required:
        - kind
      type: object
    AgentRevision:
      additionalProperties: false
      description: >-
        One revision of an agent: instructions or code. Revisions are
        append-only.
      properties:
        agent_id:
          description: The agent the revision belongs to.
          format: uuid
          type: string
        author_user_id:
          description: >-
            The user who added the revision. Null once they have deleted their
            account.
          format: uuid
          type:
            - string
            - 'null'
        base_revision_id:
          description: On a proposed fix, the revision the repaired run ran.
          format: uuid
          type: string
        code:
          description: The script, on a code revision.
          type: string
        created_at:
          description: When the revision was added.
          format: date-time
          type: string
        id:
          description: The revision's id.
          format: uuid
          type: string
        instructions:
          description: The task, on an instructions revision.
          type: string
        kind:
          description: >-
            code: the revision is a script. instructions: the revision is a task
            the agent works through a model.
          enum:
            - code
            - instructions
          type: string
        message:
          description: The author's note on the revision.
          type: string
        on_failure:
          description: >-
            On a code revision, what a run does when a step fails: fail the run,
            ask (pause for a person, who retries the step or completes the run),
            or repair (the agent takes over and proposes a fix).
          enum:
            - fail
            - ask
            - repair
          type: string
        promoted_at:
          description: On a proposed fix, when it was promoted to current.
          format: date-time
          type: string
        proposal_state:
          description: >-
            Set when the revision is a fix a repair proposed, which is not
            current until promoted: waiting to be promoted, superseded (the
            agent has moved on from the revision it fixes, so it can't be
            promoted), or promoted.
          enum:
            - waiting
            - superseded
            - promoted
          type: string
        revision:
          description: The revision's number within the agent, from 1.
          format: int64
          type: integer
        source_run_id:
          description: >-
            The run the revision came from: on a proposed fix, the run whose
            repair wrote it; on an agent saved from a run, that run.
          format: uuid
          type: string
      required:
        - id
        - agent_id
        - revision
        - kind
        - author_user_id
        - created_at
      type: object
    V2ErrorModel:
      additionalProperties: false
      description: >-
        Error response, following RFC 9457 (Problem Details for HTTP APIs).
        Returned with a application/problem+json content type.
      properties:
        detail:
          description: >-
            A human-readable explanation specific to this occurrence of the
            problem.
          examples:
            - Property foo is required but is missing.
          type: string
        errors:
          description: Optional list of individual error details
          items:
            $ref: '#/components/schemas/V2ErrorDetail'
          type:
            - array
            - 'null'
        instance:
          description: >-
            A URI reference that identifies the specific occurrence of the
            problem.
          examples:
            - https://example.com/error-log/abc123
          format: uri
          type: string
        status:
          description: HTTP status code
          examples:
            - 400
          format: int64
          type: integer
        title:
          description: >-
            A short, human-readable summary of the problem type. This value
            should not change between occurrences of the error.
          examples:
            - Bad Request
          type: string
        type:
          default: about:blank
          description: A URI reference to human-readable documentation for the error.
          examples:
            - https://example.com/errors/example
          format: uri
          type: string
      type: object
    V2ErrorDetail:
      additionalProperties: false
      description: >-
        One specific problem within an error response, locating the offending
        part of the request.
      properties:
        location:
          description: >-
            Where the error occurred, e.g. 'body.items[3].tags' or
            'path.thing-id'
          type: string
        message:
          description: Error message text
          type: string
        value:
          description: The value at the given location
      type: object
  securitySchemes:
    apiKeyAuth:
      description: Customer API key (axl_ prefix).
      in: header
      name: X-Axilio-Api-Key
      type: apiKey

````

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