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

import { Hono } from 'hono';
import { AgentBase } from '@signalwire/sdk';
const app = new Hono();
const supportAgent = new AgentBase({ name: 'support', route: '/support' });
const salesAgent = new AgentBase({ name: 'sales', route: '/sales' });
app.route('/support', supportAgent.asRouter());
app.route('/sales', salesAgent.asRouter());