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

# Generate scenarios

> Creates a run and generates test scenarios for the agent. Send `run_id` and `scenario_id` instead to regenerate one scenario of an existing run in place; the response is then `{ scenario }`.

**Auth:** session. **Permission:** `run_agents` or `manage_agents`.



## OpenAPI

````yaml /api-reference/openapi.json post /projects/{projectId}/cost-calculator/generate-scenarios
openapi: 3.1.0
info:
  title: CorePillar API
  version: 1.0.0
  description: >-
    REST API for AgentHub and ModelHub. Ingestion endpoints authenticate with a
    project tracing key; all other endpoints use the signed-in user's browser
    session.
servers:
  - url: https://pillarforge.corepillar.ai/api/v1
    description: AgentHub
security: []
tags:
  - name: Ingestion
    description: 'Send traces with a tracing key: JSON ingest and OpenTelemetry (OTLP).'
  - name: Traces
    description: Read traces and spans.
  - name: Evaluations
    description: Evaluate traces with evaluator collections.
  - name: Evaluators
    description: Built-in and custom evaluators.
  - name: Evaluator collections
    description: Ordered groups of evaluators.
  - name: Organizations
    description: Organizations you belong to.
  - name: Members
    description: Organization members, invites and roles.
  - name: Projects
    description: Projects inside an organization.
  - name: SSO
    description: Okta SSO configuration.
  - name: Tracing keys
    description: Create, list and revoke project tracing keys.
  - name: Cost calculator
    description: Estimate, generate and execute scenario runs.
  - name: Synthetic
    description: Synthetic agent and data setup from source material.
  - name: Chat
    description: ModelHub chat. Served at https://modelhub.corepillar.ai/api/v1.
  - name: Auth
    description: Sign-in helpers.
  - name: E2E
    description: Internal end-to-end encryption key directory.
paths:
  /projects/{projectId}/cost-calculator/generate-scenarios:
    post:
      tags:
        - Cost calculator
      summary: Generate scenarios
      description: >-
        Creates a run and generates test scenarios for the agent. Send `run_id`
        and `scenario_id` instead to regenerate one scenario of an existing run
        in place; the response is then `{ scenario }`.


        **Auth:** session. **Permission:** `run_agents` or `manage_agents`.
      operationId: generateScenarios
      parameters:
        - name: projectId
          in: path
          required: true
          description: Project id.
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              oneOf:
                - title: Generate a batch
                  type: object
                  required:
                    - agent_config
                  properties:
                    agent_config:
                      $ref: '#/components/schemas/AgentConfig'
                    model_config_id:
                      type:
                        - string
                        - 'null'
                      format: uuid
                    scenario_count:
                      type: integer
                      minimum: 1
                      default: 3
                      description: A run is capped at 1,000 scenarios.
                    include_multi_turn:
                      type: boolean
                      default: false
                - title: Regenerate one scenario
                  type: object
                  required:
                    - agent_config
                    - run_id
                    - scenario_id
                  properties:
                    agent_config:
                      $ref: '#/components/schemas/AgentConfig'
                    model_config_id:
                      type:
                        - string
                        - 'null'
                      format: uuid
                    run_id:
                      type: string
                      format: uuid
                    scenario_id:
                      type: string
                      format: uuid
      responses:
        '200':
          description: Scenario regenerated.
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    type: object
                    properties:
                      scenario:
                        $ref: '#/components/schemas/ScenarioSummary'
        '201':
          description: Run created with its scenarios.
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    type: object
                    properties:
                      run_id:
                        type: string
                        format: uuid
                      estimate:
                        $ref: '#/components/schemas/CostEstimate'
                      scenarios:
                        type: array
                        items:
                          $ref: '#/components/schemas/ScenarioSummary'
        '400':
          description: Validation failed. `error.code` is `VALIDATION_ERROR`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '401':
          description: Not signed in (`UNAUTHORIZED`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '403':
          description: >-
            Not a member of the organization, or missing the required permission
            (`FORBIDDEN`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '404':
          description: >-
            Project not found (`PROJECT_NOT_FOUND`) or scenario not found
            (`NOT_FOUND`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '500':
          description: Unexpected server error (`INTERNAL_ERROR`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
      security:
        - session: []
components:
  schemas:
    AgentConfig:
      type: object
      required:
        - system_prompt
      description: The agent the Cost Calculator simulates.
      properties:
        system_prompt:
          type: string
          minLength: 1
          maxLength: 20000
        tone:
          type: string
          maxLength: 2000
          default: ''
        tools:
          type: array
          maxItems: 50
          items:
            $ref: '#/components/schemas/AgentTool'
          default: []
        memory:
          type: string
          maxLength: 4000
          default: ''
    ScenarioSummary:
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        category:
          type: string
          description: For example `happy_path`, `edge_case`, `refusal` or `multi_turn`.
        conversation_plan:
          description: The planned conversation for the scenario.
        turns:
          type: array
          items:
            type: object
            additionalProperties: true
    CostEstimate:
      type: object
      description: >-
        Offline cost estimate. Key fields shown; the object carries more detail
        for the UI.
      additionalProperties: true
      properties:
        perModel:
          type: array
          items:
            type: object
            additionalProperties: true
        totalCostUsd:
          type: number
        totalInputTokens:
          type: integer
        totalOutputTokens:
          type: integer
        scenarioCount:
          type: integer
        llmCalls:
          type: integer
    ErrorEnvelope:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: Stable machine-readable code. Branch on this, not on `message`.
              examples:
                - VALIDATION_ERROR
            message:
              type: string
              description: Human-readable description. May change.
            details:
              type: object
              additionalProperties: true
              description: Extra context; often empty.
    AgentTool:
      type: object
      required:
        - name
      properties:
        kind:
          type: string
          enum:
            - skill
            - memory
            - tool
            - connector
          default: tool
        name:
          type: string
          minLength: 1
          maxLength: 200
        mode:
          type: string
          enum:
            - simulated
            - real
          default: simulated
        description:
          type: string
          maxLength: 512
          default: ''
        content:
          type: string
          maxLength: 20000
  securitySchemes:
    session:
      type: apiKey
      in: cookie
      name: session
      description: >-
        The session cookie set when you sign in to AgentHub or ModelHub in a
        browser. The cookie name shown here is illustrative. There are no API
        tokens for these endpoints.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.