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.

from 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

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()