***

title: FAQBotAgent
slug: /reference/python/agents/prefabs/faq-bot-agent
description: Answers frequently asked questions by matching user queries against a provided knowledge base.
---------------------

For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

[agentbase]: /docs/server-sdks/reference/python/agents/agent-base

[skill]: /docs/server-sdks/reference/python/agents/skills#native_vector_search

Answers frequently asked questions by matching user queries against a provided knowledge base.
Optionally suggests related questions from the database.

```python
from signalwire.prefabs import FAQBotAgent
```

<ParamField path="faqs" type="list[dict[str, str]]" required={true} toc={true}>
  List of FAQ items. Each dict must have `question` and `answer` keys; an optional
  `categories` key (list of strings) enables category-based filtering.
</ParamField>

<ParamField path="suggest_related" type="bool" default="True" toc={true}>
  When `True`, the agent suggests related questions from the FAQ database after answering.
</ParamField>

<ParamField path="persona" type="str" toc={true}>
  Custom personality description for the bot. Defaults to a generic helpful FAQ bot persona.
</ParamField>

<ParamField path="name" type="str" default="faq_bot" toc={true}>
  Agent name for identification and logging.
</ParamField>

<ParamField path="route" type="str" default="/faq" toc={true}>
  HTTP route for this agent.
</ParamField>

### Built-in Tools

| Tool          | Description                      | Parameters                                |
| ------------- | -------------------------------- | ----------------------------------------- |
| `search_faqs` | Search FAQs by query or category | `query` (str), `category` (str, optional) |

<Tip>
  FAQBot works best with up to 50 FAQs. For larger knowledge bases, use the
  `native_vector_search` [skill][skill] instead.
</Tip>

### Example

```python
from signalwire.prefabs import FAQBotAgent

agent = FAQBotAgent(
    faqs=[
        {
            "question": "What is the warranty period?",
            "answer": "All products come with a 2-year warranty.",
            "categories": ["warranty", "products"]
        },
        {
            "question": "How do I return a product?",
            "answer": "Start a return within 30 days at returns.example.com.",
            "categories": ["returns", "products"]
        },
        {
            "question": "Do you ship internationally?",
            "answer": "Yes, we ship to over 50 countries.",
            "categories": ["shipping"]
        }
    ],
    suggest_related=True,
    persona="You are a helpful product specialist for TechGadgets Inc."
)

if __name__ == "__main__":
    agent.run()
```