asRouter

View as MarkdownOpen in Claude

Get this agent’s Hono application for mounting as a sub-router in a larger Hono application or an AgentServer.

Parameters

None.

Returns

Hono — A Hono app with all agent endpoints (SWML delivery, SWAIG function handling, post-prompt, debug events, health checks, etc.).

Example

1import { Hono } from 'hono';
2import { AgentBase } from '@signalwire/sdk';
3
4const app = new Hono();
5
6const supportAgent = new AgentBase({ name: 'support', route: '/support' });
7const salesAgent = new AgentBase({ name: 'sales', route: '/sales' });
8
9app.route('/support', supportAgent.asRouter());
10app.route('/sales', salesAgent.asRouter());