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

# Update Cycle



## OpenAPI

````yaml /openapi.json patch /api/v1/teams/{team_id}/cycle
openapi: 3.1.0
info:
  title: AITasker
  version: 0.1.0
servers: []
security: []
paths:
  /api/v1/teams/{team_id}/cycle:
    patch:
      tags:
        - LoopOps
      summary: Update Cycle
      operationId: update_cycle_api_v1_teams__team_id__cycle_patch
      parameters:
        - name: team_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Team Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateCycleRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CycleDetailResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    UpdateCycleRequest:
      properties:
        name:
          anyOf:
            - type: string
              maxLength: 255
              minLength: 1
            - type: 'null'
          title: Name
        duration_type:
          anyOf:
            - type: string
              enum:
                - daily
                - weekly
                - biweekly
                - monthly
                - quarterly
                - yearly
                - custom
            - type: 'null'
          title: Duration Type
        duration_days:
          anyOf:
            - type: integer
              maximum: 366
              minimum: 1
            - type: 'null'
          title: Duration Days
        start_anchor:
          anyOf:
            - type: string
              enum:
                - today
                - monday
                - first_of_month
                - custom_date
            - type: 'null'
          title: Start Anchor
        custom_start_date:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Custom Start Date
        timezone:
          anyOf:
            - type: string
            - type: 'null'
          title: Timezone
        phases:
          anyOf:
            - items:
                $ref: '#/components/schemas/PhaseConfig'
              type: array
            - type: 'null'
          title: Phases
        is_active:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Is Active
      type: object
      title: UpdateCycleRequest
    CycleDetailResponse:
      properties:
        cycle:
          $ref: '#/components/schemas/StrategyCycleResponse'
        loops:
          items:
            $ref: '#/components/schemas/WorkLoopResponse'
          type: array
          title: Loops
        signals:
          items:
            $ref: '#/components/schemas/LoopSignalResponse'
          type: array
          title: Signals
        active_instance:
          anyOf:
            - $ref: '#/components/schemas/CycleInstanceResponse'
            - type: 'null'
      type: object
      required:
        - cycle
        - loops
        - signals
        - active_instance
      title: CycleDetailResponse
      description: 'Full cycle view: cycle definition + loops + signals + active instance.'
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    PhaseConfig:
      properties:
        name:
          type: string
          maxLength: 50
          minLength: 1
          title: Name
        start_pct:
          type: number
          maximum: 100
          minimum: 0
          title: Start Pct
          description: Start position as % of cycle
        end_pct:
          type: number
          maximum: 100
          minimum: 0
          title: End Pct
          description: End position as % of cycle
        color:
          anyOf:
            - type: string
            - type: 'null'
          title: Color
          description: Hex color for UI rendering
      type: object
      required:
        - name
        - start_pct
        - end_pct
      title: PhaseConfig
    StrategyCycleResponse:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        team_id:
          type: string
          format: uuid
          title: Team Id
        name:
          type: string
          title: Name
        duration_type:
          type: string
          title: Duration Type
        duration_days:
          type: integer
          title: Duration Days
        start_anchor:
          type: string
          title: Start Anchor
        custom_start_date:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Custom Start Date
        timezone:
          type: string
          title: Timezone
        phases:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Phases
        is_active:
          type: boolean
          title: Is Active
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
      type: object
      required:
        - id
        - team_id
        - name
        - duration_type
        - duration_days
        - start_anchor
        - custom_start_date
        - timezone
        - phases
        - is_active
        - created_at
        - updated_at
      title: StrategyCycleResponse
    WorkLoopResponse:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        cycle_id:
          type: string
          format: uuid
          title: Cycle Id
        parent_loop_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Parent Loop Id
        name:
          type: string
          title: Name
        agent_member_id:
          type: string
          format: uuid
          title: Agent Member Id
        phase:
          anyOf:
            - type: string
            - type: 'null'
          title: Phase
        schedule_type:
          type: string
          title: Schedule Type
        cadence:
          additionalProperties: true
          type: object
          title: Cadence
        task_type:
          type: string
          title: Task Type
        task_template:
          additionalProperties: true
          type: object
          title: Task Template
        priority:
          type: string
          title: Priority
        sort_order:
          type: integer
          title: Sort Order
        is_active:
          type: boolean
          title: Is Active
        content_source:
          anyOf:
            - $ref: '#/components/schemas/ContentSourceConfig'
            - type: 'null'
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
      type: object
      required:
        - id
        - cycle_id
        - parent_loop_id
        - name
        - agent_member_id
        - phase
        - schedule_type
        - cadence
        - task_type
        - task_template
        - priority
        - sort_order
        - is_active
        - created_at
        - updated_at
      title: WorkLoopResponse
    LoopSignalResponse:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        cycle_id:
          type: string
          format: uuid
          title: Cycle Id
        emitter_loop_id:
          type: string
          format: uuid
          title: Emitter Loop Id
        receiver_loop_id:
          type: string
          format: uuid
          title: Receiver Loop Id
        signal_name:
          type: string
          title: Signal Name
        action:
          type: string
          title: Action
        delay_minutes:
          type: integer
          title: Delay Minutes
        is_active:
          type: boolean
          title: Is Active
        created_at:
          type: string
          format: date-time
          title: Created At
      type: object
      required:
        - id
        - cycle_id
        - emitter_loop_id
        - receiver_loop_id
        - signal_name
        - action
        - delay_minutes
        - is_active
        - created_at
      title: LoopSignalResponse
    CycleInstanceResponse:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        cycle_id:
          type: string
          format: uuid
          title: Cycle Id
        team_id:
          type: string
          format: uuid
          title: Team Id
        instance_number:
          type: integer
          title: Instance Number
        start_date:
          type: string
          format: date-time
          title: Start Date
        end_date:
          type: string
          format: date-time
          title: End Date
        current_phase:
          anyOf:
            - type: string
            - type: 'null'
          title: Current Phase
        status:
          type: string
          title: Status
        metrics:
          additionalProperties: true
          type: object
          title: Metrics
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
      type: object
      required:
        - id
        - cycle_id
        - team_id
        - instance_number
        - start_date
        - end_date
        - current_phase
        - status
        - metrics
        - created_at
        - updated_at
      title: CycleInstanceResponse
    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
    ContentSourceConfig:
      properties:
        source_url:
          type: string
          maxLength: 2048
          minLength: 1
          title: Source Url
        source_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Source Type
        include_tags:
          items:
            type: string
          type: array
          title: Include Tags
        exclude_tags:
          items:
            type: string
          type: array
          title: Exclude Tags
        max_age_days:
          anyOf:
            - type: integer
              minimum: 1
            - type: 'null'
          title: Max Age Days
      type: object
      required:
        - source_url
      title: ContentSourceConfig
      description: >-
        Per-loop content-driven source config (SMMT content-driven
        distribution).


        Typed (not a raw dict) so malformed payloads are rejected at the API

        boundary with a 422 rather than persisting silently and never
        dispatching:

        ``cycle_scheduler._loop_content_source()`` only treats a loop as

        content-driven when ``content_source`` is a dict carrying a non-blank

        ``source_url``, so an invalid value would look "saved" but quietly stop

        distribution. ``source_type`` is auto-detected at scan time; tag/recency

        rules are consumed by ``content_source_scanner.pick_next_item``.
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````