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

# Create Run

> Start a simulation run for an agent.

Simulations generate synthetic test calls against the agent's current
configuration and grade them using its `PASS_FAIL` evals. The agent needs at
least one `PASS_FAIL` eval configured before a run can start.

Returns immediately with the run in `pending` state and `generated_count` of
zero — scenario generation runs asynchronously. Poll List Runs for progress.



## OpenAPI

````yaml https://api.usetuner.ai/public/openapi.json post /api/v1/workspaces/{workspace_id}/agents/{agent_id}/simulation-runs
openapi: 3.1.0
info:
  title: My Public API
  version: 1.0.0
servers:
  - url: https://api.usetuner.ai
security: []
tags:
  - name: calls
    x-group: Calls
  - name: workspaces
    x-group: Workspaces
  - name: agent-settings
    x-group: Agent Settings
  - name: agents
    x-group: Agents
  - name: simulation
    x-group: Simulation
  - name: providers
    x-group: Providers
paths:
  /api/v1/workspaces/{workspace_id}/agents/{agent_id}/simulation-runs:
    post:
      tags:
        - simulation
      summary: Create Run
      description: >-
        Start a simulation run for an agent.


        Simulations generate synthetic test calls against the agent's current

        configuration and grade them using its `PASS_FAIL` evals. The agent
        needs at

        least one `PASS_FAIL` eval configured before a run can start.


        Returns immediately with the run in `pending` state and
        `generated_count` of

        zero — scenario generation runs asynchronously. Poll List Runs for
        progress.
      operationId: >-
        create_simulation_run_api_v1_workspaces__workspace_id__agents__agent_id__simulation_runs_post
      parameters:
        - name: agent_id
          in: path
          required: true
          schema:
            type: integer
            description: Tuner's internal numeric ID for the agent.
            title: Agent Id
          description: Tuner's internal numeric ID for the agent.
        - name: workspace_id
          in: path
          required: true
          schema:
            type: integer
            description: Workspace ID. Find this in Workspace > General Settings.
            title: Workspace Id
          description: Workspace ID. Find this in Workspace > General Settings.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSimulationRunRequest'
      responses:
        '202':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SimulationRunResponse'
        '400':
          description: >-
            `caller_persona_id` or `simulation_profile_id` does not exist, or
            the profile belongs to a different agent.
          content:
            application/json:
              example:
                detail: >-
                  Invalid simulation_profile_id or profile does not belong to
                  this agent
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Missing or invalid API key.
          content:
            application/json:
              example:
                detail: Not authenticated
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '402':
          description: >-
            The workspace has no credits remaining, or its plan does not include
            simulations.
          content:
            application/json:
              example:
                detail: You have no credits remaining.
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: You do not have access to this workspace.
          content:
            application/json:
              example:
                detail: User does not have access to workspace 42
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Agent not found.
          content:
            application/json:
              example:
                detail: Agent with ID 17 not found
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: A simulation run is already in progress for this agent.
          content:
            application/json:
              example:
                detail: You have a simulation run in progress. Come back later.
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: >-
            The agent has no settings configured, its provider does not support
            simulations for its call direction, or it has no `PASS_FAIL` eval
            configured.
          content:
            application/json:
              example:
                detail: >-
                  Agent has no boolean (PASS_FAIL) evals. Add at least one
                  before running a simulation.
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - Bearer: []
components:
  schemas:
    CreateSimulationRunRequest:
      properties:
        functional_count:
          type: integer
          minimum: 0
          title: Functional Count
        adversarial_count:
          type: integer
          minimum: 0
          title: Adversarial Count
        max_call_duration_minutes:
          type: integer
          maximum: 12
          minimum: 1
          title: Max Call Duration Minutes
          default: 3
        selected_eval_ids:
          anyOf:
            - items:
                type: integer
              type: array
            - type: 'null'
          title: Selected Eval Ids
        selected_intent_ids:
          anyOf:
            - items:
                type: integer
              type: array
            - type: 'null'
          title: Selected Intent Ids
        caller_persona_id:
          type: integer
          title: Caller Persona Id
        simulation_profile_id:
          anyOf:
            - type: integer
              exclusiveMinimum: 0
            - type: 'null'
          title: Simulation Profile Id
      type: object
      required:
        - functional_count
        - adversarial_count
        - caller_persona_id
      title: CreateSimulationRunRequest
    SimulationRunResponse:
      properties:
        simulation_run_id:
          type: integer
          title: Simulation Run Id
        generated_count:
          type: integer
          title: Generated Count
        success:
          type: boolean
          title: Success
        caller_persona_id:
          anyOf:
            - type: integer
            - type: 'null'
          title: Caller Persona Id
        caller_persona:
          anyOf:
            - $ref: '#/components/schemas/CallerPersonaResponse'
            - type: 'null'
        simulation_profile_id:
          anyOf:
            - type: integer
            - type: 'null'
          title: Simulation Profile Id
        simulation_profile_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Simulation Profile Name
        simulation_profile_snapshot:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Simulation Profile Snapshot
      type: object
      required:
        - simulation_run_id
        - generated_count
        - success
      title: SimulationRunResponse
    ErrorResponse:
      properties:
        detail:
          type: string
          title: Detail
          description: Human-readable description of what went wrong.
      type: object
      required:
        - detail
      title: ErrorResponse
      description: Error body returned when a request fails.
    CallerPersonaResponse:
      properties:
        id:
          type: integer
          title: Id
        name:
          type: string
          title: Name
        language:
          type: string
          title: Language
        language_code:
          type: string
          title: Language Code
        accent:
          type: string
          title: Accent
        label:
          type: string
          title: Label
        country_code:
          type: string
          title: Country Code
      type: object
      required:
        - id
        - name
        - language
        - language_code
        - accent
        - label
        - country_code
      title: CallerPersonaResponse
  securitySchemes:
    Bearer:
      type: http
      description: >-
        Use Tuner API key (tr_api_...) or user session token. Find your API key
        in Workspace Settings > API Keys.
      scheme: bearer

````