Prefabs
Prefab agents are pre-configured agent implementations designed for specific use cases. They provide ready-to-use functionality with customization options, saving development time and ensuring consistent patterns.
Built-in Prefabs
The SDK includes several built-in prefab agents:
InfoGathererAgent
Collects structured information from users:
from signalwire_agents.prefabs import InfoGathererAgent
agent = InfoGathererAgent(
fields=[
{"name": "full_name", "prompt": "What is your full name?"},
{"name": "email", "prompt": "What is your email address?",
"validation": r"^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$"},
{"name": "reason", "prompt": "How can I help you today?"}
],
confirmation_template="Thanks {full_name}, I'll help you with {reason}. I'll send a confirmation to {email}.",
name="info-gatherer",
route="/info-gatherer"
)
agent.serve(host="0.0.0.0", port=8000)
FAQBotAgent
Answers questions based on a knowledge base:
from signalwire_agents.prefabs import FAQBotAgent
agent = FAQBotAgent(
knowledge_base_path="./docs",
personality="I'm a product documentation assistant.",
citation_style="inline",
name="knowledge-base",
route="/knowledge-base"
)
agent.serve(host="0.0.0.0", port=8000)
ConciergeAgent
Routes users to specialized agents:
from signalwire_agents.prefabs import ConciergeAgent
agent = ConciergeAgent(
routing_map={
"technical_support": {
"url": "http://tech-support-agent:8001",
"criteria": ["error", "broken", "not working"]
},
"sales": {
"url": "http://sales-agent:8002",
"criteria": ["pricing", "purchase", "subscribe"]
}
},
greeting="Welcome to SignalWire. How can I help you today?",
name="concierge",
route="/concierge"
)
agent.serve(host="0.0.0.0", port=8000)
SurveyAgent
Conducts structured surveys with different question types:
from signalwire_agents.prefabs import SurveyAgent
agent = SurveyAgent(
survey_name="Customer Satisfaction",
introduction="We'd like to know about your recent experience with our product.",
questions=[
{
"id": "satisfaction",
"text": "How satisfied are you with our product?",
"type": "rating",
"scale": 5,
"labels": {
"1": "Very dissatisfied",
"5": "Very satisfied"
}
},
{
"id": "feedback",
"text": "Do you have any specific feedback about how we can improve?",
"type": "text"
}
],
name="satisfaction-survey",
route="/survey"
)
agent.serve(host="0.0.0.0", port=8000)
ReceptionistAgent
Handles call routing and department transfers:
from signalwire_agents.prefabs import ReceptionistAgent
agent = ReceptionistAgent(
departments=[
{"name": "sales", "description": "For product inquiries and pricing", "number": "+15551235555"},
{"name": "support", "description": "For technical assistance", "number": "+15551236666"},
{"name": "billing", "description": "For payment and invoice questions", "number": "+15551237777"}
],
greeting="Thank you for calling ACME Corp. How may I direct your call?",
voice="rime.spore:mistv2",
name="acme-receptionist",
route="/reception"
)
agent.serve(host="0.0.0.0", port=8000)