signalwire.skills¶
signalwire.skills
¶
Copyright (c) 2025 SignalWire
This file is part of the SignalWire SDK.
Licensed under the MIT License. See LICENSE file in the project root for full license information.
SignalWire Agent Skills Package
This package contains built-in skills for SignalWire agents. Skills are automatically discovered from subdirectories.
skill_registry = SkillRegistry()
module-attribute
¶
__all__ = ['SkillBase', 'skill_registry']
module-attribute
¶
SkillBase
¶
Bases: ABC
Abstract base class for all agent skills
SKILL_NAME = None
class-attribute
instance-attribute
¶
SKILL_DESCRIPTION = None
class-attribute
instance-attribute
¶
SKILL_VERSION = '1.0.0'
class-attribute
instance-attribute
¶
REQUIRED_PACKAGES = []
class-attribute
¶
REQUIRED_ENV_VARS = []
class-attribute
¶
SUPPORTS_MULTIPLE_INSTANCES = False
class-attribute
instance-attribute
¶
agent = agent
instance-attribute
¶
params = params or {}
instance-attribute
¶
logger = get_logger(f'signalwire.skills.{self.SKILL_NAME}')
instance-attribute
¶
swaig_fields = self.params.pop('swaig_fields', {})
instance-attribute
¶
__init__(agent, params=None)
¶
setup()
abstractmethod
¶
Setup the skill (validate env vars, initialize APIs, etc.) Returns True if setup successful, False otherwise
register_tools()
abstractmethod
¶
Register SWAIG tools with the agent
define_tool(**kwargs)
¶
Wrapper method that automatically includes swaig_fields when defining tools.
This method delegates to self.agent.define_tool() but automatically merges any swaig_fields configured for this skill. Skills should use this method instead of calling self.agent.define_tool() directly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**kwargs
|
All arguments supported by agent.define_tool() (name, description, parameters, handler, etc.) |
{}
|
get_hints()
¶
Return speech recognition hints for this skill
get_global_data()
¶
Return data to add to agent's global context
get_prompt_sections()
¶
Return prompt sections to add to agent. Returns empty list if skip_prompt is set to True in params.
cleanup()
¶
Cleanup when skill is removed or agent shuts down
validate_env_vars()
¶
Check if all required environment variables are set
validate_packages()
¶
Check if all required packages are available
get_instance_key()
¶
Get the key used to track this skill instance
For skills that support multiple instances (SUPPORTS_MULTIPLE_INSTANCES = True), this method can be overridden to provide a unique key for each instance.
Default implementation: - If SUPPORTS_MULTIPLE_INSTANCES is False: returns SKILL_NAME - If SUPPORTS_MULTIPLE_INSTANCES is True: returns SKILL_NAME + "_" + tool_name (where tool_name comes from params['tool_name'] or defaults to the skill name)
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Unique key for this skill instance |
get_skill_data(raw_data)
¶
Read this skill instance's namespaced data from raw_data global_data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
raw_data
|
dict[str, Any]
|
The raw_data dict passed to SWAIG function handlers, expected to contain a 'global_data' key. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict[str, Any]
|
The skill's namespaced state, or empty dict if not found. |
update_skill_data(result, data)
¶
Write this skill instance's namespaced data into a FunctionResult.
Wraps the data under the skill's namespace key and calls result.update_global_data().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
result
|
FunctionResult
|
The FunctionResult to add the global_data update to. |
required |
data
|
dict[str, Any]
|
The skill state dict to store under the namespace. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
FunctionResult |
FunctionResult
|
The result, for method chaining. |
get_parameter_schema()
classmethod
¶
Get the parameter schema for this skill
This method returns metadata about all parameters the skill accepts, including their types, descriptions, default values, and whether they are required or should be hidden (e.g., API keys).
The base implementation provides common parameters available to all skills. Subclasses should override this method and merge their specific parameters with the base schema.
Returns:
| Type | Description |
|---|---|
dict[str, dict[str, Any]]
|
Dict[str, Dict[str, Any]]: Parameter schema where keys are parameter names |
dict[str, dict[str, Any]]
|
and values are dictionaries containing: - type: Parameter type ("string", "integer", "number", "boolean", "object", "array") - description: Human-readable description - default: Default value if not provided (optional) - required: Whether the parameter is required (default: False) - hidden: Whether to hide this field in UIs (for secrets/keys) - env_var: Environment variable that can provide this value (optional) - enum: List of allowed values (optional) - min/max: Minimum/maximum values for numeric types (optional) |
Example
{ "tool_name": { "type": "string", "description": "Name for the tool when using multiple instances", "default": "my_skill", "required": False }, "api_key": { "type": "string", "description": "API key for the service", "required": True, "hidden": True, "env_var": "MY_API_KEY" } }
api_ninjas_trivia
¶
Copyright (c) 2025 SignalWire
This file is part of the SignalWire SDK.
Licensed under the MIT License. See LICENSE file in the project root for full license information.
__all__ = ['ApiNinjasTriviaSkill']
module-attribute
¶
ApiNinjasTriviaSkill
¶
Bases: SkillBase
Skill for getting trivia questions from API Ninjas with configurable categories.
Supports multiple instances with different tool names and category combinations. Uses DataMap for serverless execution with dynamic enum generation.
Configuration: - tool_name: Custom name for the generated SWAIG function - api_key: API Ninjas API key - categories: Array of category strings to enable
Available categories: - artliterature: Art and Literature - language: Language - sciencenature: Science and Nature - general: General Knowledge - fooddrink: Food and Drink - peopleplaces: People and Places - geography: Geography - historyholidays: History and Holidays - entertainment: Entertainment - toysgames: Toys and Games - music: Music - mathematics: Mathematics - religionmythology: Religion and Mythology - sportsleisure: Sports and Leisure
Example
agent.add_skill("api_ninjas_trivia", { "tool_name": "get_science_trivia", "api_key": "your_api_key", "categories": ["sciencenature", "mathematics", "general"] })
SKILL_NAME = 'api_ninjas_trivia'
class-attribute
instance-attribute
¶
SKILL_DESCRIPTION = 'Get trivia questions from API Ninjas'
class-attribute
instance-attribute
¶
SUPPORTS_MULTIPLE_INSTANCES = True
class-attribute
instance-attribute
¶
REQUIRED_ENV_VARS = []
class-attribute
¶
VALID_CATEGORIES = {'artliterature': 'Art and Literature', 'language': 'Language', 'sciencenature': 'Science and Nature', 'general': 'General Knowledge', 'fooddrink': 'Food and Drink', 'peopleplaces': 'People and Places', 'geography': 'Geography', 'historyholidays': 'History and Holidays', 'entertainment': 'Entertainment', 'toysgames': 'Toys and Games', 'music': 'Music', 'mathematics': 'Mathematics', 'religionmythology': 'Religion and Mythology', 'sportsleisure': 'Sports and Leisure'}
class-attribute
¶
tool_name = self.params.get('tool_name', 'get_trivia')
instance-attribute
¶
api_key = self.params.get('api_key')
instance-attribute
¶
categories = self.params.get('categories', list(self.VALID_CATEGORIES.keys()))
instance-attribute
¶
__init__(agent, params=None)
¶
Initialize the skill with configuration parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent
|
AgentBase
|
The agent instance this skill belongs to |
required |
params
|
dict[str, Any] | None
|
Configuration dictionary containing: - tool_name: Custom tool name (default: "get_trivia") - api_key: API Ninjas API key (required) - categories: Array of category strings (default: all categories) |
None
|
setup()
¶
Setup the skill - validates API key is available.
Returns:
| Type | Description |
|---|---|
bool
|
True if setup successful |
register_tools()
¶
Register SWAIG tools with the agent
get_instance_key()
¶
Generate a unique instance key for this skill configuration.
Returns:
| Type | Description |
|---|---|
str
|
Unique key combining skill name and tool name |
get_tools()
¶
Generate the SWAIG tool with DataMap webhook.
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
List containing the generated tool configuration |
get_parameter_schema()
classmethod
¶
Get the parameter schema for the API Ninjas Trivia skill.
Returns parameter definitions for GUI configuration.
skill
¶
Copyright (c) 2025 SignalWire
This file is part of the SignalWire SDK.
Licensed under the MIT License. See LICENSE file in the project root for full license information.
API Ninjas Trivia Skill
A configurable skill for getting trivia questions from API Ninjas with customizable categories and multiple tool instances.
ApiNinjasTriviaSkill
¶
Bases: SkillBase
Skill for getting trivia questions from API Ninjas with configurable categories.
Supports multiple instances with different tool names and category combinations. Uses DataMap for serverless execution with dynamic enum generation.
Configuration: - tool_name: Custom name for the generated SWAIG function - api_key: API Ninjas API key - categories: Array of category strings to enable
Available categories: - artliterature: Art and Literature - language: Language - sciencenature: Science and Nature - general: General Knowledge - fooddrink: Food and Drink - peopleplaces: People and Places - geography: Geography - historyholidays: History and Holidays - entertainment: Entertainment - toysgames: Toys and Games - music: Music - mathematics: Mathematics - religionmythology: Religion and Mythology - sportsleisure: Sports and Leisure
Example
agent.add_skill("api_ninjas_trivia", { "tool_name": "get_science_trivia", "api_key": "your_api_key", "categories": ["sciencenature", "mathematics", "general"] })
SKILL_NAME = 'api_ninjas_trivia'
class-attribute
instance-attribute
¶
SKILL_DESCRIPTION = 'Get trivia questions from API Ninjas'
class-attribute
instance-attribute
¶
SUPPORTS_MULTIPLE_INSTANCES = True
class-attribute
instance-attribute
¶
REQUIRED_ENV_VARS = []
class-attribute
¶
VALID_CATEGORIES = {'artliterature': 'Art and Literature', 'language': 'Language', 'sciencenature': 'Science and Nature', 'general': 'General Knowledge', 'fooddrink': 'Food and Drink', 'peopleplaces': 'People and Places', 'geography': 'Geography', 'historyholidays': 'History and Holidays', 'entertainment': 'Entertainment', 'toysgames': 'Toys and Games', 'music': 'Music', 'mathematics': 'Mathematics', 'religionmythology': 'Religion and Mythology', 'sportsleisure': 'Sports and Leisure'}
class-attribute
¶
tool_name = self.params.get('tool_name', 'get_trivia')
instance-attribute
¶
api_key = self.params.get('api_key')
instance-attribute
¶
categories = self.params.get('categories', list(self.VALID_CATEGORIES.keys()))
instance-attribute
¶
__init__(agent, params=None)
¶
Initialize the skill with configuration parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent
|
AgentBase
|
The agent instance this skill belongs to |
required |
params
|
dict[str, Any] | None
|
Configuration dictionary containing: - tool_name: Custom tool name (default: "get_trivia") - api_key: API Ninjas API key (required) - categories: Array of category strings (default: all categories) |
None
|
setup()
¶
Setup the skill - validates API key is available.
Returns:
| Type | Description |
|---|---|
bool
|
True if setup successful |
register_tools()
¶
Register SWAIG tools with the agent
get_instance_key()
¶
Generate a unique instance key for this skill configuration.
Returns:
| Type | Description |
|---|---|
str
|
Unique key combining skill name and tool name |
get_tools()
¶
Generate the SWAIG tool with DataMap webhook.
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
List containing the generated tool configuration |
get_parameter_schema()
classmethod
¶
Get the parameter schema for the API Ninjas Trivia skill.
Returns parameter definitions for GUI configuration.
claude_skills
¶
Copyright (c) 2025 SignalWire
This file is part of the SignalWire SDK.
Licensed under the MIT License. See LICENSE file in the project root for full license information.
skill
¶
Copyright (c) 2025 SignalWire
This file is part of the SignalWire SDK.
Licensed under the MIT License. See LICENSE file in the project root for full license information.
logger = get_logger(__name__)
module-attribute
¶
ClaudeSkillsSkill
¶
Bases: SkillBase
Load Claude-style SKILL.md files as SignalWire agent tools.
This skill parses Claude Code skill directories and makes them available as SWAIG tools that the AI can call. Each Claude skill becomes a tool that returns the skill's instructions when invoked.
Claude skills use this format
name: skill-name description: When to use this skill
Markdown instructions here... Use $ARGUMENTS for passed args.
SKILL_NAME = 'claude_skills'
class-attribute
instance-attribute
¶
SKILL_DESCRIPTION = 'Load Claude SKILL.md files as agent tools'
class-attribute
instance-attribute
¶
SKILL_VERSION = '1.0.0'
class-attribute
instance-attribute
¶
REQUIRED_PACKAGES = ['yaml']
class-attribute
¶
REQUIRED_ENV_VARS = []
class-attribute
¶
SUPPORTS_MULTIPLE_INSTANCES = True
class-attribute
instance-attribute
¶
setup()
¶
Setup the Claude skills loader.
Discovers and parses all SKILL.md files in the configured directory.
register_tools()
¶
Register a SWAIG tool for each discovered Claude skill.
get_hints()
¶
Return speech recognition hints based on loaded skills.
get_instance_key()
¶
Return unique key for this skill instance.
get_parameter_schema()
classmethod
¶
Get the parameter schema for the Claude skills loader.
datasphere
¶
Copyright (c) 2025 SignalWire
This file is part of the SignalWire SDK.
Licensed under the MIT License. See LICENSE file in the project root for full license information.
__all__ = ['DataSphereSkill']
module-attribute
¶
DataSphereSkill
¶
Bases: SkillBase
SignalWire DataSphere knowledge search capability
SKILL_NAME = 'datasphere'
class-attribute
instance-attribute
¶
SKILL_DESCRIPTION = 'Search knowledge using SignalWire DataSphere RAG stack'
class-attribute
instance-attribute
¶
SKILL_VERSION = '1.0.0'
class-attribute
instance-attribute
¶
REQUIRED_PACKAGES = ['requests']
class-attribute
¶
REQUIRED_ENV_VARS = []
class-attribute
¶
SUPPORTS_MULTIPLE_INSTANCES = True
class-attribute
instance-attribute
¶
get_parameter_schema()
classmethod
¶
Get parameter schema for DataSphere skill
get_instance_key()
¶
Get the key used to track this skill instance
For DataSphere, we use 'search_knowledge' as the default tool name instead of 'datasphere'
setup()
¶
Setup the datasphere skill
register_tools()
¶
Register knowledge search tool with the agent
cleanup()
¶
Clean up resources when skill is unloaded.
get_hints()
¶
Return speech recognition hints
get_global_data()
¶
Return global data for agent context
get_prompt_sections()
¶
Return prompt sections to add to agent
skill
¶
Copyright (c) 2025 SignalWire
This file is part of the SignalWire SDK.
Licensed under the MIT License. See LICENSE file in the project root for full license information.
DataSphereSkill
¶
Bases: SkillBase
SignalWire DataSphere knowledge search capability
SKILL_NAME = 'datasphere'
class-attribute
instance-attribute
¶
SKILL_DESCRIPTION = 'Search knowledge using SignalWire DataSphere RAG stack'
class-attribute
instance-attribute
¶
SKILL_VERSION = '1.0.0'
class-attribute
instance-attribute
¶
REQUIRED_PACKAGES = ['requests']
class-attribute
¶
REQUIRED_ENV_VARS = []
class-attribute
¶
SUPPORTS_MULTIPLE_INSTANCES = True
class-attribute
instance-attribute
¶
get_parameter_schema()
classmethod
¶
Get parameter schema for DataSphere skill
get_instance_key()
¶
Get the key used to track this skill instance
For DataSphere, we use 'search_knowledge' as the default tool name instead of 'datasphere'
setup()
¶
Setup the datasphere skill
register_tools()
¶
Register knowledge search tool with the agent
cleanup()
¶
Clean up resources when skill is unloaded.
get_hints()
¶
Return speech recognition hints
get_global_data()
¶
Return global data for agent context
get_prompt_sections()
¶
Return prompt sections to add to agent
datasphere_serverless
¶
Copyright (c) 2025 SignalWire
This file is part of the SignalWire SDK.
Licensed under the MIT License. See LICENSE file in the project root for full license information.
skill
¶
Copyright (c) 2025 SignalWire
This file is part of the SignalWire SDK.
Licensed under the MIT License. See LICENSE file in the project root for full license information.
DataSphereServerlessSkill
¶
Bases: SkillBase
SignalWire DataSphere knowledge search using DataMap (serverless execution)
SKILL_NAME = 'datasphere_serverless'
class-attribute
instance-attribute
¶
SKILL_DESCRIPTION = 'Search knowledge using SignalWire DataSphere with serverless DataMap execution'
class-attribute
instance-attribute
¶
SKILL_VERSION = '1.0.0'
class-attribute
instance-attribute
¶
REQUIRED_PACKAGES = []
class-attribute
¶
REQUIRED_ENV_VARS = []
class-attribute
¶
SUPPORTS_MULTIPLE_INSTANCES = True
class-attribute
instance-attribute
¶
get_parameter_schema()
classmethod
¶
Get parameter schema for DataSphere Serverless skill
get_instance_key()
¶
Get the key used to track this skill instance
For DataSphere Serverless, we use 'search_knowledge' as the default tool name
setup()
¶
Setup the datasphere serverless skill
register_tools()
¶
Register knowledge search tool using DataMap
get_hints()
¶
Return speech recognition hints
get_global_data()
¶
Return global data for agent context
get_prompt_sections()
¶
Return prompt sections to add to agent
datetime
¶
Copyright (c) 2025 SignalWire
This file is part of the SignalWire SDK.
Licensed under the MIT License. See LICENSE file in the project root for full license information.
skill
¶
Copyright (c) 2025 SignalWire
This file is part of the SignalWire SDK.
Licensed under the MIT License. See LICENSE file in the project root for full license information.
DateTimeSkill
¶
Bases: SkillBase
Provides current date, time, and timezone information
SKILL_NAME = 'datetime'
class-attribute
instance-attribute
¶
SKILL_DESCRIPTION = 'Get current date, time, and timezone information'
class-attribute
instance-attribute
¶
SKILL_VERSION = '1.0.0'
class-attribute
instance-attribute
¶
REQUIRED_PACKAGES = ['pytz']
class-attribute
¶
REQUIRED_ENV_VARS = []
class-attribute
¶
setup()
¶
Setup the datetime skill
register_tools()
¶
Register datetime tools with the agent
get_hints()
¶
Return speech recognition hints
get_prompt_sections()
¶
Return prompt sections to add to agent
get_parameter_schema()
classmethod
¶
Get the parameter schema for the datetime skill
The datetime skill has no custom parameters - it inherits only the base parameters from SkillBase.
google_maps
¶
Google Maps skill for SignalWire Agents
skill
¶
Copyright (c) 2025 SignalWire
This file is part of the SignalWire SDK.
Licensed under the MIT License. See LICENSE file in the project root for full license information.
Google Maps skill — address validation and route computation.
Library layer: GoogleMapsClient (reusable by any agent) Skill layer: GoogleMapsSkill (plug-and-play SWAIG tools)
logger = get_logger(__name__)
module-attribute
¶
GoogleMapsClient
¶
api_key = api_key
instance-attribute
¶
__init__(api_key)
¶
validate_address(input_text, bias_lat=None, bias_lng=None)
¶
Validate and geocode an address or business name.
When bias_lat/bias_lng are provided (destination search with known pickup): 1. First tries Nearby Search with rankby=distance to find the CLOSEST matching business (e.g. "Walmart" → nearest Walmart to pickup). 2. Falls back to Autocomplete with location bias (no strictbounds) for street addresses or if Nearby Search finds nothing.
Without bias coords (pickup search): uses plain Autocomplete.
Returns: {"address": str, "lat": float, "lng": float} or None
compute_route(origin_lat, origin_lng, dest_lat, dest_lng)
¶
Compute route using Google Routes API.
Returns: {"distance_meters": int, "duration_seconds": int} or None
GoogleMapsSkill
¶
Bases: SkillBase
Validate addresses and compute driving routes using Google Maps
SKILL_NAME = 'google_maps'
class-attribute
instance-attribute
¶
SKILL_DESCRIPTION = 'Validate addresses and compute driving routes using Google Maps'
class-attribute
instance-attribute
¶
SKILL_VERSION = '1.0.0'
class-attribute
instance-attribute
¶
REQUIRED_PACKAGES = ['requests']
class-attribute
¶
REQUIRED_ENV_VARS = []
class-attribute
¶
get_parameter_schema()
classmethod
¶
Get parameter schema for google_maps skill
setup()
¶
Setup the Google Maps skill
register_tools()
¶
Register address lookup and route computation tools
get_hints()
¶
Return speech recognition hints
get_prompt_sections()
¶
Return prompt sections to add to agent
info_gatherer
¶
Copyright (c) 2025 SignalWire
This file is part of the SignalWire SDK.
Licensed under the MIT License. See LICENSE file in the project root for full license information.
skill
¶
Copyright (c) 2025 SignalWire
This file is part of the SignalWire SDK.
Licensed under the MIT License. See LICENSE file in the project root for full license information.
InfoGathererSkill
¶
Bases: SkillBase
Skill that guides an AI agent through a series of questions, collecting and storing answers in namespaced global_data.
Supports multiple instances with different prefixes so several question sets can coexist on a single agent (e.g. "intake" and "medical" questionnaires running side by side).
SKILL_NAME = 'info_gatherer'
class-attribute
instance-attribute
¶
SKILL_DESCRIPTION = 'Gather answers to a configurable list of questions'
class-attribute
instance-attribute
¶
SKILL_VERSION = '1.0.0'
class-attribute
instance-attribute
¶
REQUIRED_PACKAGES = []
class-attribute
¶
REQUIRED_ENV_VARS = []
class-attribute
¶
SUPPORTS_MULTIPLE_INSTANCES = True
class-attribute
instance-attribute
¶
get_parameter_schema()
classmethod
¶
get_instance_key()
¶
setup()
¶
get_global_data()
¶
register_tools()
¶
joke
¶
Copyright (c) 2025 SignalWire
This file is part of the SignalWire SDK.
Licensed under the MIT License. See LICENSE file in the project root for full license information.
skill
¶
Copyright (c) 2025 SignalWire
This file is part of the SignalWire SDK.
Licensed under the MIT License. See LICENSE file in the project root for full license information.
JokeSkill
¶
Bases: SkillBase
Joke telling capability using API Ninjas with DataMap
SKILL_NAME = 'joke'
class-attribute
instance-attribute
¶
SKILL_DESCRIPTION = 'Tell jokes using the API Ninjas joke API'
class-attribute
instance-attribute
¶
SKILL_VERSION = '1.0.0'
class-attribute
instance-attribute
¶
REQUIRED_PACKAGES = []
class-attribute
¶
REQUIRED_ENV_VARS = []
class-attribute
¶
get_parameter_schema()
classmethod
¶
Get parameter schema for joke skill
setup()
¶
Setup the joke skill
register_tools()
¶
Register joke tool using DataMap
get_hints()
¶
Return speech recognition hints
get_global_data()
¶
Return global data to be available in DataMap variables
get_prompt_sections()
¶
Return prompt sections to add to agent
math
¶
Copyright (c) 2025 SignalWire
This file is part of the SignalWire SDK.
Licensed under the MIT License. See LICENSE file in the project root for full license information.
skill
¶
Copyright (c) 2025 SignalWire
This file is part of the SignalWire SDK.
Licensed under the MIT License. See LICENSE file in the project root for full license information.
MathSkill
¶
Bases: SkillBase
Provides basic mathematical calculation capabilities
SKILL_NAME = 'math'
class-attribute
instance-attribute
¶
SKILL_DESCRIPTION = 'Perform basic mathematical calculations'
class-attribute
instance-attribute
¶
SKILL_VERSION = '1.0.0'
class-attribute
instance-attribute
¶
REQUIRED_PACKAGES = []
class-attribute
¶
REQUIRED_ENV_VARS = []
class-attribute
¶
setup()
¶
Setup the math skill
register_tools()
¶
Register math tools with the agent
get_hints()
¶
Return speech recognition hints
get_prompt_sections()
¶
Return prompt sections to add to agent
get_parameter_schema()
classmethod
¶
Get the parameter schema for the math skill
The math skill has no custom parameters - it inherits only the base parameters from SkillBase.
mcp_gateway
¶
Copyright (c) 2025 SignalWire
This file is part of the SignalWire SDK.
Licensed under the MIT License. See LICENSE file in the project root for full license information.
skill
¶
Copyright (c) 2025 SignalWire
This file is part of the SignalWire SDK.
Licensed under the MIT License. See LICENSE file in the project root for full license information.
logger = get_logger(__name__)
module-attribute
¶
MCPGatewaySkill
¶
Bases: SkillBase
MCP Gateway Skill - Bridge MCP servers with SWAIG functions
This skill connects SignalWire agents to MCP (Model Context Protocol) servers through a gateway service, dynamically creating SWAIG functions for MCP tools.
SKILL_NAME = 'mcp_gateway'
class-attribute
instance-attribute
¶
SKILL_DESCRIPTION = 'Bridge MCP servers with SWAIG functions'
class-attribute
instance-attribute
¶
SKILL_VERSION = '1.0.0'
class-attribute
instance-attribute
¶
REQUIRED_PACKAGES = ['requests']
class-attribute
¶
REQUIRED_ENV_VARS = []
class-attribute
¶
get_parameter_schema()
classmethod
¶
Get parameter schema for MCP Gateway skill
setup()
¶
Setup and validate skill configuration
register_tools()
¶
Register SWAIG tools from MCP services
get_hints()
¶
Return speech recognition hints
get_global_data()
¶
Return global data for DataMap variables
get_prompt_sections()
¶
Return prompt sections to add to agent
native_vector_search
¶
Copyright (c) 2025 SignalWire
This file is part of the SignalWire SDK.
Licensed under the MIT License. See LICENSE file in the project root for full license information.
skill
¶
Copyright (c) 2025 SignalWire
This file is part of the SignalWire SDK.
Licensed under the MIT License. See LICENSE file in the project root for full license information.
NativeVectorSearchSkill
¶
Bases: SkillBase
Native vector search capability using local document indexes or remote search servers
SKILL_NAME = 'native_vector_search'
class-attribute
instance-attribute
¶
SKILL_DESCRIPTION = 'Search document indexes using vector similarity and keyword search (local or remote)'
class-attribute
instance-attribute
¶
SKILL_VERSION = '1.0.0'
class-attribute
instance-attribute
¶
REQUIRED_PACKAGES = []
class-attribute
¶
REQUIRED_ENV_VARS = []
class-attribute
¶
SUPPORTS_MULTIPLE_INSTANCES = True
class-attribute
instance-attribute
¶
get_parameter_schema()
classmethod
¶
Get parameter schema for Native Vector Search skill
This skill supports three modes of operation: 1. Network Mode: Set 'remote_url' to connect to a remote search server 2. Local pgvector: Set backend='pgvector' with connection_string and collection_name 3. Local SQLite: Set 'index_file' to use a local .swsearch file (default)
get_instance_key()
¶
Get the key used to track this skill instance
For native vector search, we use the tool name to differentiate instances
setup()
¶
Setup the native vector search skill
register_tools()
¶
Register native vector search tool with the agent
get_hints()
¶
Return speech recognition hints for this skill
get_global_data()
¶
Return data to add to agent's global context
get_prompt_sections()
¶
Return prompt sections to add to agent
cleanup()
¶
Cleanup when skill is removed or agent shuts down
play_background_file
¶
Copyright (c) 2025 SignalWire
This file is part of the SignalWire SDK.
Licensed under the MIT License. See LICENSE file in the project root for full license information.
__all__ = ['PlayBackgroundFileSkill']
module-attribute
¶
PlayBackgroundFileSkill
¶
Bases: SkillBase
Skill for playing background files (audio/video) with configurable tool names.
Supports multiple instances with different tool names and file collections. Uses DataMap for serverless execution with dynamic enum generation.
Configuration: - tool_name: Custom name for the generated SWAIG function - files: Array of file objects with key, description, url, and optional wait
Example
agent.add_skill("play_background_file", { "tool_name": "play_testimonial", "files": [ { "key": "massey", "description": "Customer success story from Massey Energy", "url": "https://example.com/massey.mp4", "wait": True } ] })
SKILL_NAME = 'play_background_file'
class-attribute
instance-attribute
¶
SKILL_DESCRIPTION = 'Control background file playback'
class-attribute
instance-attribute
¶
SUPPORTS_MULTIPLE_INSTANCES = True
class-attribute
instance-attribute
¶
tool_name = self.params.get('tool_name', 'play_background_file')
instance-attribute
¶
files = self.params.get('files', [])
instance-attribute
¶
get_parameter_schema()
classmethod
¶
Get parameter schema for Play Background File skill
__init__(agent, params=None)
¶
Initialize the skill with configuration parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent
|
AgentBase
|
The agent instance this skill belongs to |
required |
params
|
dict[str, Any] | None
|
Configuration dictionary containing: - tool_name: Custom tool name (default: "play_background_file") - files: Array of file objects with key, description, url, wait |
None
|
get_instance_key()
¶
Generate a unique instance key for this skill configuration.
Returns:
| Type | Description |
|---|---|
str
|
Unique key combining skill name and tool name |
setup()
¶
Setup the skill - no external dependencies needed.
Returns:
| Type | Description |
|---|---|
bool
|
True if setup successful |
register_tools()
¶
Register SWAIG tools with the agent
get_tools()
¶
Generate the SWAIG tool with DataMap expressions.
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
List containing the generated tool configuration |
skill
¶
Copyright (c) 2025 SignalWire
This file is part of the SignalWire SDK.
Licensed under the MIT License. See LICENSE file in the project root for full license information.
Play Background File Skill
A configurable skill for managing background file playback with custom tool names and multiple file collections. Supports both audio and video files.
PlayBackgroundFileSkill
¶
Bases: SkillBase
Skill for playing background files (audio/video) with configurable tool names.
Supports multiple instances with different tool names and file collections. Uses DataMap for serverless execution with dynamic enum generation.
Configuration: - tool_name: Custom name for the generated SWAIG function - files: Array of file objects with key, description, url, and optional wait
Example
agent.add_skill("play_background_file", { "tool_name": "play_testimonial", "files": [ { "key": "massey", "description": "Customer success story from Massey Energy", "url": "https://example.com/massey.mp4", "wait": True } ] })
SKILL_NAME = 'play_background_file'
class-attribute
instance-attribute
¶
SKILL_DESCRIPTION = 'Control background file playback'
class-attribute
instance-attribute
¶
SUPPORTS_MULTIPLE_INSTANCES = True
class-attribute
instance-attribute
¶
tool_name = self.params.get('tool_name', 'play_background_file')
instance-attribute
¶
files = self.params.get('files', [])
instance-attribute
¶
get_parameter_schema()
classmethod
¶
Get parameter schema for Play Background File skill
__init__(agent, params=None)
¶
Initialize the skill with configuration parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent
|
AgentBase
|
The agent instance this skill belongs to |
required |
params
|
dict[str, Any] | None
|
Configuration dictionary containing: - tool_name: Custom tool name (default: "play_background_file") - files: Array of file objects with key, description, url, wait |
None
|
get_instance_key()
¶
Generate a unique instance key for this skill configuration.
Returns:
| Type | Description |
|---|---|
str
|
Unique key combining skill name and tool name |
setup()
¶
Setup the skill - no external dependencies needed.
Returns:
| Type | Description |
|---|---|
bool
|
True if setup successful |
register_tools()
¶
Register SWAIG tools with the agent
get_tools()
¶
Generate the SWAIG tool with DataMap expressions.
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
List containing the generated tool configuration |
registry
¶
Copyright (c) 2025 SignalWire
This file is part of the SignalWire SDK.
Licensed under the MIT License. See LICENSE file in the project root for full license information.
skill_registry = SkillRegistry()
module-attribute
¶
SkillRegistry
¶
Global registry for on-demand skill loading
logger = get_logger('skill_registry')
instance-attribute
¶
__init__()
¶
discover_skills()
¶
Discover and return all available skills.
Skills load on-demand, so there is nothing to eagerly register; this scans the skills package and returns metadata for everything discoverable, so callers can enumerate what is available.
register_skill(skill_class)
¶
Register a skill class directly
This allows third-party code to register skill classes without requiring them to be in a specific directory structure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
skill_class
|
type[SkillBase]
|
A class that inherits from SkillBase |
required |
Example
from my_custom_skills import MyWeatherSkill skill_registry.register_skill(MyWeatherSkill)
get_skill_class(skill_name)
¶
Get skill class by name, loading on-demand if needed
list_skills()
¶
List all available skills by scanning directories (only when explicitly requested)
get_all_skills_schema()
¶
Get complete schema for all available skills including parameter metadata
This method scans all available skills and returns a comprehensive schema that includes skill metadata and parameter definitions suitable for GUI configuration or API documentation.
Returns:
| Type | Description |
|---|---|
dict[str, dict[str, Any]]
|
Dict[str, Dict[str, Any]]: Complete skill schema where keys are skill names |
dict[str, dict[str, Any]]
|
and values contain: - name: Skill name - description: Skill description - version: Skill version - supports_multiple_instances: Whether multiple instances are allowed - required_packages: List of required Python packages - required_env_vars: List of required environment variables - parameters: Parameter schema from get_parameter_schema() - source: Where the skill was loaded from ('built-in', 'external', 'entry_point', 'registered') |
Example
{ "web_search": { "name": "web_search", "description": "Search the web for information", "version": "1.0.0", "supports_multiple_instances": True, "required_packages": ["bs4", "requests"], "required_env_vars": [], "parameters": { "api_key": { "type": "string", "description": "Google API key", "required": True, "hidden": True, "env_var": "GOOGLE_SEARCH_API_KEY" }, ... }, "source": "built-in" } }
add_skill_directory(path)
¶
Add a directory to search for skills
This allows third-party skill collections to be registered by path. Skills in these directories should follow the same structure as built-in skills: - Each skill in its own subdirectory - skill.py file containing the skill class
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path to directory containing skill subdirectories |
required |
Example
skill_registry.add_skill_directory('/opt/custom_skills')
Now agent.add_skill('my_custom_skill') will search in this directory¶
list_all_skill_sources()
¶
List all skill sources and the skills available from each
Returns a dictionary mapping source types to lists of skill names: { 'built-in': ['datetime', 'math', ...], 'external_paths': ['custom_skill1', ...], 'entry_points': ['weather', ...], 'registered': ['my_skill', ...] }
spider
¶
Copyright (c) 2025 SignalWire
This file is part of the SignalWire SDK.
Licensed under the MIT License. See LICENSE file in the project root for full license information.
Spider skill for web scraping.
__all__ = ['SpiderSkill']
module-attribute
¶
SpiderSkill
¶
Bases: SkillBase
Fast web scraping skill optimized for speed and token efficiency.
SKILL_NAME = 'spider'
class-attribute
instance-attribute
¶
SKILL_DESCRIPTION = 'Fast web scraping and crawling capabilities'
class-attribute
instance-attribute
¶
SKILL_VERSION = '1.0.0'
class-attribute
instance-attribute
¶
REQUIRED_PACKAGES = ['lxml']
class-attribute
¶
REQUIRED_ENV_VARS = []
class-attribute
¶
SUPPORTS_MULTIPLE_INSTANCES = True
class-attribute
instance-attribute
¶
WHITESPACE_REGEX = re.compile('\\s+')
class-attribute
instance-attribute
¶
delay = self.params.get('delay', 0.1)
instance-attribute
¶
concurrent_requests = self.params.get('concurrent_requests', 5)
instance-attribute
¶
timeout = self.params.get('timeout', 5)
instance-attribute
¶
max_pages = self.params.get('max_pages', 1)
instance-attribute
¶
max_depth = self.params.get('max_depth', 0)
instance-attribute
¶
extract_type = self.params.get('extract_type', 'fast_text')
instance-attribute
¶
max_text_length = self.params.get('max_text_length', 3000)
instance-attribute
¶
clean_text = self.params.get('clean_text', True)
instance-attribute
¶
cache_enabled = self.params.get('cache_enabled', True)
instance-attribute
¶
follow_robots_txt = self.params.get('follow_robots_txt', False)
instance-attribute
¶
user_agent = self.params.get('user_agent', 'Spider/1.0 (SignalWire AI Agent)')
instance-attribute
¶
headers = self.params.get('headers', {})
instance-attribute
¶
session = requests.Session()
instance-attribute
¶
remove_xpaths = ['//script', '//style', '//nav', '//header', '//footer', '//aside', '//noscript']
instance-attribute
¶
get_parameter_schema()
classmethod
¶
Get parameter schema for Spider skill
__init__(agent, params)
¶
Initialize the spider skill with configuration parameters.
get_instance_key()
¶
Return unique key for this skill instance.
setup()
¶
Validate configuration and setup the skill.
register_tools()
¶
Register the web scraping tools with the agent.
get_hints()
¶
Return speech recognition hints for this skill.
cleanup()
¶
Clean up resources when skill is unloaded.
skill
¶
Copyright (c) 2025 SignalWire
This file is part of the SignalWire SDK.
Licensed under the MIT License. See LICENSE file in the project root for full license information.
Spider skill for fast web scraping with SignalWire AI Agents.
SpiderSkill
¶
Bases: SkillBase
Fast web scraping skill optimized for speed and token efficiency.
SKILL_NAME = 'spider'
class-attribute
instance-attribute
¶
SKILL_DESCRIPTION = 'Fast web scraping and crawling capabilities'
class-attribute
instance-attribute
¶
SKILL_VERSION = '1.0.0'
class-attribute
instance-attribute
¶
REQUIRED_PACKAGES = ['lxml']
class-attribute
¶
REQUIRED_ENV_VARS = []
class-attribute
¶
SUPPORTS_MULTIPLE_INSTANCES = True
class-attribute
instance-attribute
¶
WHITESPACE_REGEX = re.compile('\\s+')
class-attribute
instance-attribute
¶
delay = self.params.get('delay', 0.1)
instance-attribute
¶
concurrent_requests = self.params.get('concurrent_requests', 5)
instance-attribute
¶
timeout = self.params.get('timeout', 5)
instance-attribute
¶
max_pages = self.params.get('max_pages', 1)
instance-attribute
¶
max_depth = self.params.get('max_depth', 0)
instance-attribute
¶
extract_type = self.params.get('extract_type', 'fast_text')
instance-attribute
¶
max_text_length = self.params.get('max_text_length', 3000)
instance-attribute
¶
clean_text = self.params.get('clean_text', True)
instance-attribute
¶
cache_enabled = self.params.get('cache_enabled', True)
instance-attribute
¶
follow_robots_txt = self.params.get('follow_robots_txt', False)
instance-attribute
¶
user_agent = self.params.get('user_agent', 'Spider/1.0 (SignalWire AI Agent)')
instance-attribute
¶
headers = self.params.get('headers', {})
instance-attribute
¶
session = requests.Session()
instance-attribute
¶
remove_xpaths = ['//script', '//style', '//nav', '//header', '//footer', '//aside', '//noscript']
instance-attribute
¶
get_parameter_schema()
classmethod
¶
Get parameter schema for Spider skill
__init__(agent, params)
¶
Initialize the spider skill with configuration parameters.
get_instance_key()
¶
Return unique key for this skill instance.
setup()
¶
Validate configuration and setup the skill.
register_tools()
¶
Register the web scraping tools with the agent.
get_hints()
¶
Return speech recognition hints for this skill.
cleanup()
¶
Clean up resources when skill is unloaded.
swml_transfer
¶
Copyright (c) 2025 SignalWire
This file is part of the SignalWire SDK.
Licensed under the MIT License. See LICENSE file in the project root for full license information.
skill
¶
Copyright (c) 2025 SignalWire
This file is part of the SignalWire SDK.
Licensed under the MIT License. See LICENSE file in the project root for full license information.
SWMLTransferSkill
¶
Bases: SkillBase
Skill for transferring calls between agents using SWML with pattern matching
SKILL_NAME = 'swml_transfer'
class-attribute
instance-attribute
¶
SKILL_DESCRIPTION = 'Transfer calls between agents based on pattern matching'
class-attribute
instance-attribute
¶
SKILL_VERSION = '1.0.0'
class-attribute
instance-attribute
¶
REQUIRED_PACKAGES = []
class-attribute
¶
REQUIRED_ENV_VARS = []
class-attribute
¶
SUPPORTS_MULTIPLE_INSTANCES = True
class-attribute
instance-attribute
¶
get_parameter_schema()
classmethod
¶
Get parameter schema for SWML Transfer skill
get_instance_key()
¶
Get the key used to track this skill instance
For SWML transfer, we use the tool name to differentiate instances
setup()
¶
Setup and validate skill configuration
register_tools()
¶
Register the transfer tool with pattern matching
get_hints()
¶
Return speech recognition hints
get_prompt_sections()
¶
Return prompt sections to add to agent
weather_api
¶
Copyright (c) 2025 SignalWire
This file is part of the SignalWire SDK.
Licensed under the MIT License. See LICENSE file in the project root for full license information.
__all__ = ['WeatherApiSkill']
module-attribute
¶
WeatherApiSkill
¶
Bases: SkillBase
Skill for getting weather information from WeatherAPI.com.
Provides current weather data with configurable temperature units and TTS-optimized natural language responses.
Configuration: - tool_name: Custom name for the generated SWAIG function - api_key: WeatherAPI.com API key - temperature_unit: "fahrenheit" or "celsius" for temperature display
Example
agent.add_skill("weather_api", { "tool_name": "get_weather", "api_key": "your_weatherapi_key", "temperature_unit": "fahrenheit" })
SKILL_NAME = 'weather_api'
class-attribute
instance-attribute
¶
SKILL_DESCRIPTION = 'Get current weather information from WeatherAPI.com'
class-attribute
instance-attribute
¶
SUPPORTS_MULTIPLE_INSTANCES = False
class-attribute
instance-attribute
¶
REQUIRED_ENV_VARS = []
class-attribute
¶
tool_name = self.params.get('tool_name', 'get_weather')
instance-attribute
¶
api_key = self.params.get('api_key')
instance-attribute
¶
temperature_unit = self.params.get('temperature_unit', 'fahrenheit')
instance-attribute
¶
get_parameter_schema()
classmethod
¶
Get parameter schema for weather API skill
__init__(agent, params=None)
¶
Initialize the skill with configuration parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent
|
AgentBase
|
The agent instance this skill belongs to |
required |
params
|
dict[str, Any] | None
|
Configuration dictionary containing: - tool_name: Custom tool name (default: "get_weather") - api_key: WeatherAPI.com API key (required) - temperature_unit: "fahrenheit" or "celsius" (default: "fahrenheit") |
None
|
setup()
¶
Setup the skill - validates API key is available.
Returns:
| Type | Description |
|---|---|
bool
|
True if setup successful |
register_tools()
¶
Register SWAIG tools with the agent
get_tools()
¶
Generate the SWAIG tool with DataMap webhook.
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
List containing the generated tool configuration |
skill
¶
Copyright (c) 2025 SignalWire
This file is part of the SignalWire SDK.
Licensed under the MIT License. See LICENSE file in the project root for full license information.
Weather API Skill
A configurable skill for getting weather information from WeatherAPI.com with customizable temperature units and TTS-friendly responses.
WeatherApiSkill
¶
Bases: SkillBase
Skill for getting weather information from WeatherAPI.com.
Provides current weather data with configurable temperature units and TTS-optimized natural language responses.
Configuration: - tool_name: Custom name for the generated SWAIG function - api_key: WeatherAPI.com API key - temperature_unit: "fahrenheit" or "celsius" for temperature display
Example
agent.add_skill("weather_api", { "tool_name": "get_weather", "api_key": "your_weatherapi_key", "temperature_unit": "fahrenheit" })
SKILL_NAME = 'weather_api'
class-attribute
instance-attribute
¶
SKILL_DESCRIPTION = 'Get current weather information from WeatherAPI.com'
class-attribute
instance-attribute
¶
SUPPORTS_MULTIPLE_INSTANCES = False
class-attribute
instance-attribute
¶
REQUIRED_ENV_VARS = []
class-attribute
¶
tool_name = self.params.get('tool_name', 'get_weather')
instance-attribute
¶
api_key = self.params.get('api_key')
instance-attribute
¶
temperature_unit = self.params.get('temperature_unit', 'fahrenheit')
instance-attribute
¶
get_parameter_schema()
classmethod
¶
Get parameter schema for weather API skill
__init__(agent, params=None)
¶
Initialize the skill with configuration parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent
|
AgentBase
|
The agent instance this skill belongs to |
required |
params
|
dict[str, Any] | None
|
Configuration dictionary containing: - tool_name: Custom tool name (default: "get_weather") - api_key: WeatherAPI.com API key (required) - temperature_unit: "fahrenheit" or "celsius" (default: "fahrenheit") |
None
|
setup()
¶
Setup the skill - validates API key is available.
Returns:
| Type | Description |
|---|---|
bool
|
True if setup successful |
register_tools()
¶
Register SWAIG tools with the agent
get_tools()
¶
Generate the SWAIG tool with DataMap webhook.
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
List containing the generated tool configuration |
web_search
¶
Copyright (c) 2025 SignalWire
This file is part of the SignalWire SDK.
Licensed under the MIT License. See LICENSE file in the project root for full license information.
skill
¶
Copyright (c) 2025 SignalWire
This file is part of the SignalWire SDK.
Licensed under the MIT License. See LICENSE file in the project root for full license information.
GoogleSearchScraper
¶
Google Search and Web Scraping functionality with quality scoring
api_key = api_key
instance-attribute
¶
search_engine_id = search_engine_id
instance-attribute
¶
max_content_length = max_content_length
instance-attribute
¶
session = requests.Session()
instance-attribute
¶
__init__(api_key, search_engine_id, max_content_length=32768)
¶
search_google(query, num_results=5)
¶
Search Google using Custom Search JSON API
is_reddit_url(url)
¶
Check if URL is from Reddit
extract_reddit_content(url, content_limit=None, timeout=10)
¶
Extract Reddit content using JSON API for better quality
Returns:
| Type | Description |
|---|---|
tuple[str, dict[str, Any]]
|
Tuple of (text_content, quality_metrics) |
extract_text_from_url(url, content_limit=None, timeout=10)
¶
Main extraction method that routes to appropriate extractor
Returns:
| Type | Description |
|---|---|
tuple[str, dict[str, Any]]
|
Tuple of (text_content, quality_metrics) |
extract_html_content(url, content_limit=None, timeout=10)
¶
Original HTML extraction method (renamed from extract_text_from_url)
search_and_scrape_best(query, num_results=3, oversample_factor=4.0, delay=0.5, min_quality_score=0.2, per_page_timeout=2.0, overall_deadline=10.0, parallel_scrape=True, snippets_only=False)
¶
Search and scrape with quality filtering and source diversity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
Search query |
required |
num_results
|
int
|
Number of best results to return |
3
|
oversample_factor
|
float
|
How many extra results to fetch (e.g., 4.0 = fetch 4x) |
4.0
|
delay
|
float
|
Delay between scrape requests (ignored in parallel mode) |
0.5
|
min_quality_score
|
float
|
Minimum quality score to include a result |
0.2
|
per_page_timeout
|
float
|
Max seconds to wait on each page scrape |
2.0
|
overall_deadline
|
float
|
Wall-clock budget (seconds) for the whole call. Anything not yet returned by this deadline is abandoned. |
10.0
|
parallel_scrape
|
bool
|
Run all page scrapes concurrently in a thread pool |
True
|
snippets_only
|
bool
|
Skip page scraping entirely; format the CSE snippets directly. Use for fast voice answers when full page content is not required. |
False
|
Returns:
| Type | Description |
|---|---|
str
|
Formatted string with the best N results from diverse sources |
search_and_scrape(query, num_results=3, delay=0.5)
¶
Backward compatible method that uses the improved search
WebSearchSkill
¶
Bases: SkillBase
Web search capability using Google Custom Search API with quality filtering
SKILL_NAME = 'web_search'
class-attribute
instance-attribute
¶
SKILL_DESCRIPTION = 'Search the web for information using Google Custom Search API'
class-attribute
instance-attribute
¶
SKILL_VERSION = '2.0.0'
class-attribute
instance-attribute
¶
REQUIRED_PACKAGES = ['bs4', 'requests']
class-attribute
¶
REQUIRED_ENV_VARS = []
class-attribute
¶
SUPPORTS_MULTIPLE_INSTANCES = True
class-attribute
instance-attribute
¶
get_instance_key()
¶
Get the key used to track this skill instance
setup()
¶
Setup the web search skill
register_tools()
¶
Register web search tool with the agent
get_hints()
¶
Return speech recognition hints
get_global_data()
¶
Return global data for agent context
get_prompt_sections()
¶
Return prompt sections to add to agent
get_parameter_schema()
classmethod
¶
Get the parameter schema for the web search skill
skill_improved
¶
Copyright (c) 2025 SignalWire
This file is part of the SignalWire SDK.
Licensed under the MIT License. See LICENSE file in the project root for full license information.
GoogleSearchScraper
¶
Google Search and Web Scraping functionality with quality scoring
api_key = api_key
instance-attribute
¶
search_engine_id = search_engine_id
instance-attribute
¶
max_content_length = max_content_length
instance-attribute
¶
session = requests.Session()
instance-attribute
¶
__init__(api_key, search_engine_id, max_content_length=32768)
¶
search_google(query, num_results=5)
¶
Search Google using Custom Search JSON API
extract_text_from_url(url, content_limit=None, timeout=10)
¶
Scrape a URL and extract readable text content with quality metrics
Returns:
| Type | Description |
|---|---|
tuple[str, dict[str, Any]]
|
Tuple of (text_content, quality_metrics) |
search_and_scrape_best(query, num_results=3, oversample_factor=2.5, delay=0.5, min_quality_score=0.3)
¶
Search and scrape with quality filtering
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
Search query |
required |
num_results
|
int
|
Number of best results to return |
3
|
oversample_factor
|
float
|
How many extra results to fetch (e.g., 2.5 = fetch 2.5x) |
2.5
|
delay
|
float
|
Delay between requests |
0.5
|
min_quality_score
|
float
|
Minimum quality score to include a result |
0.3
|
Returns:
| Type | Description |
|---|---|
str
|
Formatted string with the best N results |
search_and_scrape(query, num_results=3, delay=0.5)
¶
Backward compatible method that uses the improved search
WebSearchSkill
¶
Bases: SkillBase
Web search capability using Google Custom Search API with quality filtering
SKILL_NAME = 'web_search'
class-attribute
instance-attribute
¶
SKILL_DESCRIPTION = 'Search the web for information using Google Custom Search API'
class-attribute
instance-attribute
¶
SKILL_VERSION = '2.0.0'
class-attribute
instance-attribute
¶
REQUIRED_PACKAGES = ['bs4', 'requests']
class-attribute
¶
REQUIRED_ENV_VARS = []
class-attribute
¶
SUPPORTS_MULTIPLE_INSTANCES = True
class-attribute
instance-attribute
¶
get_instance_key()
¶
Get the key used to track this skill instance
setup()
¶
Setup the web search skill
register_tools()
¶
Register web search tool with the agent
get_hints()
¶
Return speech recognition hints
get_global_data()
¶
Return global data for agent context
get_prompt_sections()
¶
Return prompt sections to add to agent
get_parameter_schema()
classmethod
¶
Get the parameter schema for the web search skill
skill_original
¶
Copyright (c) 2025 SignalWire
This file is part of the SignalWire SDK.
Licensed under the MIT License. See LICENSE file in the project root for full license information.
GoogleSearchScraper
¶
Google Search and Web Scraping functionality
api_key = api_key
instance-attribute
¶
search_engine_id = search_engine_id
instance-attribute
¶
max_content_length = max_content_length
instance-attribute
¶
session = requests.Session()
instance-attribute
¶
__init__(api_key, search_engine_id, max_content_length=32768)
¶
search_google(query, num_results=5)
¶
Search Google using Custom Search JSON API
extract_text_from_url(url, content_limit=None, timeout=10)
¶
Scrape a URL and extract readable text content
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
URL to scrape |
required |
content_limit
|
int | None
|
Maximum characters to return (uses self.max_content_length if not provided) |
None
|
timeout
|
int
|
Request timeout in seconds |
10
|
search_and_scrape(query, num_results=3, delay=0.5)
¶
Main function: search Google and scrape the resulting pages
Dynamically calculates per-result content limit based on total max_content_length and number of results to ensure total response stays within bounds.
WebSearchSkill
¶
Bases: SkillBase
Web search capability using Google Custom Search API
SKILL_NAME = 'web_search'
class-attribute
instance-attribute
¶
SKILL_DESCRIPTION = 'Search the web for information using Google Custom Search API'
class-attribute
instance-attribute
¶
SKILL_VERSION = '1.0.0'
class-attribute
instance-attribute
¶
REQUIRED_PACKAGES = ['bs4', 'requests']
class-attribute
¶
REQUIRED_ENV_VARS = []
class-attribute
¶
SUPPORTS_MULTIPLE_INSTANCES = True
class-attribute
instance-attribute
¶
get_instance_key()
¶
Get the key used to track this skill instance
For web search, we use the search_engine_id to differentiate instances
setup()
¶
Setup the web search skill
register_tools()
¶
Register web search tool with the agent
get_hints()
¶
Return speech recognition hints
get_global_data()
¶
Return global data for agent context
get_prompt_sections()
¶
Return prompt sections to add to agent
get_parameter_schema()
classmethod
¶
Get the parameter schema for the web search skill
Returns all configurable parameters for web search including API credentials, search settings, and response customization.
wikipedia_search
¶
Copyright (c) 2025 SignalWire
This file is part of the SignalWire SDK.
Licensed under the MIT License. See LICENSE file in the project root for full license information.
Wikipedia Search Skill
This skill provides Wikipedia search capabilities using the Wikipedia API.
__all__ = ['WikipediaSearchSkill']
module-attribute
¶
WikipediaSearchSkill
¶
Bases: SkillBase
Skill for searching Wikipedia articles and retrieving content.
This skill uses the Wikipedia API to search for articles and retrieve their introductory content, similar to getting a summary of a topic.
SKILL_NAME = 'wikipedia_search'
class-attribute
instance-attribute
¶
SKILL_DESCRIPTION = 'Search Wikipedia for information about a topic and get article summaries'
class-attribute
instance-attribute
¶
SKILL_VERSION = '1.0.0'
class-attribute
instance-attribute
¶
REQUIRED_PACKAGES = ['requests']
class-attribute
¶
REQUIRED_ENV_VARS = []
class-attribute
¶
SUPPORTS_MULTIPLE_INSTANCES = False
class-attribute
instance-attribute
¶
get_parameter_schema()
classmethod
¶
Get parameter schema for Wikipedia search skill
setup()
¶
Setup the Wikipedia search skill.
Returns:
| Type | Description |
|---|---|
bool
|
True if setup successful, False otherwise |
register_tools()
¶
Register the SWAIG tool for Wikipedia search.
search_wiki(query)
¶
Search Wikipedia for articles matching the query.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
The search term to look up |
required |
Returns:
| Type | Description |
|---|---|
str
|
String containing the Wikipedia article content or error message |
get_prompt_sections()
¶
Return additional context for the agent prompt.
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
List of prompt sections to add to the agent |
get_hints()
¶
Return speech recognition hints for better accuracy.
Returns:
| Type | Description |
|---|---|
list[str]
|
List of words/phrases to help with speech recognition |
skill
¶
Copyright (c) 2025 SignalWire
This file is part of the SignalWire SDK.
Licensed under the MIT License. See LICENSE file in the project root for full license information.
Wikipedia Search Skill
Provides Wikipedia search capabilities using the Wikipedia API.
WikipediaSearchSkill
¶
Bases: SkillBase
Skill for searching Wikipedia articles and retrieving content.
This skill uses the Wikipedia API to search for articles and retrieve their introductory content, similar to getting a summary of a topic.
SKILL_NAME = 'wikipedia_search'
class-attribute
instance-attribute
¶
SKILL_DESCRIPTION = 'Search Wikipedia for information about a topic and get article summaries'
class-attribute
instance-attribute
¶
SKILL_VERSION = '1.0.0'
class-attribute
instance-attribute
¶
REQUIRED_PACKAGES = ['requests']
class-attribute
¶
REQUIRED_ENV_VARS = []
class-attribute
¶
SUPPORTS_MULTIPLE_INSTANCES = False
class-attribute
instance-attribute
¶
get_parameter_schema()
classmethod
¶
Get parameter schema for Wikipedia search skill
setup()
¶
Setup the Wikipedia search skill.
Returns:
| Type | Description |
|---|---|
bool
|
True if setup successful, False otherwise |
register_tools()
¶
Register the SWAIG tool for Wikipedia search.
search_wiki(query)
¶
Search Wikipedia for articles matching the query.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
The search term to look up |
required |
Returns:
| Type | Description |
|---|---|
str
|
String containing the Wikipedia article content or error message |
get_prompt_sections()
¶
Return additional context for the agent prompt.
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
List of prompt sections to add to the agent |
get_hints()
¶
Return speech recognition hints for better accuracy.
Returns:
| Type | Description |
|---|---|
list[str]
|
List of words/phrases to help with speech recognition |