getAgent

View as MarkdownOpen in Claude

Get the AgentBase that owns this skill instance. Called internally from setup() and tool handlers to interact with the agent’s configuration, tools, or global data.

Throws Error when called before the skill has been attached. The SkillManager calls setAgent() as part of addSkill(); only call getAgent() from setup() or tool handlers where attachment is guaranteed.

Returns

AgentBase — the owning agent.

Example

1import { SkillBase } from '@signalwire/sdk';
2
3export class MySkill extends SkillBase {
4 static SKILL_NAME = 'my-skill';
5 static SKILL_DESCRIPTION = 'An example skill';
6
7 async setup(): Promise<boolean> {
8 const agent = this.getAgent();
9 agent.addHint('Prefer concise answers.');
10 return true;
11 }
12}