sw-agent-init CLI
sw-agent-init CLI
Summary: Interactive project generator for creating new SignalWire agent projects with customizable features.
Overview
The sw-agent-init tool scaffolds new SignalWire agent projects with:
- Pre-configured project structure
- Agent class with example SWAIG tool
- Environment configuration (.env files)
- Optional debug webhooks for development
- Test scaffolding with pytest
- Virtual environment setup
Command Syntax
sw-agent-init [project_name] [options]
Quick Reference
| Command | Purpose |
|---|---|
sw-agent-init | Interactive mode with prompts |
sw-agent-init myagent | Quick mode with defaults |
sw-agent-init myagent --type full | Full-featured project |
sw-agent-init myagent --no-venv | Skip virtual environment |
Modes
Interactive Mode
Run without arguments for guided setup:
sw-agent-init
Interactive mode prompts for:
- Project name
- Project directory
- Agent type (basic or full)
- Feature selection
- SignalWire credentials
- Virtual environment creation
Quick Mode
Provide a project name for quick setup with defaults:
sw-agent-init myagent
Quick mode uses environment variables for credentials if available.
Options
| Option | Description |
|---|---|
--type basic | Minimal agent with example tool (default) |
--type full | All features enabled |
--no-venv | Skip virtual environment creation |
--dir PATH | Parent directory for project |
Agent Types
Basic Agent
Minimal setup for getting started:
- Single agent class
- Example SWAIG tool
- Test scaffolding
- Environment configuration
sw-agent-init myagent --type basic
Full Agent
All features enabled:
- Debug webhooks (console output)
- Post-prompt summary handling
- Web UI with status page
- Example SWAIG tool
- Test scaffolding
- Basic authentication
sw-agent-init myagent --type full
Features
Toggle features in interactive mode:
| Feature | Description |
|---|---|
| Debug webhooks | Real-time call data printed to console |
| Post-prompt summary | Call summary handling after conversations |
| Web UI | Static file serving with status page |
| Example SWAIG tool | Sample get_info tool implementation |
| Test scaffolding | pytest-based test suite |
| Basic authentication | HTTP basic auth for SWML endpoints |
Generated Project Structure
myagent/
├── agents/
│ ├── __init__.py
│ └── main_agent.py # Main agent implementation
├── skills/
│ └── __init__.py # Reusable skills module
├── tests/
│ ├── __init__.py
│ └── test_agent.py # Test suite using swaig-test
├── web/ # Static files (full type only)
│ └── index.html
├── app.py # Entry point
├── .env # Environment configuration
├── .env.example # Example configuration
├── .gitignore
├── requirements.txt
└── README.md
Environment Variables
The tool auto-detects SignalWire credentials from environment:
| Variable | Description |
|---|---|
SIGNALWIRE_SPACE_NAME | Your SignalWire space |
SIGNALWIRE_PROJECT_ID | Project identifier |
SIGNALWIRE_TOKEN | API token |
Examples
Create Basic Agent
sw-agent-init support-bot
cd support-bot
source .venv/bin/activate
python app.py
Create Full-Featured Agent
sw-agent-init customer-service --type full
cd customer-service
source .venv/bin/activate
python app.py
Create Without Virtual Environment
sw-agent-init myagent --no-venv
cd myagent
pip install -r requirements.txt
python app.py
Create in Specific Directory
sw-agent-init myagent --dir ~/projects
cd ~/projects/myagent
Running the Generated Agent
After creation:
cd myagent
source .venv/bin/activate # If venv was created
python app.py
Output:
SignalWire Agent Server
SWML endpoint: http://0.0.0.0:5000/swml
SWAIG endpoint: http://0.0.0.0:5000/swml/swaig/
Testing the Generated Agent
Run the test suite:
cd myagent
source .venv/bin/activate
pytest tests/ -v
Or use swaig-test directly:
swaig-test agents/main_agent.py --dump-swml
swaig-test agents/main_agent.py --list-tools
swaig-test agents/main_agent.py --exec get_info --topic "SignalWire"
Customizing the Agent
Edit agents/main_agent.py to customize:
- Prompts and personality
- Voice and language settings
- SWAIG tools and handlers
- Debug and webhook configuration
See the Building Agents chapter for detailed guidance.