Let's get your development environment ready to build Fred! This lesson covers installing the SignalWire AI Agents SDK and verifying everything works correctly.
Before we begin, ensure you have:
Python 3.7+
Check your Python version:
python3 --version
# or
python --version
You should see something like:
Python 3.8.10
pip (Python Package Manager)
Verify pip is installed:
pip3 --version
# or
pip --version
Virtual Environment (Recommended)
It's best practice to use a virtual environment:
# Create a virtual environment
python3 -m venv fred-env
# Activate it
# On Linux/Mac:
source fred-env/bin/activate
# On Windows:
fred-env\Scripts\activate
Now let's install the SignalWire AI Agents SDK:
pip install signalwire-agents
This installs the core SDK with all required dependencies.
The installation includes:
signalwire-agents
- The main SDKfastapi
- Web framework for HTTP endpointsuvicorn
- ASGI server to run your agentpydantic
- Data validationrequests
- HTTP client for API callsLet's verify everything installed correctly:
Create a test file called test_install.py
:
#!/usr/bin/env python3
"""Test SignalWire SDK installation"""
try:
from signalwire_agents import AgentBase
print("✅ SignalWire SDK imported successfully!")
# Check version
import signalwire_agents
print(f" Version: {signalwire_agents.__version__}")
except ImportError as e:
print(f"❌ Import failed: {e}")
print(" Please run: pip install signalwire-agents")
Run it:
python test_install.py
Expected output:
✅ SignalWire SDK imported successfully!
Version: 0.1.23
Let's create a minimal agent to ensure everything works:
#!/usr/bin/env python3
"""Minimal test agent"""
from signalwire_agents import AgentBase
# Create a minimal agent
agent = AgentBase("Test Agent", route="/test")
# If this runs without errors, installation is good!
print("✅ Basic agent creation works!")
print(f" Agent name: {agent.get_name()}")
print(f" Agent route: /test")
The SDK has several dependency categories:
Always Installed:
fastapi
- Web frameworkuvicorn
- ASGI serverpydantic
- Data validationPyYAML
- YAML supportrequests
- HTTP requestsbeautifulsoup4
- HTML parsing (for web search skill)Search Features (we won't need these for Fred):
# If you wanted search features:
pip install signalwire-agents[search]
Development Tools (optional but helpful):
# For testing
pip install pytest
# For code formatting
pip install black
# For linting
pip install pylint
Let's set up a clean project structure for Fred:
# Create Fred's directory
mkdir fred-bot
cd fred-bot
# Create subdirectories
mkdir logs
mkdir config
fred-bot/
├── fred.py # Main agent code
├── fred.sh # Management script
├── requirements.txt # Dependencies
├── config/ # Configuration files
├── logs/ # Log files
└── README.md # Documentation
Save your dependencies for easy reinstallation:
# Generate requirements file
pip freeze > requirements.txt
Or create a minimal one:
signalwire-agents>=0.1.23
The SDK uses several optional environment variables:
# Set fixed credentials (optional)
export SWML_BASIC_AUTH_USER="fred_user"
export SWML_BASIC_AUTH_PASSWORD="fred_pass123"
# Or let the SDK generate random ones
# If behind a proxy or using ngrok
export SWML_PROXY_URL_BASE="https://your-domain.com"
Let's create a simple test to ensure everything is ready:
#!/usr/bin/env python3
"""Setup verification script"""
import sys
def check_setup():
"""Verify environment is ready for Fred"""
print("🔍 Checking Fred's environment...\n")
# Check Python version
python_version = sys.version_info
if python_version >= (3, 7):
print(f"✅ Python {python_version.major}.{python_version.minor} - Good!")
else:
print(f"❌ Python {python_version.major}.{python_version.minor} - Need 3.7+")
return False
# Check imports
try:
import signalwire_agents
print("✅ SignalWire SDK - Installed")
except ImportError:
print("❌ SignalWire SDK - Not installed")
return False
try:
import fastapi
print("✅ FastAPI - Installed")
except ImportError:
print("❌ FastAPI - Not installed")
return False
try:
import uvicorn
print("✅ Uvicorn - Installed")
except ImportError:
print("❌ Uvicorn - Not installed")
return False
print("\n🎉 Environment is ready to build Fred!")
return True
if __name__ == "__main__":
if not check_setup():
print("\n⚠️ Please install missing dependencies:")
print(" pip install signalwire-agents")
sys.exit(1)
# Use --user flag
pip install --user signalwire-agents
# Or use sudo (less recommended)
sudo pip install signalwire-agents
# Install pip
python3 -m ensurepip
# Or on Ubuntu/Debian
sudo apt-get install python3-pip
# Upgrade certificates
pip install --upgrade certifi
# Or temporarily (not recommended for production)
pip install --trusted-host pypi.org signalwire-agents
Great! Your environment is ready. Let's start building Fred!
➡️ Continue to Lesson 3: Creating Fred's Basic Structure
Checklist:
← Previous: Introduction | Back to Overview | Next: Basic Agent →