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

1from signalwire.core.skill_base import SkillBase
2from signalwire import FunctionResult
3
4class WeatherSkill(SkillBase):
5 SKILL_NAME = "weather"
6 SKILL_DESCRIPTION = "Provides weather information"
7
8 def setup(self) -> bool:
9 return True
10
11 def register_tools(self):
12 self.define_tool(
13 name="get_weather",
14 description="Get current weather for a location",
15 handler=self._handle_weather,
16 parameters={
17 "type": "object",
18 "properties": {
19 "location": {
20 "type": "string",
21 "description": "City name"
22 }
23 },
24 "required": ["location"]
25 }
26 )
27
28 def _handle_weather(self, args, raw_data):
29 location = args.get("location")
30 return FunctionResult(f"Weather in {location}: sunny, 72F")