Skill Config

View as MarkdownOpen in Claude

Skill Configuration

Configure skills with parameters, environment variables, and SWAIG field overrides. Understand the parameter schema and discovery options.

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:

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:

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_agents.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_agents.skills": [
6 "weather = my_package.skills:WeatherSkill",
7 "stock = my_package.skills:StockSkill"
8 ]
9 }
10)

Listing Available Skills

1from signalwire_agents.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:

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

Skills validate configuration in setup():

Validation Flow.
Validation Flow

Complete Configuration Example

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