AgentsPrefabs

FAQBotAgent

View as MarkdownOpen in Claude

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

1from signalwire.prefabs import FAQBotAgent
faqs
list[dict[str, str]]Required

List of FAQ items. Each dict must have question and answer keys; an optional categories key (list of strings) enables category-based filtering.

boolDefaults to True

When True, the agent suggests related questions from the FAQ database after answering.

persona
str

Custom personality description for the bot. Defaults to a generic helpful FAQ bot persona.

name
strDefaults to faq_bot

Agent name for identification and logging.

route
strDefaults to /faq

HTTP route for this agent.

Built-in Tools

ToolDescriptionParameters
search_faqsSearch FAQs by query or categoryquery (str), category (str, optional)

FAQBot works best with up to 50 FAQs. For larger knowledge bases, use the native_vector_search skill instead.

Example

1from signalwire.prefabs import FAQBotAgent
2
3agent = FAQBotAgent(
4 faqs=[
5 {
6 "question": "What is the warranty period?",
7 "answer": "All products come with a 2-year warranty.",
8 "categories": ["warranty", "products"]
9 },
10 {
11 "question": "How do I return a product?",
12 "answer": "Start a return within 30 days at returns.example.com.",
13 "categories": ["returns", "products"]
14 },
15 {
16 "question": "Do you ship internationally?",
17 "answer": "Yes, we ship to over 50 countries.",
18 "categories": ["shipping"]
19 }
20 ],
21 suggest_related=True,
22 persona="You are a helpful product specialist for TechGadgets Inc."
23)
24
25if __name__ == "__main__":
26 agent.run()