AgentsSkillBase

register_tools

View as MarkdownOpen in Claude

Register SWAIG tools with the parent agent. Called after setup() returns True. Use self.define_tool() to register each tool.

This is an abstract method — you must implement it in every SkillBase subclass.

Returns

None

Example

from signalwire.core.skill_base import SkillBase
from signalwire import FunctionResult
class WeatherSkill(SkillBase):
SKILL_NAME = "weather"
SKILL_DESCRIPTION = "Provides weather information"
def setup(self) -> bool:
return True
def register_tools(self):
self.define_tool(
name="get_weather",
description="Get current weather for a location",
handler=self._handle_weather,
parameters={
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "City name"
}
},
"required": ["location"]
}
)
def _handle_weather(self, args, raw_data):
location = args.get("location")
return FunctionResult(f"Weather in {location}: sunny, 72F")