***

title: Agents
sidebar-title: Overview
subtitle: TypeScript API reference for AgentBase, SWMLService, SWAIG functions, skills, contexts, LiveWire, search, and more
slug: /reference/typescript/agents
description: Core framework for building AI-powered voice agents.
max-toc-depth: 3
position: 0
---------------------

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

[swml]: /docs/swml/reference/ai

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

[swml-service]: /docs/server-sdks/reference/typescript/agents/swml-service

[swml-builder]: /docs/server-sdks/reference/typescript/agents/swml-builder

[swaig-function]: /docs/server-sdks/reference/typescript/agents/swaig-function

[function-result]: /docs/server-sdks/reference/typescript/agents/function-result

[context-builder]: /docs/server-sdks/reference/typescript/agents/context-builder

[data-map]: /docs/server-sdks/reference/typescript/agents/data-map

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

[pom-builder]: /docs/server-sdks/reference/typescript/agents/pom-builder

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

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

[prefabs]: /docs/server-sdks/reference/typescript/agents/prefabs

[skills]: /docs/server-sdks/reference/typescript/agents/skills

[cli]: /docs/server-sdks/reference/typescript/agents/cli

[configuration]: /docs/server-sdks/reference/typescript/agents/configuration

[livewire]: /docs/server-sdks/reference/typescript/agents/livewire

[search]: /docs/server-sdks/reference/typescript/agents/search

[mcp-gateway]: /docs/server-sdks/reference/typescript/agents/mcp-gateway

[web-service]: /docs/server-sdks/reference/typescript/agents/web-service

[helpers]: /docs/server-sdks/reference/typescript/agents/helpers

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

The Agents namespace provides the core framework for building AI-powered voice
agents with SignalWire. It includes the central [`AgentBase`][ref-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.

<Info>
  The Agents SDK generates [SWML][swml] documents under the hood.
  Each agent produces a SWML document with the `ai` verb that the SignalWire platform executes.
</Info>

## Example

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

```typescript {3}
import { AgentBase, FunctionResult } from '@signalwire/sdk';

const agent = new AgentBase({ name: 'support-agent', route: '/support' });
agent.setPromptText(
  'You are a friendly support agent for Acme Corp. ' +
  'Help customers check their order status. ' +
  'Be concise and professional.'
);
agent.setParams({ temperature: 0.5, end_of_speech_timeout: 800 });

agent.defineTool({
  name: 'check_order',
  description: 'Check an order status by ID',
  parameters: {
    order_id: { type: 'string', description: 'The order ID to check' },
  },
  handler: (args, rawData) => {
    const orderId = (args.order_id as string) || 'unknown';
    return new FunctionResult(`Order ${orderId} shipped on March 28 and arrives tomorrow.`);
  },
});

agent.addSkill('datetime');

agent.run();
```

## Classes

<CardGroup cols={2}>
  <Card title="AgentBase" href="/docs/server-sdks/reference/typescript/agents/agent-base">
    The central class for building AI agents. Manages prompts, tools, skills, and serving.
  </Card>

  <Card title="SWMLService" href="/docs/server-sdks/reference/typescript/agents/swml-service">
    SWML document generation and Hono service for non-AI call flows.
  </Card>

  <Card title="SWMLBuilder" href="/docs/server-sdks/reference/typescript/agents/swml-builder">
    Fluent builder for constructing SWML documents programmatically.
  </Card>

  <Card title="SwaigFunction" href="/docs/server-sdks/reference/typescript/agents/swaig-function">
    Wraps TypeScript functions as callable SWAIG tools with validation and metadata.
  </Card>

  <Card title="FunctionResult" href="/docs/server-sdks/reference/typescript/agents/function-result">
    Fluent interface for returning actions and responses from tool functions.
  </Card>

  <Card title="ContextBuilder" href="/docs/server-sdks/reference/typescript/agents/context-builder">
    Multi-step agent workflows with context and step navigation.
  </Card>

  <Card title="DataMap" href="/docs/server-sdks/reference/typescript/agents/data-map">
    Server-side API tools that execute REST calls without agent webhooks.
  </Card>

  <Card title="SkillBase" href="/docs/server-sdks/reference/typescript/agents/skill-base">
    Base class for building reusable skill plugins.
  </Card>

  <Card title="PomBuilder" href="/docs/server-sdks/reference/typescript/agents/pom-builder">
    Prompt Object Model builder for structured prompt composition.
  </Card>

  <Card title="AgentServer" href="/docs/server-sdks/reference/typescript/agents/agent-server">
    Host multiple agents on a single Hono process with route-based dispatch.
  </Card>

  <Card title="Prefabs" href="/docs/server-sdks/reference/typescript/agents/prefabs">
    Pre-built agent templates for common conversational patterns.
  </Card>

  <Card title="Skills" href="/docs/server-sdks/reference/typescript/agents/skills">
    Built-in skills catalog with 19 pluggable capabilities.
  </Card>

  <Card title="Configuration" href="/docs/server-sdks/reference/typescript/agents/configuration">
    Environment variables, config files, security settings, and authentication.
  </Card>

  <Card title="LiveWire" href="/docs/server-sdks/reference/typescript/agents/livewire">
    LiveKit-compatible API layer — use familiar livekit-agents classes on SignalWire infrastructure.
  </Card>

  <Card title="SkillManager" href="/docs/server-sdks/reference/typescript/agents/skill-manager">
    Manages the lifecycle of skills loaded on an agent.
  </Card>

  <Card title="SkillRegistry" href="/docs/server-sdks/reference/typescript/agents/skill-registry">
    Global singleton for registering and discovering skills by name.
  </Card>

  <Card title="Helpers & Utilities" href="/docs/server-sdks/reference/typescript/agents/helpers">
    Context creation, API tools, security utilities, type inference, and standalone functions.
  </Card>
</CardGroup>