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

# Deploy agent with code changes

> Deploys agent with local code changes from CLI.



## OpenAPI

````yaml /api-reference/openapi.json patch /api/v1/runtime/agents/{id}/deploy
openapi: 3.0.0
info:
  title: Runflow Runtime API
  description: >-
    Programmatic surface for the Runflow platform — used by the SDK, the CLI,
    the execution engine, and any server-to-server caller. Authenticate with an
    `x-api-key` header (or `Authorization: Bearer ...`).
  version: 1.0.0
  contact: {}
servers:
  - url: https://api.runflow.ai
    description: Production
  - url: http://localhost:3000
    description: Local development
security: []
tags: []
paths:
  /api/v1/runtime/agents/{id}/deploy:
    patch:
      tags:
        - Runtime API - Agents Management
      summary: Deploy agent with code changes
      description: Deploys agent with local code changes from CLI.
      operationId: RuntimeAgentsController_deployAgent
      parameters:
        - name: id
          required: true
          in: path
          description: Agent UUID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateCodeDto'
      responses:
        '200':
          description: Agent deployed successfully.
      security:
        - bearer: []
components:
  schemas:
    UpdateCodeDto:
      type: object
      properties:
        repo:
          type: string
          description: The name of the repository
          example: my-repo
        message:
          type: string
          description: The message of the commit
        tree:
          description: The tree of the commit
          example:
            - path: caminho/arquivo.txt
              mode: '100644'
              type: blob
              content: Conteúdo do arquivo
          type: array
          items:
            $ref: '#/components/schemas/TreeDto'
        branch:
          type: string
          description: The branch of the commit
          example: main
        authorName:
          type: string
          description: Git commit author name (from local git config)
          example: Danrley Silva
        authorEmail:
          type: string
          description: Git commit author email (from local git config)
          example: danrley@example.com
        environment:
          type: string
          description: >-
            Target environment for deploy. If not provided, defaults to
            production (backward compat with old CLI).
          enum:
            - staging
            - production
      required:
        - repo
        - message
        - tree
        - branch
    TreeDto:
      type: object
      properties:
        path:
          type: string
          description: The path of the file
          example: caminho/arquivo.txt
        mode:
          type: string
          description: >-
            The mode of the file (100644 = file, 100755 = executable file,
            120000 = symlink, 040000 = directory)
          enum:
            - '100644'
            - '100755'
            - '120000'
            - '040000'
        type:
          type: string
          description: The type of the file
          example: blob
          enum:
            - blob
            - commit
            - tree
        content:
          type: string
          description: The content of the file
          example: Conteúdo do arquivo
      required:
        - path
        - mode
        - type
        - content

````