Skill Configuration

View as MarkdownOpen in Claude

Configuration Methods

MethodDescription
Parameters dictPass config when calling add_skill()
Environment variablesSet via OS environment
SWAIG fieldsCustomize tool metadata
External directoriesRegister custom skill paths

Parameter Dictionary

Pass configuration when adding a skill:

LanguagePassing config parameters
Pythonself.add_skill("web_search", {"api_key": "...", "num_results": 5})
TypeScriptagent.addSkill('web_search', { apiKey: '...', numResults: 5 })
1self.add_skill("web_search", {
2 "api_key": "your-api-key",
3 "search_engine_id": "your-engine-id",
4 "num_results": 5,
5 "min_quality_score": 0.4
6})

Parameter Schema

Skills define their parameters via get_parameter_schema():

1{
2 "api_key": {
3 "type": "string",
4 "description": "Google API key",
5 "required": True,
6 "hidden": True,
7 "env_var": "GOOGLE_API_KEY"
8 },
9 "num_results": {
10 "type": "integer",
11 "description": "Number of results",
12 "default": 3,
13 "min": 1,
14 "max": 10
15 },
16 "style": {
17 "type": "string",
18 "description": "Output style",
19 "enum": ["brief", "detailed"],
20 "default": "brief"
21 }
22}

Parameter Properties

PropertyTypeDescription
typestringData type: string, integer, number, boolean, object, array
descriptionstringHuman-readable description
defaultanyDefault value if not provided
requiredboolWhether parameter is required
hiddenboolHide in UIs (for secrets)
env_varstringEnvironment variable source
enumarrayAllowed values
min/maxnumberValue range for numbers

Environment Variables

Skills can read from environment variables:

1import os
2
3## Set environment variable
4os.environ["GOOGLE_API_KEY"] = "your-key"
5
6## Skill reads from params or falls back to env
7self.add_skill("web_search", {
8 "api_key": os.getenv("GOOGLE_API_KEY"),
9 "search_engine_id": os.getenv("SEARCH_ENGINE_ID")
10})

SWAIG Fields

Override SWAIG function metadata for skill tools:

LanguageSWAIG fields override
Pythonself.add_skill("datetime", {"swaig_fields": {"fillers": {...}}})
TypeScriptagent.addSkill('datetime', { swaigFields: { fillers: {...} } })
1self.add_skill("datetime", {
2 "swaig_fields": {
3 # Add filler phrases while function executes
4 "fillers": {
5 "en-US": [
6 "Let me check the time...",
7 "One moment..."
8 ]
9 },
10 # Disable security for testing
11 "secure": False
12 }
13})

Available SWAIG fields:

FieldDescription
fillersLanguage-specific filler phrases
secureEnable/disable token validation
webhook_urlOverride webhook URL

External Skill Directories

Register custom skill directories:

1from signalwire.skills.registry import skill_registry
2
3## Add directory at runtime
4skill_registry.add_skill_directory("/opt/custom_skills")
5
6## Environment variable (colon-separated paths)
7## SIGNALWIRE_SKILL_PATHS=/path1:/path2:/path3

Entry Points

Install skills via pip packages:

1## In setup.py
2setup(
3 name="my-skills-package",
4 entry_points={
5 "signalwire.skills": [
6 "weather = my_package.skills:WeatherSkill",
7 "stock = my_package.skills:StockSkill"
8 ]
9 }
10)

Listing Available Skills

1from signalwire.skills.registry import skill_registry
2
3## List all available skills
4skills = skill_registry.list_skills()
5for skill in skills:
6 print(f"{skill['name']}: {skill['description']}")
7
8## Get complete schema for all skills
9schema = skill_registry.get_all_skills_schema()
10print(schema)

Multi-Instance Configuration

Skills supporting multiple instances need unique tool names:

LanguageMulti-instance with unique tool_name
Pythonself.add_skill("web_search", {"tool_name": "search_news", "api_key": "KEY"})
TypeScriptagent.addSkill('web_search', { toolName: 'search_news', apiKey: 'KEY' })
1## Instance 1: News search
2self.add_skill("web_search", {
3 "tool_name": "search_news", # Unique function name
4 "api_key": "KEY",
5 "search_engine_id": "NEWS_ENGINE"
6})
7
8## Instance 2: Documentation search
9self.add_skill("web_search", {
10 "tool_name": "search_docs", # Different function name
11 "api_key": "KEY",
12 "search_engine_id": "DOCS_ENGINE"
13})

Configuration Validation

Skill configuration validation flow diagram.
Validation Flow

Complete Configuration Example

1from signalwire import AgentBase
2from signalwire.skills.registry import skill_registry
3import os
4
5## Register external skills
6skill_registry.add_skill_directory("/opt/my_company/skills")
7
8class ConfiguredAgent(AgentBase):
9 def __init__(self):
10 super().__init__(name="configured-agent")
11 self.add_language("English", "en-US", "rime.spore")
12
13 # Simple skill - no config
14 self.add_skill("datetime")
15
16 # Skill with parameters
17 self.add_skill("web_search", {
18 "api_key": os.getenv("GOOGLE_API_KEY"),
19 "search_engine_id": os.getenv("SEARCH_ENGINE_ID"),
20 "num_results": 5,
21 "min_quality_score": 0.4
22 })
23
24 # Skill with SWAIG field overrides
25 self.add_skill("math", {
26 "swaig_fields": {
27 "fillers": {
28 "en-US": ["Calculating..."]
29 }
30 }
31 })
32
33 # Multi-instance skill
34 self.add_skill("native_vector_search", {
35 "tool_name": "search_products",
36 "index_path": "/data/products.swsearch"
37 })
38
39 self.add_skill("native_vector_search", {
40 "tool_name": "search_faqs",
41 "index_path": "/data/faqs.swsearch"
42 })
43
44 self.prompt_add_section(
45 "Role",
46 "You are a customer service agent."
47 )
48
49if __name__ == "__main__":
50 agent = ConfiguredAgent()
51 agent.run()

Configuration Best Practices

Security

  • Store API keys in environment variables
  • Never commit secrets to version control
  • Use hidden: true for sensitive parameters

Organization

  • Group related configuration
  • Use descriptive tool_name for multi-instance
  • Document required configuration

Validation

  • Check has_skill() before using conditionally
  • Handle ValueError from add_skill()
  • Validate parameters early in setup()

Next Steps

You’ve learned the complete skills system. Next, explore advanced topics like contexts, workflows, and state management.