AgentBase
Learn how to build voice AI agents using AgentBase, from basic configuration to advanced prompt engineering and voice customization.
What You’ll Learn
This chapter covers everything you need to build production-quality agents:
- AgentBase - The foundation class and its capabilities
- Static vs Dynamic - Choosing the right pattern for your use case
- Prompts & POM - Crafting effective prompts with the Prompt Object Model
- Voice & Language - Configuring voices and multi-language support
- AI Parameters - Tuning conversation behavior
- Hints - Improving speech recognition accuracy
- Call Flow - Customizing when and how calls are answered
Prerequisites
Before building agents, you should understand:
- Core concepts from Chapter 2 (SWML, SWAIG, Lifecycle)
- Basic Python class structure
- How SignalWire processes calls
Agent Architecture Overview

A Complete Agent Example
Here’s what a production agent looks like:
Chapter Contents
Key Patterns
Pattern 1: Class-Based Agent
Best for complex agents with multiple functions:
Pattern 2: Functional Agent
Quick agents for simple use cases:
Pattern 3: Multi-Agent Server
Multiple agents on one server:
Testing Your Agent
Always test before deploying:
Let’s start with understanding AgentBase in depth.
Class Overview

Constructor Parameters
Parameter Reference
Creating an Agent
Class-Based (Recommended)
Instance-Based
Declarative (PROMPT_SECTIONS)
Key Methods
Configuration Methods
Runtime Methods
Agent Lifecycle

Configuration File
Load configuration from a YAML/JSON file:
Environment Variables
AgentBase respects these environment variables:
Multi-Agent Server
Run multiple agents on one server:
Access agents at:
http://localhost:3000/supporthttp://localhost:3000/sales
Best Practices
- Use class-based agents for anything beyond simple prototypes
- Organize configuration into logical private methods
- Set explicit credentials in production via environment variables
- Use meaningful agent names for logging and debugging
- Test with swaig-test before deploying