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

# List Branches

> List all branches for an agent.

    Each branch represents a git branch (e.g., main, staging, feature-x).
    By default, retired branches are excluded.



## OpenAPI

````yaml openapi.json GET /agents/{namespace_slug}/{agent_name}/branches
openapi: 3.1.0
info:
  title: Sb0 API
  version: 0.1.0
servers: []
security: []
paths:
  /agents/{namespace_slug}/{agent_name}/branches:
    get:
      tags:
        - Branches
      summary: List Branches by Agent
      description: |-
        List all branches for an agent.

            Each branch represents a git branch (e.g., main, staging, feature-x).
            By default, retired branches are excluded.
      operationId: agents_branches_list
      parameters:
        - in: path
          name: namespace_slug
          required: true
          schema:
            title: Namespace Slug
            type: string
        - in: path
          name: agent_name
          required: true
          schema:
            title: Agent Name
            type: string
        - description: Include retired branches in results
          in: query
          name: include_retired
          required: false
          schema:
            default: false
            description: Include retired branches in results
            title: Include Retired
            type: boolean
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BranchListResponse'
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
components:
  schemas:
    BranchListResponse:
      description: Response for listing branches.
      properties:
        branches:
          description: List of branches
          items:
            $ref: '#/components/schemas/BranchResponse'
          title: Branches
          type: array
        total:
          description: Total count
          title: Total
          type: integer
      required:
        - branches
        - total
      title: BranchListResponse
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    BranchResponse:
      description: Full branch details including current version.
      properties:
        agent_id:
          description: Parent agent ID
          title: Agent Id
          type: string
        created_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          description: Creation timestamp
          title: Created At
        current_version:
          anyOf:
            - $ref: '#/components/schemas/VersionSummary'
            - type: 'null'
          description: Currently active version (includes status)
        git_branch:
          description: Original git branch name
          title: Git Branch
          type: string
        git_branch_normalized:
          description: DNS-safe branch name
          title: Git Branch Normalized
          type: string
        id:
          description: Branch ID
          title: Id
          type: string
        replicas:
          description: Desired replica count
          title: Replicas
          type: integer
        retired_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          description: When branch was retired
          title: Retired At
        retired_reason:
          anyOf:
            - type: string
            - type: 'null'
          description: Reason for retirement
          title: Retired Reason
        updated_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          description: Last update timestamp
          title: Updated At
      required:
        - id
        - agent_id
        - git_branch
        - git_branch_normalized
        - replicas
      title: BranchResponse
      type: object
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
    VersionSummary:
      description: Abbreviated version info for embedding in branch responses.
      properties:
        deployed_at:
          description: When this version was deployed
          format: date-time
          title: Deployed At
          type: string
        git_hash:
          description: Git commit hash
          title: Git Hash
          type: string
        git_message:
          default: ''
          description: Git commit message
          title: Git Message
          type: string
        id:
          description: Version ID
          title: Id
          type: string
        source_filesystem_id:
          anyOf:
            - type: string
            - type: 'null'
          description: Filesystem snapshot that can reopen this version in Agent Builder
          title: Source Filesystem Id
        status:
          $ref: '#/components/schemas/VersionStatus'
          description: Version lifecycle status
      required:
        - id
        - git_hash
        - status
        - deployed_at
      title: VersionSummary
      type: object
    VersionStatus:
      description: Status of a version in its lifecycle.
      enum:
        - DEPLOYING
        - ACTIVE
        - FAILED
        - UNHEALTHY
        - DRAINING
        - RETIRED
        - ROLLED_BACK
      title: VersionStatus
      type: string

````