# How AI generation works

AI generation is the bridge between readable test intent and executable Playwright automation.

TestVibe starts the work from the app, GitHub Actions runs it in your repository, and TestVibe shows progress as the workflow reports back.

## The Short Version

1. You select or create a feature in the Test Suite.
2. You start generation and confirm the site URL or options.
3. TestVibe starts a GitHub Actions workflow.
4. The selected AI agent works from your feature intent and target site.
5. TestVibe shows live progress, sections, steps, screenshots, and status.
6. Generated files are saved back to the repository.
7. You review the output and run the test.

## Generation Inputs

Generation uses several pieces of context:

| Input               | Why it matters                                                           |
| ------------------- | ------------------------------------------------------------------------ |
| Feature intent      | The Gherkin or test description tells the agent what behavior to create. |
| Target site URL     | The agent and generated test need to know which application to use.      |
| Website framework   | Framework context helps the agent understand app patterns.               |
| Agent and model     | Controls which AI provider performs generation.                          |
| Repository settings | Gives generation access to paths, secrets, variables, and runner labels. |
| Existing test files | Helps generation fit the repository's current structure and style.       |

## Generation Outputs

Generation can produce or update:

| Output                 | What it is                                                  |
| ---------------------- | ----------------------------------------------------------- |
| Feature file           | The `.feature` file that describes the test intent.         |
| Playwright code        | The executable `.js` or `.ts` test file.                    |
| Progress details       | Section and step status shown while generation runs.        |
| Screenshots or preview | Visual evidence captured while the agent works.             |
| Workflow links         | Links to GitHub Actions or generated output when available. |

## Live Progress

The generation view can show:

* an overview of the full generation run
* background, scenario, and scenario outline sections
* authored or generated steps
* section status such as queued, running, finalizing, or failed
* live preview screenshots when available
* links to workflow details, target site, generated paths, or traces

See [Review generation progress](/ai-generation/review-generation-progress.md).

## Where Files Are Saved

Generated output is saved in the selected repository. Feature files usually live under `Features/`, and generated Playwright code is stored beside or near the feature it belongs to.

For file management details, see [Manage generated test files](/create-tests/manage-generated-test-files.md).

## What To Do After Generation

After generation succeeds:

1. Read the generated output.
2. Confirm it matches the intended behavior.
3. Run one test before running a full group.
4. Use results to decide whether to keep, edit, or regenerate.

If generation fails, open the generation details first. The failure may be setup-related rather than a problem with the feature itself.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.testvibe.com/ai-generation/how-ai-generation-works.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
