Prefabs

View as MarkdownOpen in Claude

Prefabs are ready-to-use agent classes that implement common conversational patterns. Each prefab extends AgentBase, so you can customize them with additional prompt sections, tools, skills, and languages. Use them directly for rapid prototyping or subclass them for production use.

1import {
2 ConciergeAgent,
3 FAQBotAgent,
4 InfoGathererAgent,
5 ReceptionistAgent,
6 SurveyAgent,
7} from '@signalwire/sdk';
PrefabPurposeBuilt-in Tools
ConciergeAgentVenue concierge with services, amenities, and hourscheck_availability, get_directions
FAQBotAgentAnswer questions using keyword matchingsearch_faq, escalate (optional)
InfoGathererAgentCollect answers to a list of questionsstart_questions, submit_answer
ReceptionistAgentFront-desk check-in, directory, and transferscollect_caller_info, transfer_call, check_in_visitor (optional)
SurveyAgentConduct surveys with branching and scoringvalidate_response, log_response, answer_question, get_current_question, get_survey_progress

Each prefab also has a corresponding factory function (e.g., createConciergeAgent()) that creates and returns a configured instance.

All prefabs can be extended by subclassing. Add custom tools with defineTool(), extra prompt sections with promptAddSection(), and skills with addSkill().


Extending Prefabs

All prefabs inherit from AgentBase, so you can add custom tools, prompt sections, and skills:

1import { FAQBotAgent } from '@signalwire/sdk';
2import { FunctionResult } from '@signalwire/sdk';
3
4class MyFAQBot extends FAQBotAgent {
5 protected override defineTools(): void {
6 super.defineTools();
7
8 this.defineTool({
9 name: 'escalate_to_human',
10 description: 'Escalate to a human agent',
11 parameters: { type: 'object', properties: {} },
12 handler: () => {
13 const result = new FunctionResult('Transferring you to an agent now.');
14 result.connect('+15551234567');
15 return result;
16 },
17 });
18 }
19}
20
21const agent = new MyFAQBot({
22 faqs: [
23 { question: 'What is your return policy?', answer: '30-day returns.' },
24 ],
25});
26
27agent.promptAddSection('Brand', { body: 'You represent Acme Corp.' });
28agent.addSkill('datetime');
29
30agent.serve();