Lesson 1: Introduction to SignalWire Agents 🔗 ↑ TOC
Welcome to your journey of building Fred, a friendly Wikipedia-powered AI assistant! In this first lesson, we'll explore what SignalWire AI Agents are and why they're powerful for building voice applications.
Table of Contents 🔗 ↑ TOC
- What is SignalWire?
- Understanding AI Agents
- The SDK Architecture
- What We're Building
- Key Concepts
What is SignalWire? 🔗 ↑ TOC
SignalWire is a communications platform that enables developers to build voice, video, and messaging applications. Think of it as the infrastructure that connects your AI agent to phone calls, allowing your bot to have real conversations with people.
Key Features:
- Voice calling capabilities
- Real-time communication
- AI integration
- Scalable infrastructure
Understanding AI Agents 🔗 ↑ TOC
An AI Agent in the SignalWire context is a Python application that:
- Listens for incoming calls via HTTP endpoints
- Generates SWML documents (SignalWire Markup Language) that define behavior
- Processes voice input and generates appropriate responses
- Executes functions based on user requests
The Communication Flow 🔗 ↑ TOC
User calls → SignalWire Platform → Your Agent → SWML Response → AI Conversation
The SDK Architecture 🔗 ↑ TOC
The SignalWire AI Agents SDK provides a clean abstraction layer:
from signalwire_agents import AgentBase
class MyAgent(AgentBase):
def __init__(self):
super().__init__(name="My Agent", route="/agent")
Core Components:
- AgentBase Class: The foundation all agents inherit from
- Skills System: Modular capabilities you can add with one line
- SWAIG Functions: Tools the AI can call during conversations
- Prompt Object Model (POM): Structured way to define agent behavior
What We're Building 🔗 ↑ TOC
Fred is a voice-enabled Wikipedia assistant that demonstrates:
- Personality Design: Making AI agents feel human and approachable
- Skill Integration: Using the Wikipedia search skill
- Custom Functions: Adding unique capabilities
- Voice Configuration: Setting up natural-sounding speech
Fred's Capabilities 🔗 ↑ TOC
By the end of this tutorial, Fred will be able to:
- Search Wikipedia for any topic
- Share fun facts about Wikipedia itself
- Engage naturally in educational conversations
- Handle voice calls through SignalWire
Key Concepts 🔗 ↑ TOC
Before we start coding, let's understand these essential concepts:
1. SWML (SignalWire Markup Language) 🔗 ↑ TOC
SWML is a JSON document that tells SignalWire how your agent should behave. It includes:
- AI personality and instructions
- Available functions
- Voice settings
- Language configuration
2. SWAIG (SignalWire AI Gateway) 🔗 ↑ TOC
SWAIG enables your agent to execute functions during conversations. When a user asks Fred to search Wikipedia, SWAIG handles the function call and returns results.
Skills are pre-built, reusable modules that add capabilities to your agent. Instead of writing Wikipedia search from scratch, we'll use the existing skill:
agent.add_skill("wikipedia_search")
4. HTTP Endpoints 🔗 ↑ TOC
Your agent exposes HTTP endpoints that SignalWire calls:
GET /agent
- Returns the SWML configuration
POST /agent/swaig/
- Handles function execution
5. Authentication 🔗 ↑ TOC
Agents use HTTP Basic Authentication for security. The SDK handles this automatically, generating credentials or using environment variables.
Why This Architecture? 🔗 ↑ TOC
Benefits:
- Separation of Concerns: Your code focuses on logic, not telephony
- Scalability: Agents can handle multiple concurrent calls
- Flexibility: Easy to add new capabilities
- Testing: Can test locally without phone infrastructure
Now that you understand the concepts, let's set up your development environment!
➡️ Continue to Lesson 2: Setting Up Your Environment
Review Questions:
- What is the purpose of SWML?
- How do skills enhance an agent's capabilities?
- What are the two main HTTP endpoints an agent exposes?
Answers:
- SWML defines how the agent behaves during calls (personality, functions, voice settings)
- Skills provide pre-built, tested functionality that can be added with one line of code
- GET endpoint for SWML configuration, POST endpoint for SWAIG function execution
← Back to Overview | Next: Environment Setup →