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

# Poll build step progress

> Polls the Python service for the current build step status.
Called repeatedly by the front-end during the build process
to update the progress UI.

If a `sage_id` is provided, also checks for a `test_screen_id`
that may have been set by the Python callback.

Registered as `wp_ajax_sagescreen_get_step_status` — **login required**.




## OpenAPI

````yaml /openapi/private/specs/wp/sage-internal.yml post /wp-admin/admin-ajax.php?action=sagescreen_get_step_status
openapi: 3.1.0
info:
  title: SageScreen — Sage Module
  description: >
    Council sage management. Sages are AI screening assistants customized

    per council. Each council can have system sages (non-customizable,

    auto-attached) and custom sages (built through a multi-step workflow).


    **CPT:** `ss_council_sage`

    **Custom statuses:** `ss_draft`, `ss_building`, `ss_active`, `ss_inactive`,
    `ss_paused`


    ## Build Workflow


    Custom sages go through a 6-step creation workflow:

    1. **Context** — Define role, level, and job description

    2. **Culture** — Configure tone, scoring, intro question, evaluation
    guidelines

    3. **Build** — Automated build via Python service (8 sub-steps)

    4. **Test** — Optional test screen to verify sage behavior

    5. **Finalize** — Review and confirm build

    6. **Deploy** — Set email config and activate sage


    Build sub-steps (step 3) run sequentially in the Python service:

    `starting` → `creating_sage` → `sage_generation` → `test_shu` →

    `test_ha` → `test_ri` → `transcending_training` → `enlightenment`
  version: 1.0.0
servers:
  - url: https://{domain}/wp-json/sagescreen/v1
    description: WordPress REST API
    variables:
      domain:
        default: api.sagescreen.app
security: []
tags:
  - name: Sage – REST
    description: REST API endpoints for sage operations and Python callbacks
  - name: Sage – CRUD
    description: AJAX endpoints for sage creation, editing, and status management
  - name: Sage – Build Workflow
    description: AJAX endpoints for the multi-step sage build process
paths:
  /wp-admin/admin-ajax.php?action=sagescreen_get_step_status:
    post:
      tags:
        - Sage – Build Workflow
      summary: Poll build step progress
      description: |
        Polls the Python service for the current build step status.
        Called repeatedly by the front-end during the build process
        to update the progress UI.

        If a `sage_id` is provided, also checks for a `test_screen_id`
        that may have been set by the Python callback.

        Registered as `wp_ajax_sagescreen_get_step_status` — **login required**.
      operationId: ajaxGetStepStatus
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              required:
                - action
                - nonce
                - run_id
              properties:
                action:
                  type: string
                  const: sagescreen_get_step_status
                nonce:
                  type: string
                  description: WP nonce for `sagescreen_frontend_nonce`
                  examples:
                    - abc123def456
                run_id:
                  type: string
                  description: Workflow run ID from `start_full_sage_build`
                  examples:
                    - run_abc123def456
                sage_id:
                  type: integer
                  description: Optional — WordPress post ID to check for test_screen_id
                  examples:
                    - 1234
      responses:
        '200':
          description: Step status
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/StepStatusSuccess'
                  - $ref: '#/components/schemas/AjaxErrorResponse'
              examples:
                inProgress:
                  summary: Step in progress
                  value:
                    success: true
                    current_step: sage_generation
                    step_state: running
                    step_order: 3
                withTestScreen:
                  summary: Step with test screen available
                  value:
                    success: true
                    current_step: transcending_training
                    step_state: running
                    step_order: 7
                    test_screen_id: scr_abc123def456
                finished:
                  summary: Workflow may be finished
                  value:
                    success: false
                    message: No current step - workflow may be finished
      security:
        - wpAjaxNonce: []
components:
  schemas:
    StepStatusSuccess:
      type: object
      properties:
        success:
          type: boolean
          const: true
          examples:
            - true
        current_step:
          $ref: '#/components/schemas/BuildStepName'
        step_state:
          $ref: '#/components/schemas/BuildStepState'
        step_order:
          type: integer
          description: Current step execution order (1-based)
          examples:
            - 3
        test_screen_id:
          type: string
          description: Test screen ID (present only during/after transcending_training)
          examples:
            - scr_abc123def456
    AjaxErrorResponse:
      type: object
      description: |
        Standard AJAX error. The `data` field is either a plain string
        (from `wp_send_json_error`) or absent when using `wp_send_json`
        directly with `success: false`.
      properties:
        success:
          type: boolean
          const: false
          examples:
            - false
        message:
          type: string
          description: Error message (when using wp_send_json directly)
          examples:
            - Security check failed
        data:
          oneOf:
            - type: string
              examples:
                - Security check failed
            - type: object
              properties:
                message:
                  type: string
                  examples:
                    - Insufficient permissions
    BuildStepName:
      type: string
      description: Build sub-step names in execution order
      enum:
        - starting
        - creating_sage
        - sage_generation
        - test_shu
        - test_ha
        - test_ri
        - transcending_training
        - enlightenment
      examples:
        - sage_generation
    BuildStepState:
      type: string
      description: State of an individual build sub-step
      enum:
        - pending
        - running
        - completed
        - failed
      examples:
        - running
  securitySchemes:
    wpAjaxNonce:
      type: apiKey
      in: query
      name: nonce
      description: WordPress AJAX nonce (passed as form field, verified per-action)

````