> ## 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.

# Generate culture for a council sage

> Runs the full culture generation pipeline. Validates the payload via
`CreateSageGenerate`, then executes all workflow steps (context analysis,
cultural training, intro question crafting, scoring configuration).

For customizable sages: creating_sage → reading_context → cultural_training →
reticulating_splines → transcending_training → enlightenment.

For non-customizable sages: creating_sage → reticulating_splines → enlightenment.




## OpenAPI

````yaml /openapi/private/specs/services/culture.yml post /culture/{council_sage_id}/generate
openapi: 3.1.0
info:
  title: Culture Service API
  description: >
    Manages the culture generation pipeline for council sages. Culture
    encompasses

    the tone, instructions, intro questions, and scoring configuration that
    define

    how a sage conducts screening interviews.


    ## Authentication

    All endpoints require authentication via one of two methods:

    - **API Key**: Pass the key in the `X-Auth` header (service-to-service
    calls)

    - **JWT Token**: Pass a Bearer token in the `Authorization` header
    (user-facing calls)


    The required permission level is noted per endpoint.


    ## Culture Pipeline

    1. **Process** -- Collect all culture inputs (instructions, tone, duration,
    scoring)

    2. **Save Full** -- Start a workflow run and asynchronously generate the
    culture

    3. **Generate** -- Run the full generation pipeline (context analysis, tone
    crafting, intro questions, scoring)

    4. **Save** -- Save individual culture step results to the Prompt Library

    5. **End** -- Finalize the council sage after culture generation


    ## Business Rules

    - Culture data is stored in Redis during the generation pipeline

    - The `save/full` endpoint starts a workflow run and fires async generation

    - The `generate` endpoint validates payload via `CreateSageGenerate` schema

    - Customizable sages use the full pipeline; non-customizable sages skip AI
    tone/context steps

    - The `end` endpoint finalizes the council sage in the Prompt Library
  version: 1.0.0
  contact:
    name: Platform Team
servers:
  - url: '{protocol}://{host}:{port}'
    description: Culture Service
    variables:
      protocol:
        default: https
        enum:
          - http
          - https
      host:
        default: localhost
      port:
        default: '5000'
security: []
tags:
  - name: Culture
    description: Culture CRUD, generation, and pipeline operations
  - name: Service
    description: Health checks and initialization
paths:
  /culture/{council_sage_id}/generate:
    post:
      tags:
        - Culture
      summary: Generate culture for a council sage
      description: >
        Runs the full culture generation pipeline. Validates the payload via

        `CreateSageGenerate`, then executes all workflow steps (context
        analysis,

        cultural training, intro question crafting, scoring configuration).


        For customizable sages: creating_sage → reading_context →
        cultural_training →

        reticulating_splines → transcending_training → enlightenment.


        For non-customizable sages: creating_sage → reticulating_splines →
        enlightenment.
      operationId: generateCulture
      parameters:
        - $ref: '#/components/parameters/CouncilSageId'
        - $ref: '#/components/parameters/RequiredPermission_council_sage'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSageGenerate'
      responses:
        '200':
          description: Culture generated successfully
          content:
            application/json:
              schema:
                type: object
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                invalidPayload:
                  summary: Invalid payload data
                  value:
                    error: >-
                      Invalid payload data: 2 validation errors for
                      CreateSageGenerate

                      council_sage_id
                        Field required...
                noJsonBody:
                  summary: No JSON payload
                  value:
                    error: No JSON data provided
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          description: Council sage not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: Council sage not found
        '500':
          $ref: '#/components/responses/InternalError'
      security:
        - jwtAuth: []
components:
  parameters:
    CouncilSageId:
      name: council_sage_id
      in: path
      required: true
      description: UUID of the council sage
      schema:
        type: string
        format: uuid
      example: c3d4e5f6-7890-4abc-def0-123456789abc
    RequiredPermission_council_sage:
      name: X-Permission-Info
      in: header
      required: false
      description: >-
        **Required JWT permission: `council_sage`** (informational only --
        enforced server-side)
      schema:
        type: string
  schemas:
    CreateSageGenerate:
      type: object
      required:
        - council_sage_id
        - context_id
        - name
        - role
        - role_level
        - duration
        - scoring_low
      properties:
        council_sage_id:
          type: string
          format: uuid
          description: UUID of the council sage
        context_id:
          type: string
          format: uuid
          description: UUID of the context
        name:
          type: string
          description: Display name for the sage
        context:
          type: string
          default: ''
          description: Job description text
        role:
          type: string
          description: Role title
        role_level:
          type: string
          description: Experience level
        instructions:
          type: string
          default: ''
          description: Interview instructions
        duration:
          type: integer
          description: Interview duration in minutes
        tone:
          type: array
          items:
            type: string
          default: []
          description: Tone descriptors
        intro_question:
          type: string
          default: ''
          description: Opening question
        intro_question_results:
          type: string
          default: ''
          description: Evaluation criteria for intro question
        scoring_low:
          type: integer
          description: Low scoring threshold percentage
        scoring_exclude:
          type: array
          items:
            type: integer
          default: []
        scoring_include:
          type: array
          items:
            type: integer
          default: []
        customizable:
          type: boolean
          default: true
          description: >-
            Whether this is a customizable sage (true = full AI pipeline, false
            = non-customizable)
        language_code:
          type:
            - string
            - 'null'
          description: Language code for the interview
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: Human-readable error message
  responses:
    Unauthorized:
      description: Authentication failed
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            noApiKey:
              summary: Missing API key
              value:
                error: Unauthorized - API key required
            invalidApiKey:
              summary: Invalid API key
              value:
                error: Unauthorized - Invalid API key
            noToken:
              summary: Missing JWT token
              value:
                error: Unauthorized - No valid token
            invalidToken:
              summary: Invalid or expired JWT
              value:
                error: Unauthorized3
            insufficientPermissions:
              summary: Token lacks required permission
              value:
                error: Unauthorized4
    InternalError:
      description: Unexpected server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: Internal server error
  securitySchemes:
    jwtAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: User JWT token passed in Authorization header

````