> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes. # SkillBase > Abstract base class for creating reusable, pluggable agent skills. [agentbase]: /docs/server-sdks/reference/python/agents/agent-base [skills]: /docs/server-sdks/reference/python/agents/skills [cleanup]: /docs/server-sdks/reference/python/agents/skill-base/cleanup [definetool]: /docs/server-sdks/reference/python/agents/skill-base/define-tool [getglobaldata]: /docs/server-sdks/reference/python/agents/skill-base/get-global-data [gethints]: /docs/server-sdks/reference/python/agents/skill-base/get-hints [getinstancekey]: /docs/server-sdks/reference/python/agents/skill-base/get-instance-key [getparameterschema]: /docs/server-sdks/reference/python/agents/skill-base/get-parameter-schema [getpromptsections]: /docs/server-sdks/reference/python/agents/skill-base/get-prompt-sections [registertools]: /docs/server-sdks/reference/python/agents/skill-base/register-tools [setup]: /docs/server-sdks/reference/python/agents/skill-base/setup [skill-data]: /docs/server-sdks/reference/python/agents/skill-base/skill-data [validate]: /docs/server-sdks/reference/python/agents/skill-base/validate SkillBase is the abstract base class for all agent skills. Skills are modular, reusable capabilities -- such as weather lookup, web search, or calendar access -- that can be added to any [`AgentBase`][agentbase] agent with a single call to `agent.add_skill()`. Extend SkillBase to create custom skills. The SDK discovers skills automatically from the `signalwire/skills/` directory and validates dependencies on load. > **Info** > > For the catalog of built-in skills and their configuration parameters, see > the [Skills][skills] page. ## **Class Attributes** Define these on your subclass to configure the skill: **`SKILL_NAME`** `str` — required Unique identifier for the skill (e.g., `"weather"`, `"web_search"`). Used as the key when calling `agent.add_skill()`. --- **`SKILL_DESCRIPTION`** `str` — required Human-readable description of the skill. --- **`SKILL_VERSION`** `str` — default: 1.0.0 Semantic version string. --- **`REQUIRED_PACKAGES`** `list[str]` — default: \[] Python packages the skill needs. Checked on setup with `validate_packages()`. --- **`REQUIRED_ENV_VARS`** `list[str]` — default: \[] Environment variables the skill needs. Checked on setup with `validate_env_vars()`. --- **`SUPPORTS_MULTIPLE_INSTANCES`** `bool` — default: false When `True`, the same skill can be added to an agent multiple times with different configurations (distinguished by a `tool_name` parameter). --- ## **Instance Properties** **`agent`** `AgentBase` Reference to the parent agent. --- **`params`** `dict[str, Any]` Configuration parameters (with `swaig_fields` removed). --- **`logger`** `Logger` Skill-specific logger namespaced as `signalwire.skills.`. --- **`swaig_fields`** `dict[str, Any]` SWAIG metadata extracted from params, automatically merged into tool definitions when using `define_tool()`. --- ## **Methods** #### [cleanup](/docs/server-sdks/reference/python/agents/skill-base/cleanup) Release resources when the skill is removed or the agent shuts down. #### [define\_tool](/docs/server-sdks/reference/python/agents/skill-base/define-tool) Register a tool with automatic swaig\_fields merging. #### [get\_global\_data](/docs/server-sdks/reference/python/agents/skill-base/get-global-data) Return data to merge into the agent's global\_data dictionary. #### [get\_hints](/docs/server-sdks/reference/python/agents/skill-base/get-hints) Return speech recognition hints for this skill. #### [get\_instance\_key](/docs/server-sdks/reference/python/agents/skill-base/get-instance-key) Get the unique key used to track this skill instance. #### [get\_parameter\_schema](/docs/server-sdks/reference/python/agents/skill-base/get-parameter-schema) Return metadata about all parameters the skill accepts. #### [get\_prompt\_sections](/docs/server-sdks/reference/python/agents/skill-base/get-prompt-sections) Return POM prompt sections for the agent. #### [register\_tools](/docs/server-sdks/reference/python/agents/skill-base/register-tools) Register SWAIG tools with the parent agent. #### [setup](/docs/server-sdks/reference/python/agents/skill-base/setup) Initialize the skill and validate dependencies. #### [get\_skill\_data](/docs/server-sdks/reference/python/agents/skill-base/get-skill-data) Read this skill instance's namespaced state. #### [update\_skill\_data](/docs/server-sdks/reference/python/agents/skill-base/update-skill-data) Write this skill instance's namespaced state into a FunctionResult. #### [validate\_env\_vars](/docs/server-sdks/reference/python/agents/skill-base/validate-env-vars) Check whether all required environment variables are set. #### [validate\_packages](/docs/server-sdks/reference/python/agents/skill-base/validate-packages) Check whether all required packages can be imported. ## **Examples** ### Custom skill ```python import os from signalwire.core.skill_base import SkillBase from signalwire import FunctionResult class WeatherSkill(SkillBase): SKILL_NAME = "weather" SKILL_DESCRIPTION = "Provides weather information" SKILL_VERSION = "1.0.0" REQUIRED_PACKAGES = ["requests"] REQUIRED_ENV_VARS = ["WEATHER_API_KEY"] def setup(self) -> bool: if not self.validate_packages(): return False if not self.validate_env_vars(): return False self.api_key = os.getenv("WEATHER_API_KEY") return True def register_tools(self): self.define_tool( name="get_weather", description="Get current weather for a location", handler=self._get_weather, parameters={ "type": "object", "properties": { "location": { "type": "string", "description": "City name or zip code" } }, "required": ["location"] } ) def _get_weather(self, args, raw_data): import requests location = args.get("location") resp = requests.get( f"https://api.weather.com/v1/current?q={location}&key={self.api_key}" ) data = resp.json() return FunctionResult( f"Weather in {location}: {data['condition']}, {data['temp']}F" ) def get_hints(self): return ["weather", "temperature", "forecast"] def _get_prompt_sections(self): return [{ "title": "Weather Information", "body": "You can check weather for any location." }] @classmethod def get_parameter_schema(cls): schema = super().get_parameter_schema() schema.update({ "units": { "type": "string", "description": "Temperature units", "default": "fahrenheit", "enum": ["fahrenheit", "celsius"] } }) return schema ``` ### Using a skill ```python from signalwire import AgentBase agent = AgentBase(name="weather-agent") agent.set_prompt_text("You are a helpful assistant.") agent.add_skill("weather") # Or with custom configuration agent.add_skill("weather", {"units": "celsius"}) if __name__ == "__main__": agent.run() ``` > Abstract base class for creating reusable, pluggable agent skills. ## Docs - [cleanup](https://signalwire.com/docs/server-sdks/reference/python/agents/skill-base/cleanup.md): Release resources when the skill is removed or the agent shuts down. - [define_tool](https://signalwire.com/docs/server-sdks/reference/python/agents/skill-base/define-tool.md): Register a tool with automatic swaig_fields merging. - [get_global_data](https://signalwire.com/docs/server-sdks/reference/python/agents/skill-base/get-global-data.md): Return data to merge into the agent's global_data dictionary. - [get_hints](https://signalwire.com/docs/server-sdks/reference/python/agents/skill-base/get-hints.md): Return speech recognition hints for this skill. - [get_instance_key](https://signalwire.com/docs/server-sdks/reference/python/agents/skill-base/get-instance-key.md): Get the unique key used to track this skill instance. - [get_parameter_schema](https://signalwire.com/docs/server-sdks/reference/python/agents/skill-base/get-parameter-schema.md): Return metadata about all parameters the skill accepts. - [get_prompt_sections](https://signalwire.com/docs/server-sdks/reference/python/agents/skill-base/get-prompt-sections.md): Return POM prompt sections for the agent. - [get_skill_data](https://signalwire.com/docs/server-sdks/reference/python/agents/skill-base/get-skill-data.md): Read this skill instance's namespaced state from raw_data. - [register_tools](https://signalwire.com/docs/server-sdks/reference/python/agents/skill-base/register-tools.md): Register SWAIG tools with the parent agent. - [setup](https://signalwire.com/docs/server-sdks/reference/python/agents/skill-base/setup.md): Initialize the skill and validate dependencies. - [update_skill_data](https://signalwire.com/docs/server-sdks/reference/python/agents/skill-base/update-skill-data.md): Write this skill instance's namespaced state into a FunctionResult. - [validate_env_vars](https://signalwire.com/docs/server-sdks/reference/python/agents/skill-base/validate-env-vars.md): Check whether all required environment variables are set. - [validate_packages](https://signalwire.com/docs/server-sdks/reference/python/agents/skill-base/validate-packages.md): Check whether all required packages can be imported.