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

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

Instance key behavior:

import { AgentBase } from '@signalwire/sdk';
const agent = new AgentBase({ name: 'demo' });
agent.addSkill("notify")
// Instance key: "notify"
agent.addSkill("notify", {"tool_name": "email"})
// Instance key: "notify_email"
agent.addSkill("notify", {"tool_name": "sms"})
// Instance key: "notify_sms"