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
      • 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
  • Example
  • Classes
Agents

Agents

TypeScript API reference for AgentBase, SWMLService, SWAIG functions, skills, contexts, LiveWire, and more
|View as Markdown|Open in Claude|
Was this page helpful?
Edit this page
Previous

AgentBase

Next
Built with

The Agents namespace provides the core framework for building AI-powered voice agents with SignalWire. It includes the central AgentBase class, SWML document generation, tool/function definitions, skills, multi-agent hosting, CLI tools for local testing and deployment, and configuration management for security and environment settings.

The Agents SDK generates SWML documents under the hood. Each agent produces a SWML document with the ai verb that the SignalWire platform executes.

Example

A complete agent that answers calls, uses an AI prompt, and exposes a custom tool:

1import { AgentBase, FunctionResult } from '@signalwire/sdk';
2
3const agent = new AgentBase({ name: 'support-agent', route: '/support' });
4agent.setPromptText(
5 'You are a friendly support agent for Acme Corp. ' +
6 'Help customers check their order status. ' +
7 'Be concise and professional.'
8);
9agent.setParams({ temperature: 0.5, end_of_speech_timeout: 800 });
10
11agent.defineTool({
12 name: 'check_order',
13 description: 'Check an order status by ID',
14 parameters: {
15 order_id: { type: 'string', description: 'The order ID to check' },
16 },
17 handler: (args, rawData) => {
18 const orderId = (args.order_id as string) || 'unknown';
19 return new FunctionResult(`Order ${orderId} shipped on March 28 and arrives tomorrow.`);
20 },
21});
22
23agent.addSkill('datetime');
24
25agent.run();

Classes

AgentBase

The central class for building AI agents. Manages prompts, tools, skills, and serving.

SWMLService

SWML document generation and Hono service for non-AI call flows.

SWMLBuilder

Fluent builder for constructing SWML documents programmatically.

SwaigFunction

Wraps TypeScript functions as callable SWAIG tools with validation and metadata.

FunctionResult

Fluent interface for returning actions and responses from tool functions.

ContextBuilder

Multi-step agent workflows with context and step navigation.

DataMap

Server-side API tools that execute REST calls without agent webhooks.

SkillBase

Base class for building reusable skill plugins.

PomBuilder

Prompt Object Model builder for structured prompt composition.

AgentServer

Host multiple agents on a single Hono process with route-based dispatch.

Prefabs

Pre-built agent templates for common conversational patterns.

Skills

Built-in skills catalog with 19 pluggable capabilities.

Configuration

Environment variables, config files, security settings, and authentication.

LiveWire

LiveKit-compatible API layer — use familiar livekit-agents classes on SignalWire infrastructure.

SkillManager

Manages the lifecycle of skills loaded on an agent.

SkillRegistry

Global singleton for registering and discovering skills by name.

Helpers & Utilities

Context creation, API tools, security utilities, type inference, and standalone functions.