Skip to navigation

getInstanceKey

View as MarkdownOpen in Claude

Get the unique key used to track this skill instance.

Returns

string — When the class’s SUPPORTS_MULTIPLE_INSTANCES is false (the default), returns this.skillName. When it’s true, returns "<skillName>_<toolName>", where toolName is config.tool_name or, if that’s unset, the skill name. Override it to key instances by something else.

Example

class NotifySkill extends SkillBase {
static SUPPORTS_MULTIPLE_INSTANCES = true;
// ...
}

Instance key behavior:

import { AgentBase } from '@signalwire/sdk';
const agent = new AgentBase({ name: 'demo' });
// With NotifySkill registered as "notify":
await agent.addSkillByName('notify');
// Instance key: "notify_notify"
await agent.addSkillByName('notify', { tool_name: 'email' });
// Instance key: "notify_email"
await agent.addSkillByName('notify', { tool_name: 'sms' });
// Instance key: "notify_sms"