---
title: Tutorial — Customer Support Bot
description: End-to-end walkthrough is in progress. This page sketches the architecture and points at the building blocks you can wire up today.
---

# Tutorial: Customer Support Bot

A full code walkthrough for this tutorial is still being written. In the meantime this page describes the shape of the system and links to the framework pieces you'd compose to build it. If you start the implementation and hit something missing, [open a discussion](https://github.com/TnsAI-Framework/TnsAI/discussions) — concrete questions accelerate the write-up.

## Goal

A support agent that:

1. Answers product questions from a knowledge base via RAG.
2. Creates tickets through a webhook when it can't find a confident answer.
3. Escalates to a human reviewer when the user is frustrated.

## Architecture

```text
User message ──▶ SupportRole
                    │
                    ├──▶ @Retrieval(knowledge="support_kb")   ◀── KnowledgeBase (RAG)
                    │
                    ├──▶ @Tool create_ticket(...)             ◀── HTTP webhook
                    │
                    └──▶ @Tool escalate(...)                  ◀── HumanReviewSink
                                                                  (sentiment-aware)
```

## Building blocks you'd compose

- **Knowledge base** — ingest your support docs as a `KnowledgeBase` and consume it from the role with `@KnowledgeSource` + `@Retrieval`. See [RAG guide](../capabilities/rag/index.md).
- **Tools** — define `create_ticket` and `escalate` as `@Tool`-annotated methods on a POJO; register via `AgentBuilder.toolPojos(...)`. See [Tools guide](../capabilities/tools/index.md).
- **Sentiment-aware escalation** — wrap the inbound message in a guardrail (`@InputGuardrail`) or pre-step that runs a sentiment classifier and short-circuits to `escalate` when frustration is detected.
- **Observability** — enable tracing with `@Traced` on action methods so each ticket / escalation lands in your trace exporter.

## Related

- [Guides: RAG](../capabilities/rag/index.md)
- [Guides: Tools](../capabilities/tools/index.md)
