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

# setAgent

> Attach the skill to an agent (called by the SkillManager).

[ref-getagent]: /docs/server-sdks/reference/typescript/agents/skill-base/get-agent

[ref-skillmanager]: /docs/server-sdks/reference/typescript/agents/skill-manager

Attach this skill to an [`AgentBase`](/docs/server-sdks/reference/typescript/agents/agent-base).
Called by the [`SkillManager`][ref-skillmanager] during
`agent.addSkill()` before `setup()` runs, so [`getAgent()`][ref-getagent] is
safe from within `setup()` and tool handlers.

<Note>
  Normally not called directly. If you are implementing a custom skill loader
  that bypasses `addSkill()`, call this yourself before invoking `setup()`.
</Note>

## **Parameters**

<ParamField path="agent" type="AgentBase" required={true} toc={true}>
  The agent instance that owns this skill.
</ParamField>

## **Returns**

`void`

## **Example**

```typescript {7}
import { AgentBase, SkillBase } from '@signalwire/sdk';

class InlineSkill extends SkillBase { /* ... */ }

const agent = new AgentBase({ name: 'demo' });
const skill = new InlineSkill();
skill.setAgent(agent);
await skill.setup();
```