# The analysis

The analysis is the run that reads your app's front-end code and writes a Web Agent's modules and actions, along with how the app authenticates and navigates. It starts when you [create the agent](https://docs.faustine.ai/web-agents/create-a-web-agent/) and has its own page, which you can leave and return to while it runs.

## How it works

The analysis runs on your workspace's model provider, in four stages. The second stage reads the structure of the whole codebase. After it, you decide which parts of the app are analyzed in depth, so you choose what the longest stage covers before it starts.

The result goes into the agent's draft. Nothing reaches your site until a version is published.

## Stages

| Stage | What happens |
| --- | --- |
| **Clone the repository** | Faustine downloads the branch you connected. For a ZIP, the stage is **Unpack the uploaded code**. |
| **Analyze the architecture & modules** | Faustine maps the routes, components and dependencies, and finds the app's modules. It also works out the authentication and the navigation. The stage takes 3 to 10 minutes, depending on the size of the codebase. |
| **Choose what to analyze** | The run waits for you. You select the modules, then Faustine writes the actions of each one. See [Choose what to analyze](https://docs.faustine.ai/web-agents/choose-what-to-analyze/). |
| **Summary** | The page lists the key findings and, for each module, its action count, time and estimated cost. |

While a stage runs, the page shows a log of what the analysis is reading. **View full log** opens the whole history of the run.

## What it produces

| Output | What it is | Where you see it |
| --- | --- | --- |
| Modules | The feature areas of the app, such as Contacts or Deals in a CRM. | The **Actions** tab, one group for each module |
| Actions | For each module, what a user can do, written as code that calls your app's API. | The **Actions** tab. See [Actions](https://docs.faustine.ai/web-agents/actions/) |
| Authentication | How the app keeps a user signed in, and the code that sends that session with each request. | **Actions** > **Authentication**. See [Authentication](https://docs.faustine.ai/web-agents/authentication/) |
| Navigation | The app's router and its routes. | **Actions** > **Navigation**. See [Navigation](https://docs.faustine.ai/web-agents/navigation/) |
| Variables | Configuration values the code reads, such as the API base URL. | The **Variables** tab. See [Set variables for each environment](https://docs.faustine.ai/web-agents/variables/) |
| Persona | A first description of the app, the agent's role and its users. | The **Assistant** tab. See [Write the agent's persona](https://docs.faustine.ai/web-agents/persona/) |

For a Next.js app the summary also has a **Data surface** section. It sorts what the app reads and writes into **Reachable now**, **Reachable with the adapter** and **Not reachable**. See [The Faustine adapter for Next.js](https://docs.faustine.ai/web-agents/nextjs-adapter/).

## What the analysis reads

The analysis generates actions from one repository: the one you connected, at the branch and folder you chose. Three more inputs give it context.

- Analysis notes, the free text you entered under **Anything we should know about this app?**. The analysis reads them before the code.
- Reference repositories, such as the app's backend.
- API docs, such as an OpenAPI file.

Nothing is generated from the reference material. When it disagrees with the app's code, the code wins. See [Add reference repositories and API docs](https://docs.faustine.ai/web-agents/reference-repositories/).

## Cost

Your model provider bills you for the tokens the analysis uses. The amounts on the analysis page are estimates of that bill.

The architecture stage has a cost of its own, and each module you select adds to it. The **Analysis breakdown** in the summary lists the time and cost of the architecture stage and of each module, with a total.

## Stop, resume and retry

| Situation | What you can do |
| --- | --- |
| The run is in progress | Select **Cancel**. Modules that already finished stay analyzed, and work in progress is discarded. You cannot cancel once the results are being applied. |
| The model provider asks Faustine to slow down | Nothing. The run waits and resumes on its own. |
| The run was interrupted | Select **Resume analysis**. Everything analyzed so far is kept. |
| The run failed | Select **Resume from checkpoint** to continue, or start a new analysis. |
| Some modules failed and the rest finished | In the summary, select **Retry failed modules**. Only those modules run again. |
| The first analysis of a new agent failed or was cancelled | Start it again, or select **Discard assistant** to delete the agent. |

A failed or cancelled re-analysis leaves the published version as it was.

## After the first analysis

Select **Continue to setup** in the summary. The **Set up your assistant** wizard reviews the persona, the actions, web search, the knowledge base, the look and the chat model. **Launch** at the end publishes the first version.

When the code changes, an update brings the agent in line with the new commits without running the whole analysis again. See [Keep the agent up to date](https://docs.faustine.ai/web-agents/keep-up-to-date/).

## Next steps

- [Choose what to analyze](https://docs.faustine.ai/web-agents/choose-what-to-analyze/): select the modules that become actions.
- [Actions](https://docs.faustine.ai/web-agents/actions/): review what the analysis wrote.
- [Keep the agent up to date](https://docs.faustine.ai/web-agents/keep-up-to-date/): updates, re-analysis and new uploads.
- [Add reference repositories and API docs](https://docs.faustine.ai/web-agents/reference-repositories/): give the analysis more to read.
