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

# Generate Product LLMs

<Note>
  **Internal Service** — This is not an HTTP endpoint. It's called directly by
  the `generate-all` orchestrator.
</Note>

## Purpose

Generates `/llms/{product-slug}.txt` files for discovered products and deploys them to Vercel.

Runs in **GROUP 2c** (parallel with GROUP 2a and 2b, after GROUP 1a + 1b + 1d complete).

## Shared Service

This task uses the **shared `generate_product_llms_txt` service**:

```
src/app/shared/products/generate_llms_txt.py
```

The same service is used by:

* **Onboarding** (this task - GROUP 2c)
* **Cron** (`discover-products`)
* **Cron** (`generate-product-llms-txt` standalone endpoint)

## Function Signature

```python theme={null}
async def run_generate_product_llms_txt(
    url: str,
    org_slug: str,
    business_name: str,
    products: list,
    pages: list
) -> StepResult
```

## Parameters

| Parameter       | Type   | Description                                                   |
| --------------- | ------ | ------------------------------------------------------------- |
| `url`           | `str`  | The business website URL                                      |
| `org_slug`      | `str`  | The Clerk organization slug                                   |
| `business_name` | `str`  | The business name                                             |
| `products`      | `list` | Products from GROUP 1d \[{name, entity_id, source_urls, url}] |
| `pages`         | `list` | Pre-scraped pages from GROUP 1b                               |

## Returns

```json theme={null}
{
  "name": "generate_product_llms_txt",
  "status": "success",
  "data": {
    "files_generated": 3,
    "files_deployed": 3,
    "products": ["Product A", "Product B", "Product C"]
  }
}
```

## Execution Flow

```mermaid theme={null}
flowchart TD
    A[GROUP 1d: Discover Products] --> B{Products found?}
    B -->|Yes| C[GROUP 2b: Product Prompts]
    B -->|Yes| D[GROUP 2c: Generate Product LLMs]
    C --> E[Run in parallel]
    D --> E
    B -->|No| F[Skip GROUP 2b and 2c]
```

## Product LLMs Architecture

| File          | Location                   | In Sitemap | In index.js |
| ------------- | -------------------------- | ---------- | ----------- |
| Root llms.txt | `/llms.txt`                | Yes        | Yes         |
| Product llms  | `/llms/{product-slug}.txt` | Yes        | **No**      |

This architecture scales to thousands of products:

* Root `llms.txt` stays small (\~3KB)
* Each product gets its own file (\~1-2KB)
* Product files are fetched on-demand for AI article generation

## Code Location

```
src/app/shared/products/
├── __init__.py
├── discover.py           # Shared discover_products service
└── generate_llms_txt.py  # Shared generate_product_llms_txt service

src/app/apis/onboarding/generate_all/tasks/
└── product_llms.py       # run_generate_product_llms_txt task wrapper
```

## Error Handling

```json theme={null}
{
  "name": "generate_product_llms_txt",
  "status": "error",
  "error": "AI site project_name not found"
}
```

If product llms generation fails, onboarding continues - products are still saved and prompts are still generated.
