getInstanceKey

View as MarkdownOpen in Claude

Get the unique key used to track this skill instance.

Returns

string — By default, returns this.skillName. Subclasses that support multiple instances typically override this to return a more specific key (e.g., "<skillName>_<toolName>" derived from config).

Example

1class MySkill extends SkillBase {
2 getInstanceKey(): string {
3 const toolName = this.getConfig<string>('tool_name');
4 return toolName ? `${this.skillName}_${toolName}` : this.skillName;
5 }
6}

Instance key behavior:

1import { AgentBase } from '@signalwire/sdk';
2
3const agent = new AgentBase({ name: 'demo' });
4agent.addSkill("notify")
5// Instance key: "notify"
6
7agent.addSkill("notify", {"tool_name": "email"})
8// Instance key: "notify_email"
9
10agent.addSkill("notify", {"tool_name": "sms"})
11// Instance key: "notify_sms"