This file provides a comprehensive guide for LLM coding agents to understand the SignalWire AI Agents SDK structure, key files, and concepts.
To understand this SDK, read these files in order:
README.md
(798 lines)docs/architecture.md
(1161 lines) - SDK architecture and design patternsdocs/agent_guide.md
(2800 lines) - Complete guide to creating agentsdocs/contexts_guide.md
(1161 lines) - Contexts and Steps workflow systemdocs/skills_system.md
(394 lines) - Modular skills systemdocs/datamap_guide.md
(610 lines) - DataMap serverless toolsdocs/search-system.md
(624 lines) - Local search capabilitiesdocs/cli_testing_guide.md
(2121 lines) - Development and testing toolsdocs/cloud_functions_guide.md
(477 lines) - Cloud function deployment guidedocs/signalwire_agents_api_reference.md
(3092 lines) - Complete API referencedocs/signalwire_agents_concepts_guide.md
(2771 lines) - Deep concepts guidedocs/signalwire_ai_developer_guide.md
(1356 lines) - AI development guidedocs/swml_service_guide.md
(604 lines) - SWML service base classdocs/datamap_swml_complete_guide.md
(3965 lines) - Complete DataMap guidedocs/swaig_actions_reference.md
(723 lines) - SWAIG actions referencedocs/swaig_function_result_methods.md
(751 lines) - Function result methodsdocs/post_data_complete_reference.md
(344 lines) - POST data referencedocs/search_installation.md
(305 lines) - Search system installationdocs/troubleshooting_search.md
(159 lines) - Search troubleshootingsignalwire_agents/__init__.py
(86 lines) - Package structure and public APIsignalwire_agents/core/agent_base.py
(3810 lines) - Main AgentBase class with cloud function supportsignalwire_agents/core/swml_service.py
(1171 lines) - Base SWML servicesignalwire_agents/core/function_result.py
(1201 lines) - SWAIG function resultssignalwire_agents/core/data_map.py
(499 lines) - DataMap serverless toolssignalwire_agents/core/logging_config.py
(376 lines) - Centralized logging systemsignalwire_agents/skills/
- All available skillssignalwire_agents/skills/README.md
(452 lines) - How to create skillssignalwire_agents/skills/datetime/skill.py
(113 lines) - Simple skill implementationsignalwire_agents/prefabs/
- Ready-to-use agent typessignalwire_agents/prefabs/info_gatherer.py
(383 lines) - Information gathering agentexamples/
- Practical implementationsexamples/simple_static_agent.py
(118 lines) - Basic agent exampleexamples/skills_demo.py
(158 lines) - Skills system demonstrationsignalwire_agents/cli/test_swaig.py
(2655 lines) - Comprehensive testing tool with cloud function simulationSignalWire AI Agents SDK
├── Core Framework
│ ├── SWMLService (Base HTTP service + SWML generation)
│ ├── AgentBase (AI agent functionality + cloud function support)
│ └── Custom Agents (User implementations)
├── Skills System (Modular capabilities)
├── DataMap Tools (Serverless API integration)
├── Contexts & Steps (Structured workflows)
├── Prefab Agents (Ready-to-use types)
├── Search System (Local document search)
├── Cloud Function Support (Google Cloud, Azure, AWS Lambda)
└── CLI Tools (Development & testing with serverless simulation)
signalwire_agents/core/agent_base.py
prompt_add_section()
- Build structured promptsadd_skill()
- Add modular capabilitiesdefine_tool()
- Create custom SWAIG functionsadd_language()
- Configure voice and languageset_params()
- Configure AI behaviorrun()
- Auto-detect environment and deploy (server/CGI/Lambda/Cloud Functions)signalwire_agents/skills/
agent.add_skill("skill_name", {params})
web_search
- Google Custom Search integrationdatetime
- Current date/time informationmath
- Mathematical calculationsdatasphere
- SignalWire DataSphere searchnative_vector_search
- Local document searchsignalwire_agents/core/data_map.py
signalwire_agents/core/contexts.py
signalwire_agents/core/state/
signalwire_agents/search/
signalwire_agents/core/agent_base.py
+ docs/cloud_functions_guide.md
signalwire-agents/
├── README.md # Main documentation (START HERE)
├── signalwire_agents/ # Main Python package
│ ├── __init__.py # Public API exports
│ ├── core/ # Core framework
│ │ ├── agent_base.py # Main AgentBase class (3810 lines)
│ │ ├── swml_service.py # Base SWML service
│ │ ├── function_result.py # SWAIG function results
│ │ ├── data_map.py # DataMap serverless tools
│ │ ├── contexts.py # Contexts and Steps system
│ │ ├── skill_manager.py # Skills management
│ │ ├── logging_config.py # Centralized logging
│ │ └── state/ # State management
│ ├── skills/ # Modular skills system
│ │ ├── README.md # How to create skills
│ │ ├── datetime/ # Date/time skill
│ │ ├── math/ # Math skill
│ │ ├── web_search/ # Web search skill
│ │ └── native_vector_search/ # Local search skill
│ ├── prefabs/ # Ready-to-use agents
│ │ ├── info_gatherer.py # Information gathering
│ │ ├── survey.py # Survey agent
│ │ └── receptionist.py # Receptionist agent
│ ├── search/ # Local search system
│ └── cli/ # Command-line tools
│ └── test_swaig.py # Comprehensive testing tool (2655 lines)
├── docs/ # Comprehensive documentation
│ ├── architecture.md # SDK architecture
│ ├── agent_guide.md # Complete agent guide
│ ├── contexts_guide.md # Contexts and Steps
│ ├── skills_system.md # Skills system
│ ├── datamap_guide.md # DataMap tools
│ ├── search-system.md # Search system
│ ├── cli_testing_guide.md # Testing tools
│ ├── cloud_functions_guide.md # Cloud function deployment
│ ├── signalwire_agents_api_reference.md # Complete API reference
│ ├── signalwire_agents_concepts_guide.md # Deep concepts
│ ├── signalwire_ai_developer_guide.md # AI development
│ ├── swml_service_guide.md # SWML service guide
│ ├── datamap_swml_complete_guide.md # Complete DataMap guide
│ ├── swaig_actions_reference.md # SWAIG actions
│ ├── swaig_function_result_methods.md # Function results
│ ├── post_data_complete_reference.md # POST data reference
│ ├── search_installation.md # Search installation
│ └── troubleshooting_search.md # Search troubleshooting
└── examples/ # Practical examples
├── simple_static_agent.py # Basic agent
├── skills_demo.py # Skills demonstration
├── contexts_demo.py # Contexts example
└── comprehensive_dynamic_agent.py # Advanced features
pip install signalwire-agents
# Basic search (~500MB)
pip install signalwire-agents[search]
# Full document processing (~600MB)
pip install signalwire-agents[search-full]
# Advanced NLP features (~700MB)
pip install signalwire-agents[search-nlp]
# All search features (~700MB)
pip install signalwire-agents[search-all]
from signalwire_agents import AgentBase
class MyAgent(AgentBase):
def __init__(self):
super().__init__(name="my-agent", route="/agent")
# Add skills (one-liners)
self.add_skill("datetime")
self.add_skill("math")
# Configure prompt
self.prompt_add_section("Role", "You are a helpful assistant")
# Custom tool
@AgentBase.tool(name="custom_tool", description="Custom functionality")
def my_tool(self, args, raw_data):
return SwaigFunctionResult("Tool response")
# Run the agent (auto-detects environment)
if __name__ == "__main__":
agent = MyAgent()
agent.run() # Works in server/CGI/Lambda/Cloud Functions/etc.
# Test agent functions locally
swaig-test examples/my_agent.py --list-tools
swaig-test examples/my_agent.py --exec function_name --param value
swaig-test examples/my_agent.py --dump-swml
# Serverless simulation
swaig-test examples/my_agent.py --simulate-serverless lambda --dump-swml
swaig-test examples/my_agent.py --simulate-serverless cloud_function --gcp-project my-project --dump-swml
swaig-test examples/my_agent.py --simulate-serverless azure_function --dump-swml
swaig-test examples/my_agent.py --simulate-serverless cgi --cgi-host example.com --dump-swml
# Environment variable testing
swaig-test examples/my_agent.py --simulate-serverless lambda --env API_KEY=secret --exec my_function
swaig-test examples/my_agent.py --simulate-serverless cloud_function --env-file production.env --dump-swml
# Authentication and URL testing
swaig-test examples/my_agent.py --simulate-serverless cloud_function --gcp-project prod --dump-swml --verbose
# Build search index
sw-search docs/ --output knowledge.swsearch
sw-search README.md docs/agent_guide.md --output specific.swsearch
AgentBase
class__init__()
methodagent.run()
for deployment (auto-detects environment)agent.add_skill("skill_name")
agent.add_skill("skill_name", {params})
@AgentBase.tool()
decoratorSwaigFunctionResult
objectsset_dynamic_config_callback()
for per-request configEphemeralAgentConfig
objectdefine_contexts()
for workflow-based agentsagent.run()
call works everywhere# Authentication
SWML_BASIC_AUTH_USER=username
SWML_BASIC_AUTH_PASSWORD=password
# SSL/HTTPS
SWML_SSL_ENABLED=true
SWML_SSL_CERT_PATH=/path/to/cert.pem
SWML_SSL_KEY_PATH=/path/to/key.pem
SWML_DOMAIN=yourdomain.com
# Proxy support
SWML_PROXY_URL_BASE=https://your-proxy.com
# Skills (example for web_search)
GOOGLE_SEARCH_API_KEY=your_api_key
GOOGLE_SEARCH_ENGINE_ID=your_engine_id
# Cloud Functions (auto-detected)
# Google Cloud Functions
GOOGLE_CLOUD_PROJECT=my-project
FUNCTION_TARGET=my_function
K_SERVICE=my-service
GOOGLE_CLOUD_REGION=us-central1
# Azure Functions
AZURE_FUNCTIONS_ENVIRONMENT=Development
FUNCTIONS_WORKER_RUNTIME=python
WEBSITE_SITE_NAME=my-function-app
# AWS Lambda
AWS_LAMBDA_FUNCTION_NAME=my-function
AWS_LAMBDA_FUNCTION_URL=https://abc123.lambda-url.us-east-1.on.aws
AWS_REGION=us-east-1
# Logging control
SIGNALWIRE_LOG_MODE=off|stderr|default|auto
SIGNALWIRE_LOG_LEVEL=debug|info|warning|error|critical
The SDK automatically detects and configures for:
python agent.py
)swaig-test
tooldocs/cloud_functions_guide.md
swaig-test
CLI tool with comprehensive options--dump-swml
swaig-test --simulate-serverless
swaig-test
--env
and --env-file
docs/signalwire_agents_api_reference.md
)docs/cloud_functions_guide.md
)docs/signalwire_agents_concepts_guide.md
)docs/datamap_swml_complete_guide.md
)docs/swaig_actions_reference.md
)README.md
for overviewdocs/architecture.md
for design understandingsignalwire_agents/core/agent_base.py
for implementationexamples/
directorysignalwire_agents/skills/
swaig-test
CLI tool (including cloud function simulation)docs/cloud_functions_guide.md
docs/signalwire_agents_api_reference.md
This guide provides the roadmap to fully understand the SignalWire AI Agents SDK architecture, capabilities, and implementation patterns, including the latest cloud function support and enhanced testing capabilities.