For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Log inSign up
Support
GuidesReference
GuidesReference
    • Core
      • Overview
    • Agents
      • Overview
      • AgentBase
      • AgentServer
        • getAgent
        • getAgents
        • getApp
        • register
        • registerGlobalRoutingCallback
        • run
        • serveStaticFiles
        • setupSipRouting
        • unregister
      • Configuration
      • ContextBuilder
      • DataMap
      • FunctionResult
      • Helper Functions & Utilities
      • LiveWire
      • PomBuilder
      • Prefabs
      • SkillBase
      • SkillManager
      • SkillRegistry
      • Skills
      • SwaigFunction
      • SwmlBuilder
      • SWMLService
    • RELAY
      • Overview
      • Actions
      • Call
      • Constants
      • Events
      • Message
      • RelayClient
      • RelayError
    • REST Client
      • Overview
      • Addresses
      • Calling
      • ChatResource
      • Compat
      • Datasphere
      • Fabric
      • ImportedNumbersResource
      • Logs
      • LookupResource
      • MFA
      • Number Groups
      • Phone Numbers
      • Project
      • PubSubResource
      • Queues
      • Recordings
      • Registry
      • RestClient
      • RestError
      • Short Codes
      • SIP Profile
      • Verified Callers
      • Video
LogoLogoSignalWire Docs
Log inSign up
Support
On this page
  • Parameters
  • Returns
  • Example
AgentsAgentServer

register

|View as Markdown|Open in Claude|
Was this page helpful?
Edit this page
Previous

registerGlobalRoutingCallback

Next
Built with

Register an 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.

Throws Error if the route is already occupied by another agent.

Parameters

agent
AgentBaseRequired

The agent instance to register.

route
string

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.

Returns

void

Example

1import { AgentBase, AgentServer } from '@signalwire/sdk';
2
3const salesAgent = new AgentBase({ name: 'sales-agent', route: '/sales' });
4salesAgent.promptAddSection('Role', { body: 'You are a sales rep.' });
5
6const server = new AgentServer({ port: 3000 });
7server.register(salesAgent, '/sales');
8await server.run();