---
title: "Generate evaluator scenarios"
method: POST
path: "/ai/tests/test_framework/v1/scenarios/generate-bg"
tags: ["AI Tests"]
---

# Generate evaluator scenarios

`POST /ai/tests/test_framework/v1/scenarios/generate-bg`

## Request

- Base URL: `https://api.telnyx.com/v2`
- URL: `https://api.telnyx.com/v2/ai/tests/test_framework/v1/scenarios/generate-bg`
- Auth: HTTP bearer

Starts background generation of evaluator scenarios for a test agent. Returns a progress ID to poll with the generate-scenarios-progress endpoint.

## Request body

- GenerateEvaluatorScenariosRequest
  - `num_scenarios` integer, required: How many scenarios to generate.
  - `agent_id` integer
  - `extra_instructions` string: Optional guidance steering scenario generation.
  - `tags` string[]
  - `generate_expected_outcomes` boolean: Whether to generate expected-outcome prompts for the scenarios.
  - `first_message` string
  - `personalities` integer[]
  - `test_profile` integer
  - `scenario_type` 'workflow' | 'red_teaming_voice' | 'red_teaming_text': Type of scenario to generate.
  - `inbound_phone_number` integer, nullable
  - `tool_ids` string[]
  - `folder_path` string, nullable

## Response `200`

Scenario generation initiated.

- ScenarioGenerationResponse
  - `progress_id` string, required: Identifier to poll generation progress with.

## Other responses

- `400`: Bad Request. The AI Tests service rejected the request.
- `401`: Unauthorized. Missing or invalid API key.
- `404`: Not Found. The requested resource does not exist or is not enabled for your account.
- `422`: Unprocessable Entity. A validation error occurred.
- `429`: Too Many Requests. The AI Tests service rate-limited the request.
- `503`: Service Unavailable. The AI Tests service is unavailable.

## Changes

> 152 revisions in range; 1 not diffed.

- **2026-10-22** `09b2e45a88da`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/team-telnyx/apis/telnyx-api-2/changes/ai/tests/test_framework/v1/scenarios/generate-bg/post.md)

---

[API](https://skmtc.dev/team-telnyx/apis/telnyx-api-2.md) - [All operations](https://skmtc.dev/team-telnyx/apis/telnyx-api-2/llms.txt) - [OpenAPI document](https://skmtc.dev/team-telnyx/apis/telnyx-api-2/revisions/f82938f53ff4?raw)
