Skip to main content

Introducing the SWAIG SDK

· 2 min read
Devon White
Developer Experience Specialists

We are happy to announce the initial release for the SWAIG SDK!

This SDK implementation simplifies the process of hosting a server for your SignalWire AI Agent to perform server-side processing.

Future updates will adhere to Semantic Versioning. This means you can upgrade with confidence knowing that new versions will not break your version from minor updates.

SignalWire Release Card

Overview

This SWAIG SDK will provide users the tools to build their own SWAIG server in Node.js to help with their AI Agent. Users will be able to define functions for the AI to utilize such as a transfer function, send SMS function, start streaming function, etc...

Example

import { SWAIG } from '@signalwire/swaig'

const server = await SWAIG({
user: "<USER_NAME_HERE>",
password: "<PASSWORD_HERE>",
generateMetaDataToken: () => uuid()
})

await server.addFunction({
// user: "<USER_NAME_HERE>",
// password: "<PASSWORD_HERE>",
// token: "<META_DATA_TOKEN>", // to check

name: "get_weather",
purpose: "use when inquired about weather anywhere across the globe",
argument: {
properties: {
location: {
description: "the location to check the weather in",
type: "string"
}
},
type: "object"
},
}, (params) => { /* implementation */ });

await server.run()

The above SWAIG server will expose the routes:

  • GET /
  • GET /get_weather

When the route /get_weather is requested from a SignalWire AI agent, it will perform the get_weather function.

Getting Started

To get started with the SWAIG SDK, please refer to our NPM package here