Agents

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.

1from signalwire.prefabs import (
2 ConciergeAgent,
3 FAQBotAgent,
4 InfoGathererAgent,
5 ReceptionistAgent,
6 SurveyAgent,
7)
PrefabPurposeBuilt-in Tools
ConciergeAgentVenue information and booking assistancecheck_availability, get_directions
FAQBotAgentAnswer questions from a knowledge basesearch_faqs
InfoGathererAgentCollect answers to a series of questionsstart_questions, submit_answer
ReceptionistAgentGreet callers and transfer to departmentscollect_caller_info, transfer_call
SurveyAgentConduct automated surveys with validationvalidate_response, log_response

All prefabs can be extended by subclassing. Add custom tools with define_tool(), extra prompt sections with prompt_add_section(), and skills with add_skill().


Extending Prefabs

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

1from signalwire.prefabs import FAQBotAgent
2from signalwire.core.function_result import FunctionResult
3
4class MyFAQBot(FAQBotAgent):
5 def __init__(self):
6 super().__init__(
7 faqs=[
8 {"question": "What is your return policy?", "answer": "30-day returns."}
9 ]
10 )
11
12 self.prompt_add_section("Brand", "You represent Acme Corp.")
13 self.add_skill("datetime")
14
15 self.define_tool(
16 name="escalate",
17 description="Escalate to human agent",
18 parameters={},
19 handler=self.escalate
20 )
21
22 def escalate(self, args, raw_data):
23 return FunctionResult("Transferring to agent...").connect("+15551234567")
24
25if __name__ == "__main__":
26 MyFAQBot().run()