> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes. # FAQBotAgent > An FAQ bot agent that answers frequently asked questions by matching user queries against a provided knowledge base using word-overlap similarity scoring. [agentbase]: /docs/server-sdks/reference/typescript/agents/agent-base [functionresult]: /docs/server-sdks/reference/typescript/agents/function-result Answers frequently asked questions by matching user queries against a provided knowledge base using word-overlap similarity scoring. Optionally escalates to a live agent when no match is found. ```typescript {3} import { FAQBotAgent } from '@signalwire/sdk'; const agent = new FAQBotAgent({ /* FAQBotConfig */ }); ``` ## FAQBotConfig **`faqs`** `FAQEntry[]` — required List of FAQ entries for the knowledge base. Each `FAQEntry` object has: * `question` (string, required) -- The representative question text. * `answer` (string, required) -- The answer to provide when matched. * `keywords` (string\[]) -- Additional keywords to boost matching accuracy. * `categories` (string\[]) -- Taxonomy categories used for filtering and hints. --- **`name`** `string` — default: "faq\_bot" Agent display name. --- **`route`** `string` — default: "/faq" HTTP route for the agent. --- **`suggestRelated`** `boolean` — default: true Whether to suggest related questions alongside a match. --- **`persona`** `string` Custom personality description injected into the agent's "Personality" prompt section. Defaults to a helpful-FAQ-bot persona. --- **`threshold`** `number` — default: 0.5 Minimum match score (0 to 1) for an FAQ to be considered a match. --- **`escalationMessage`** `string` Message spoken when no FAQ matches. Defaults to an apology offering to transfer. --- **`escalationNumber`** `string` Phone number to transfer to on escalation. If not set, the `escalate` tool is not registered. --- **`agentOptions`** `Partial` Additional [`AgentBase`][agentbase] options forwarded to the constructor. --- ## Built-in Tools | Tool | Description | Parameters | | ------------ | ------------------------------------------------------------------------------------ | --------------------------- | | `search_faq` | Search the FAQ knowledge base and return the best match with a confidence score | `query` (string) | | `escalate` | Transfer the caller to a live agent (only registered when `escalationNumber` is set) | `reason` (string, optional) | > **Tip** > > FAQBot works best with up to \~50 FAQs. For larger knowledge bases, use the > `native_vector_search` skill instead. ## Example ```typescript {3} import { FAQBotAgent } from '@signalwire/sdk'; const agent = new FAQBotAgent({ faqs: [ { question: 'What is the warranty period?', answer: 'All products come with a 2-year warranty.', keywords: ['warranty', 'guarantee'], }, { question: 'How do I return a product?', answer: 'Start a return within 30 days at returns.example.com.', keywords: ['return', 'refund'], }, { question: 'Do you ship internationally?', answer: 'Yes, we ship to over 50 countries.', keywords: ['shipping', 'international'], }, ], threshold: 0.4, escalationNumber: '+15559999999', escalationMessage: 'Let me transfer you to a specialist who can help.', }); agent.serve(); ``` ### createFAQBotAgent ```typescript {3} import { createFAQBotAgent } from '@signalwire/sdk'; const agent = createFAQBotAgent({ faqs: [ { question: 'What are your hours?', answer: 'We are open 9 AM to 5 PM.' }, ], }); ``` > An FAQ bot agent that answers frequently asked questions by matching user queries against a provided knowledge base using word-overlap similarity scoring.