---
title: "Use Case 12: Copilot + Custom Data lookup"
description: "Optional: a separate Copilot bot with categorizer and lookup in a Custom Data catalog."
level: optional
use_case: 12
prerequisites:
  - ../capstone/use-case-13-integrated-bot.md
  - ../basic/use-case-07-custom-data.md
  - ../concepts.md#categorizer-pattern
---

# Use Case 12: Copilot + Custom Data lookup

> **Optional track** — not required to complete the basic, advanced, or capstone level. Take it after [Use Case 13](/en/learn/implementer/training/capstone/use-case-13-integrated-bot.md) or if your project uses Copilot.

## Required permissions and access

| Module / setting | Why you need it |
|------------------|-----------------|
| **Scenario Builder** | Main bot (routing) + Copilot bot |
| **Fast Line Pro** | Categorizer for the catalog |
| **Custom Data** | `products` model and seed data |
| **Settings → Bots** | Second bot for Copilot (or process sections) |
| **Runs / Chat preview** | Self-check lookup found / not found |

## Business context

The customer writes free text (“I want a warrior from the North”). The Copilot bot classifies the request, looks up a record in Custom Data, and returns the result. The main customer bot only **routes** (“Catalog” button), and the AI-heavy logic lives in Copilot.

→ [Copilot overview](/en/learn/copilot/copilot-overview.md)

## Expected result

- A separate **Copilot bot** (or process section) with categorizer
- Custom Data `products`: fields name, category, faction, price
- Categorizer → filters → lookup in CD → MessageKeyboard with the result
- Edges **found** / **not found** / **error** — all handled
- Understanding: categorizer in Copilot, not in the main client bot

## Architecture

```text
[Main training bot]
   MessageKeyboard "Catalog" → routing to Copilot (call / process)

[Copilot bot]
   WaitForInput (query) → action_fastline_pro (categorizer)
      → Router (valid category/faction)
      → custom_modules__get / filter
         ├─ found    → MessageKeyboard (name, price)
         ├─ not_found → "Not found" + optionally handoff
         └─ error    → error message
```

| Bot type | Role |
|----------|------|
| **Main** | Customer writes in the channel; menu buttons |
| **Copilot** | AI + CD lookup |
| **Macro (Use Case 8)** | Initiator is the operator, not the customer |

## Step-by-step implementation

### Step 0. Custom Data — products model

1. **Custom Data** → create the `products` model.
2. Fields: `name`, `category`, `faction`, `price`.
3. Import the seed from [products-training.csv](/content/en/learn/implementer/training/scenarios/seed/products-training.csv) or add 5–10 rows manually.

| Field | Example |
|-------|---------|
| name | Geralt of Rivia |
| category | warrior |
| faction | north |
| price | 120 |

→ [Custom Data set](/en/customdata/how-to/use-custom-modules-set.md)

The model **alias** `products` must **exactly** match `module_name` in the lookup action.

---

### Step 1. Copilot bot and categorizer

1. **Settings → Bots** → create a bot “Training Copilot” (or use process sections per Copilot docs).
2. **Fast Line Pro** → Chatbot “Training Catalog Categorizer”.
3. Prompt: section **Use Case 12 (products catalog)** from [categorizer-training.txt](/content/en/learn/implementer/training/scenarios/prompts/categorizer-training.txt).

Categorizer output — JSON, for example: `{"faction":"north","category":"warrior"}`.

Test in Fast Line Pro separately before the scenario.

---

### Step 2. WaitForInput — customer query

| Parameter | Value |
|-----------|-------|
| messageText | “Describe who you are looking for (class, faction)” |
| outputVariable | `catalog_query` |

**Edges:** → `action_fastline_pro`.

---

### Step 3. Action — categorizer

| node_params | Value |
|-------------|-------|
| `agent_name` | `Training Catalog Categorizer` |
| `user_input` | `{{catalog_query}}` |
| `save_response` | `catalog_filters` |

**Edges:** main → parse / Router; **fallback** → “Please clarify your query.”

---

### Step 4. Lookup in Custom Data

Use `custom_modules__get` or a filter action with parameters for your instance:

| node_params (example) | Value |
|-----------------------|-------|
| `module_name` | `products` |
| filters | category, faction from categorizer |

**Edges (required):**

| Edge | Where |
|------|-------|
| **success** / found | MessageKeyboard: `{{name}} — {{price}}` |
| **not found** | “Nothing found for your query” |
| **error** | “Search error. Try again later.” |

---

### Step 5. Routing from the main bot

In the **main** training bot (capstone):

| Button | Action |
|--------|--------|
| “Catalog” | Call Copilot process / call_node per [Copilot overview](/en/learn/copilot/copilot-overview.md) |

The main bot **does not** contain the categorizer — only routing.

---

## Troubleshooting

| Symptom | What to check |
|---------|----------------|
| “Where is the categorizer?” | In the Copilot bot, not in the client bot |
| Empty lookup | `module_name` = CD alias; filters match the seed CSV |
| Categorizer JSON does not parse | Prompt — one JSON line; check Fast Line Pro |
| Copilot is not called | Routing from the main bot; process / bot name in call |

## Self-check (Runs)

- [ ] Seed CSV imported; records visible in Custom Data UI
- [ ] Categorizer: “warrior from the North” → faction north, category warrior
- [ ] Lookup: Geralt found (or another row from the CSV)
- [ ] Not found: query outside the catalog → message to the customer
- [ ] Error edge → message, not silence
- [ ] Main bot: “Catalog” button → Copilot flow

## Independent task

Add a handoff edge to an operator if not found happens **twice** in a row (counter in state or constants).

## Reference links

- [Copilot overview](/en/learn/copilot/copilot-overview.md)
- [Categorizer prompt](/content/en/learn/implementer/training/scenarios/prompts/categorizer-training.txt)
- [Products seed CSV](/content/en/learn/implementer/training/scenarios/seed/products-training.csv)
- [Custom Data set](/en/customdata/how-to/use-custom-modules-set.md)
- [Categorizer pattern](/en/learn/implementer/training/concepts.md#categorizer-pattern)

**Related optional:** [AI catalog](/en/learn/implementer/training/optional/use-case-ai-catalog-search.md) — lookup in the **same** bot without Copilot.
