> For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

# getAgent

> Get the agent this skill is attached to.

[ref-setagent]: /docs/server-sdks/reference/typescript/agents/skill-base/set-agent

Get the [`AgentBase`](/docs/server-sdks/reference/typescript/agents/agent-base)
that owns this skill instance. Called internally from `setup()` and tool
handlers to interact with the agent's configuration, tools, or global data.

<Warning>
  Throws `Error` when called before the skill has been attached. The
  `SkillManager` calls [`setAgent()`][ref-setagent] as part of
  `addSkill()`; only call `getAgent()` from `setup()` or tool handlers where
  attachment is guaranteed.
</Warning>

## **Returns**

`AgentBase` -- the owning agent.

## **Example**

```typescript {9}
import { SkillBase } from '@signalwire/sdk';

export class MySkill extends SkillBase {
  static SKILL_NAME = 'my-skill';
  static SKILL_DESCRIPTION = 'An example skill';

  async setup(): Promise<boolean> {
    const agent = this.getAgent();
    agent.addHint('Prefer concise answers.');
    return true;
  }
}
```