> For the complete documentation index, see [llms.txt](https://dnotifier.gitbook.io/product-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dnotifier.gitbook.io/product-docs/workflows-and-agents/example-intent-router.md).

# Example: Intent router

A **self-contained intent router** workflow: classify the user message, then either run **semantic search** over the knowledge base or answer with a **general Q\&A** agent.

## Flow

```
  input (user question)
         │
         ▼
  intent-agent ──► { intent: "search" | "general" }
         │
    ┌────┴────┐
    ▼         ▼
 search    general-agent
 branch    branch
```

{% hint style="info" %}
Run with **`transport: "http"`**. Index help-center documents before testing the search branch.
{% endhint %}

## Prerequisites

1. DNotifier app with AI enabled
2. HTTP-connected `DNotifier` instance
3. Optional: documents indexed with `metadata: { source: "help-center" }` for `filterbySource`

## Language guides

Full copy-paste examples (agents + workflow + runner):

| Language                | Guide                                                                                                         |
| ----------------------- | ------------------------------------------------------------------------------------------------------------- |
| JavaScript / TypeScript | [javascript-typescript.md](/product-docs/workflows-and-agents/example-intent-router/javascript-typescript.md) |
| Dart / Flutter          | [dart-flutter.md](/product-docs/workflows-and-agents/example-intent-router/dart-flutter.md)                   |

## Expected results

| Input                         | Branch    | Behavior                         |
| ----------------------------- | --------- | -------------------------------- |
| "How do refunds work?"        | `search`  | `ctx.search` with knowledge base |
| "What's your favorite color?" | `general` | General agent `sendAI`           |

## Observability

Set `observability: true` to see intent classification, search, and Q\&A steps in the dashboard. `run.executionId` correlates with the dashboard run.

## Next steps

* [**Semantic search**](/product-docs/ai/semantic-search.md)
* [**Example: Multi-agent pipeline**](/product-docs/workflows-and-agents/example-multi-agent.md)
