***

title: register
slug: /reference/typescript/agents/agent-server/register
description: Register an agent at a URL route on the server.
max-toc-depth: 3
---------------------

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

[agentbase]: /docs/server-sdks/reference/typescript/agents/agent-base

Register an [`AgentBase`][agentbase] instance at a URL route
on the server. The agent's Hono app is mounted at the specified prefix so all of its
endpoints (SWML, SWAIG, debug, post-prompt) become available under that path.

<Warning>
  Throws `Error` if the route is already occupied by another agent.
</Warning>

## **Parameters**

<ParamField path="agent" type="AgentBase" required={true} toc={true}>
  The agent instance to register.
</ParamField>

<ParamField path="route" type="string" toc={true}>
  URL path prefix for this agent (e.g., `"/sales"`). If omitted, the agent's own `route`
  property is used. Leading slashes are added and trailing slashes are stripped automatically.
</ParamField>

## **Returns**

`void`

## **Example**

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

const salesAgent = new AgentBase({ name: 'sales-agent', route: '/sales' });
salesAgent.promptAddSection('Role', { body: 'You are a sales rep.' });

const server = new AgentServer({ port: 3000 });
server.register(salesAgent, '/sales');
await server.run();
```