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
        • addSection
        • addVerb
        • addVerbToSection
        • ai
        • answer
        • build
        • document
        • getDocument
        • getSchemaUtils
        • hangup
        • play
        • render
        • renderDocument
        • reset
        • say
        • setValidation
      • 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
AgentsSwmlBuilder

ai

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

answer

Next
Built with

Add an ai verb to the main section. Starts an AI-powered conversation on the call.

This is a dynamic verb method that accepts a generic config object. The config is passed directly as the AI verb’s configuration payload in the SWML document.

Parameters

config
Record<string, unknown> | undefined

Optional configuration object for the AI verb. The structure matches the SWML AI verb specification and may include keys such as prompt, post_prompt, post_prompt_url, swaig, hints, languages, params, and global_data.

The prompt key accepts either a text string or a POM (Prompt Object Model) structure — these are mutually exclusive. Do not set both prompt.text and prompt.pom in the same config.

Returns

this — The builder instance for method chaining.

Example

1import { SwmlBuilder } from '@signalwire/sdk';
2
3const builder = new SwmlBuilder();
4builder.answer();
5builder.ai({
6 prompt: { text: 'You are a helpful assistant.' },
7 post_prompt_url: 'https://example.com/summary',
8});
9
10console.log(builder.renderDocument());